Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

Java Tip 42: Write Java apps that work with proxy-based firewalls

How to use Java to connect with HTTP servers outside your corporate firewall

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone

Page 2 of 2

Proxying FTP

Scott D. Taylor sent in the magic incantation to deal with proxying the FTP protocol:

defaultProperties.put( "ftpProxySet", "true" );
defaultProperties.put( "ftpProxyHost", "proxy-host-name" );
defaultProperties.put( "ftpProxyPort", "85" );


You can then access the files URLs using the "ftp" protocol via something like:

URL url = new URL("ftp://ftp.netscape.com/pub/navigator/3.04/windows/readme.txt" ); 


If anybody has examples of using a proxy with other Internet protocols, I'd love to see them.

Note: The example code (Example.java) has only been tested with JDK 1.1.4.

About the author

Ron Kurr has been working as a software engineer at Cabletron Systems for the past eight years, using C++, Unix, and NT. For the past two years he has devoted himself to Java and Internet technologies.
  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comments (7)
Login
Forgot your account info?

PerfectlyBy Anonymous on October 3, 2009, 9:45 amThank you very much!!

Reply | Read entire comment

i dont get it, where am i supposed to put that in? im usually prBy Anonymous on August 11, 2009, 9:08 ami dont get it, where am i supposed to put that in? im usually pretty good with comps, but not really good with programing

Reply | Read entire comment

Good tipBy Anonymous on July 22, 2009, 5:36 amI reeally liked it very much. Thanks

Reply | Read entire comment

HTTP proxies written in java.By Anonymous on July 4, 2009, 6:54 amHi, You may be interested in this database of open source HTTP proxies written in Java. http://proxies.xhaus.com/java/ There's also a list of open source HTTP...

Reply | Read entire comment

fixBy Anonymous on June 1, 2009, 7:05 pmin order for this to work add Basic keyword to the encoded password connection.setRequestProperty( "Proxy-Authorization", "Basic " + encodedPassword );

Reply | Read entire comment

View all comments

Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources
  • java.lang.System http://www.javasoft.com/products/jdk/1.1/docs/api/java.lang.System.html
  • java.net.URLConnection http://www.javasoft.com/products/jdk/1.1/docs/api/java.net.URLConnection.html
  • HTTP Client API http://www.innovation.ch/java/HTTPClient/
  • Cabletron Systems http://www.cabletron.com/
  • CsProxy (a free proxy server) http://www.cabletron.com/csproxy/
  • Relevant RFCs http://www.cabletron.com/csproxy/handbook/rfc/