Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

httpurlconnection and Proxy settings

807597May 12 2005 — edited May 12 2005
hi 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 9 2005
Added on May 12 2005
3 comments
345 views