Skip to main content

Using URL to connect via a proxy.

1 reply [Last post]
Joined: 2006-01-06

Does anyone know if there are any issues regarding using URL to access data via a proxy within a .jnlp application.

I set the system properties:

Properties p = System.getProperties();
p.put("proxySet", "true");
p.put("proxyHost", "");
p.put("proxyPort", "8080");

then I use the URL class to read some data.

URL url = new URL("http://some.web.address/path/to/some/file");
BufferedInputStream bis = new BufferedInputStream(url.openStream());

However I cannot get it to work. I know the proxy.

Can anyone see anything that I am missing.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2005-04-17

Depends on the version of Java you are using.
for Java 1.4 the system properties "http.proxyPort" and "http.proxyHost" are used.
for java 1.5.0 and beyond, the deployment products (Java Web Start and Java Plug-in) use the new ProxySelector and Proxy classes in to install a ProxySelector that can dynamically select proxies based on the url.
If you want the System Properties to still be used you need to call