File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Bypass proxy to access local network URLs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Bypass proxy to access local network URLs" Watch "Bypass proxy to access local network URLs" New topic

Bypass proxy to access local network URLs

Ashraf Fouad
Ranch Hand

Joined: Oct 07, 2001
Posts: 80
I have a web application deployed on application server Oracle 9i AppServer -I don't think the application server has

anything to do with my problem-, it calls other web application through HTTP, on the local network, the other application

servers are hosted on windows platform and/or Unix platform.

All these machine can access Internet through proxy server, but there are no proxy or firewalls between them, so everything

is openned between the machines in the local network.

When I try to connect from one machine to another using the following code, I find that it always request proxy

authentication, which I would like to bypass.
The error says: http request returned error code 407


import java.util.Properties;
public class UrlConnector
public void connect(String url,String[] params, String[] values )
URL l_URL = new URL(url);
URLConnection l_URLConnection = l_URL.openConnection();
l_URLConnection.setRequestProperty("Method", "POST");
PrintWriter l_PrintWriter = new PrintWriter(l_URLConnection.getOutputStream());
String l_szParams ="";
if(params.length >=1)

for(int i=1;i<params.length;i++)

BufferedReader l_BufferedReader = new BufferedReader(new InputStreamReader(l_URLConnection.getInputStream()));
String l_szResponseLine = "";
String l_szURLResponse;
for ( l_szURLResponse = "";
(l_szResponseLine = l_BufferedReader.readLine()) != null;
l_szURLResponse = l_szURLResponse + l_szResponseLine );

catch(Exception l_exception)

I found that what I need is similar to setting in Internet Explorer to bypass proxy for addresses starting with ..... But

I don't know how to apply this to my code? I'm using JDK 1.3.1

Anyone can help, I'm open to use any libary that overcome this problem.

Thanks, in advance

Ashraf Fouad
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
I believe the system property you're looking for is http.nonProxyHosts. You can find out more at...

James Carman, President<br />Carman Consulting, Inc.
Ashraf Fouad
Ranch Hand

Joined: Oct 07, 2001
Posts: 80
Thanks very much it worked great

Thanks for fast reply
I agree. Here's the link:
subject: Bypass proxy to access local network URLs
Similar Threads
How create URL object with GET parameters?
HTML form created by Java
Imp-How to execute a JSP file from java main
help: need help for post
Simulating Post in Java code.....