If you're writing an application, however you'll have to manually specify the proxy server settings.
You can do this when running a Java application, or you can write code that will specify proxy settings automatically for the user.
To specify proxy settings when running an application, use the -D parameter :
jre -DproxySet=true -DproxyHost=myhost -DproxyPort=myport MyApp
Alternately, your application can maintain a configuration file and specify proxy settings before using a URLConnection :
// Modify system properties
Properties sysProperties = System.getProperties();
// Specify proxy settings
sysProperties.put("proxyHost", "myhost");
sysProperties.put("proxyPort", "myport");
sysProperties.put("proxySet", "true");
No comments:
Post a Comment
Note: only a member of this blog may post a comment.