【发布时间】:2014-07-17 21:36:05
【问题描述】:
我有一个 Spring 应用程序,它使用 spring-ws 来处理我的所有 SOAP 消息,在我的本地开发机器上运行良好。当我部署到需要对任何流量使用代理才能到达外部世界的服务器时,我似乎被卡住了。我的印象是我可以设置一些 JVM 参数,例如
-Dhttp.proxyHost=proxyhostURL
-Dhttp.proxyPort=proxyPortNumber
-Dhttp.proxyUser=someUserName
-Dhttp.proxyPassword=somePassword
但类文件似乎不支持 proxyUser 和 proxyPassword 参数。
我什至更进一步,在 java 代码中实现了它:
System.getProperties().put("http.proxyHost", "someProxyURL");
System.getProperties().put("http.proxyPort", "someProxyPort");
System.getProperties().put("http.proxyUser", "someUserName");
System.getProperties().put("http.proxyPassword", "somePassword");
但还是没有运气。
然后我尝试使用 java.net.Authenticator 设置用户名和密码,但这似乎也不起作用:
Authenticator.setDefault(
new Authenticator() {
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(authUser, authPassword.toCharArray());
}
}
);
有人对如何使用 Java6、Tomcat 6 和 Spring 3(使用 spring-ws)通过代理路由所有流量有任何建议
【问题讨论】:
标签: java spring web-services spring-mvc proxy