File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Using network proxy settings in java program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Using network proxy settings in java program" Watch "Using network proxy settings in java program" New topic

Using network proxy settings in java program

igwe kalu kalu ogba
Ranch Hand

Joined: Feb 03, 2005
Posts: 133
Hello, I have a program , rather a jsp file which makes a connection to an outside server and then displays some information. I have to use the

System.setProperty( "proxySet", "true" );
System.setProperty( "http.proxyHost", "" );
System.setProperty( "http.proxyPort", "" );

With the adequate proxy settings filled in.
The problem here is that the proxy settings are set from a file called Proxy.xml. Before my http request executes, the file Proxy.xml is opened and the details for proxyHost and proxyPort are read and filled in automatically.

But if during the session (ie, while tomcat is running) , the file Proxy.xml is altered in some way, maybe the proxyHost is changed to a different and incorrect IP, the program still works , unless I restart tomcat.

My question is, How do I unset these proxy settings totally from my tomcat server or jsp file once a certain line of code is executed?
i.e, is there a System.unsetProperty or equivalent.

I've tried System.setProperty( "proxySet", "false" );

But it s
Manuel Moons
Ranch Hand

Joined: Mar 05, 2002
Posts: 229
I am not sure if this will work but try

Seems reasonable enough doesn't it?
I agree. Here's the link:
subject: Using network proxy settings in java program
It's not a secret anymore!