httpurlconnection and Proxy settings
807597May 12 2005 — edited May 12 2005hi all,
I wrote a servlet that uses an HTTPUrlConnection to get a page from a remote server and the code looks like this :
url = new URL(urlstr);
HttpURLConnection uc = null;
System.getProperties().put( "proxySet", "true" );
System.getProperties().put( "proxyHost", "[myproxyhost]");
System.getProperties().put( "proxyPort", "[myproxyport]);
uc = (HttpURLConnection) url.openConnection();
.....
....
The code works fine for the particular connection.
If I need to get another page though another connection that needs no Proxy settings, it doesn't work.
How can I deactivate the proxy settings between the two connections?
And, finally, how can I leave the System settings in the same state as before the code execution?
Thank you.
Nicola