Web tier: servlets, JSP, Web frameworks: How can a servlet use a URLConnection that will use a Proxy
- Posted by: Jan Burse
- Posted on: May 14 2002 05:02 EDT
How can I set up the JDK/J2EE so that URLConnections
will make use of a Proxy. I want to create an URLConnection
from an URL like http://www.ibm.com. But I am sitting behind
a firewall with a proxy that can get through. How can I configure
my Java environment so that the proxy will be used in my
Servlet that will run in Catalina.
- How can a servlet use a URLConnection that will use a Proxy by Weston Aiken on May 14 2002 15:12 EDT
You need to set 3 system properties and the URLConnection will go through your proxy server.
You can set them in your code...
System.getProperties().put("proxyHost", "your proxy host");
System.getProperties().put("proxyPort", "your proxy port");
or when you start the JVM...
java -DproxySet=true ....