cannot set a proxy
I can only set the proxy if I call this parameter before I start my application:
-Dhttp.proxyHost=proxy.localhost.com -Dhttp.proxyPort=8080
If I do it from code, like this:
System.setProperty("http.proxySet","true");
System.setProperty("http.proxyHost","proxy.localhost.com");
System.setProperty("http.proxyPort","8080");
System.setProperty("http.proxyType","4");
the application fails. Is this some sort of java bug? I'm using version 1.5.0_05.
I'd like to be able to set the proxy on code, so I can give a simpler choice to the user.
Thanks,
Sergio Bastos
[830 byte] By [
vermelh0a] at [2007-10-2 6:07:40]

Are you absolutely certain that code is being executed, and done so before it makes HTTP connections?Also, why are you setting the first and last properties in code, if you're not specifying them on the command-line in your working case?
Well, I set the proxy right before calling the code that will use it. I've tested this by setting a break point numerous times.
As for the second question, I have tried many variations to set the proxy in code. Like just setting:
System.setProperty("http.proxyHost", "proxy.localhost.com");
System.setProperty("http.proxyPort", "8080");
or setting
System.setProperty("proxyHost", "proxy.localhost.com");
System.setProperty("proxyPort", "8080");
None work.
Anyway, I just set all these properties to be thorough.
Thanks,
Sergio Bastos