繁体   English   中英

在Play Framework 2.2.x中设置代理选项时,WS.url失败

[英]WS.url fails when proxy options are set in Play Framework 2.2.x

我正在使用WS对所需代理后面的服务器进行REST调用。

启动应用程序时,我尝试在application.conf和JVM arg中设置proxyserver和port。 但是我一直收到“错误代码:要求407代理身份验证”。

我试图将ws.useProxyProperties设置为false和true,但仍然无法正常工作。 我看到这是一个常见问题,但尚未发布任何解决方法。

你有什么主意吗?

谢谢

我设法通过使用依赖关系解决了这个问题

"com.ning" % "async-http-client" % "1.8.14"

并将我的代码更改为

AsyncHttpClientConfig cf = new AsyncHttpClientConfig.Builder().setProxyServer(new 
ProxyServer(host, port, user, pwd)).build();
c = new AsyncHttpClient(cf);
AsyncHttpClient.BoundRequestBuilder req = c.prepareGet("http://api.example.com/");
// and many other parameters ...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM