Search This Blog

Loading...

Wednesday, October 20, 2010

JVM Proxy Setup



For proxy configuration, use following code in  before main method:


Static{
private static final String HTTP_PROXY_HOST = "http.proxyHost";
 private static final String HTTP_PROXY_PORT = "http.proxyPort";
 private static final String HTTP_PROXY_USER = "http.proxyUser";
 private static final String HTTP_PROXY_PASSWORD = "http.proxyPassword";                              
 private static final String HTTP_SET_PROXY = "http.proxySet";






System.getProperties().put(HTTP_SET_PROXY, "true");
System.getProperties().put(HTTP_PROXY_HOST, “proxyservername”);
System.getProperties().put(HTTP_PROXY_PORT, “portno”);
System.getProperties().put(HTTP_PROXY_USER, <your domainUserName>);
System.getProperties().put(HTTP_PROXY_PASSWORD, <your domainPassword>);      
}


Or

You can also use following command line option:


-Dhttp.proxyHost=proxyhostURL
-Dhttp.proxyPort=proxyPortNumber
-Dhttp.proxyUser=someUserName
-Dhttp.proxyPassword=somePassword


Either of above will work for you.



0 comments:

Post a Comment