hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ROLWE...@de.ibm.com>
Subject Re: Auto-detecting proxy settings in a standalone Java app
Date Fri, 22 Oct 2004 08:52:42 GMT
Hello Chris,

native Windows applications "just work" because they access native
Windows APIs to read the proxy settings, which are probably stored
somewhere in the Windows registry. Browsers and the Java Plugin
for browsers are native Windows applications, and therefore can do
just that.

The only solution I can imagine right now is for you to write JNI code
that looks up the appropriate keys in the registry. Which means you'll
have to distribute a DLL along with the Java application.

Wait, here is another idea: you could write a startup script that does
the proxy settings lookup, then passes the settings through -D
definitions as system properties, which can be accessed by your
Java application. That's a bit less ugly than calling native code
from within the app. The proxy settings for the HttpURLConnection
of the JDK are expected as system properties, too.

hope that helps,

"Chris Brown" <chris92250@hotmail.com> 
22.10.2004 10:18
Please respond to
"Commons HttpClient Project"


Auto-detecting proxy settings in a standalone Java app


I would like to perform a simple request against a HTTP server in an 
application that will be deployed to customers with a wide variety of 
network configurations.  The application won't be deployed as an applet or 

within Java Webstart, but will require JDK 1.4.2+ as the platform.  The 
target audience are all Windows users.

I've searched the HTTPClient archives and also the forums on Sun's Java 
Developer site.  The only useful links were:


I get the following error when trying this out:

java.io.IOException: Proxy service provider is not yet set

...so I assume this only works within Webstart or an applet.

Is there any way I can *automatically* retrieve the user's browser 
even if requires using JNI or JNIWrapper for example ?  At least the proxy 

host and port, even better if it can automatically enable login (or even 
provide me with enough info to use the NTLM features of HTTPClient, if 
required by the customer's environment).

Manual proxy configuration generates *way* more support costs at present 
than anything else in the project.  It's annoying to be disadvantaged in 
this way, when most native Windows applications "just work"...

Thanks in advance,
Chris Brown

Bloquez les fenĂȘtres pop-up, c'est gratuit ! http://toolbar.msn.fr

To unsubscribe, e-mail: 
For additional commands, e-mail: 

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message