通过设置jvm的proxyhost来实现设置tomcat中引用程序的代理
在catalina.bat/sh中设置set JAVA_FLAGS=-Dhttp.proxySet=true -Dhttp.proxyHost=proxyserver -Dhttp.proxyPort=8080, 然后在EXEC_JAVA部分加上这部分参数。
在代码中设置如下
Setting System Properties in Code
Add the following lines in your Java code so that JVM uses the proxy to make HTTP calls. This would, of course, require you to recompile your Java source. (The other methods do not require any recompilation):
System.getProperties().put("http.proxyHost","someProxyURL");
System.getProperties().put("http.proxyPort","someProxyPort");
System.getProperties().put("http.proxyUser","someUserName");
System.getProperties().put("http.proxyPassword","somePassword");
|