Skip to main content

Accessing a web page through a firewall

No replies
Anonymous

By default the JavaHelp libraries will not be able to access files that
are outside a firewall. This is because the default proxy and proxy
port are set to none and 80. However, the http.proxyHost and optionally
http.proxyPort System properties can be easily set to override the
default settings. Both properties can be set either in the code or on
the command line. The code below is an example of setting the proxy
attributes in code:

// set the old named properties for older VMs
System.setProperty( "proxyHost", proxyHost );
System.setProperty( "proxyPort", portStr );

// set the new properties for 1.3+
System.setProperty( "http.proxyHost", proxyHost );
System.setProperty( "http.proxyPort", portStr );

On the command line use -D option. For example to activate the hsviewer
with proxy support you would use the following command:

java -Dhttp.proxyHost=myproxy.com -Dhttp.proxyPort=8080 -jar hsviewer.jar

Note: The proxyPort is set to 80 by default if a proxyHost is defined.

********************************************************************************

You may leave the list at any time by sending message with no subject and
"SIGNOFF JAVAHELP-INTEREST" in the body to LISTSERV@JAVA.SUN.COM. Archives
are available at http://archives.java.sun.com/archives/javahelp-interest.html.
Submit bug reports at http://java.sun.com/cgi-bin/bugreport.cgi.