简体   繁体   English

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

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

I am using WS to make a REST call to a server behind a proxy that required. 我正在使用WS对所需代理后面的服务器进行REST调用。

I tried to set proxyserver and port in application.conf and as JVM arg when I launch the application. 启动应用程序时,我尝试在application.conf和JVM arg中设置proxyserver和port。 But I keep getting "Error Code: 407 Proxy Authentication Required". 但是我一直收到“错误代码:要求407代理身份验证”。

I tried to set ws.useProxyProperties at false and true, but it still doesn't work. 我试图将ws.useProxyProperties设置为false和true,但仍然无法正常工作。 I saw that it is a common problem, but no workaround has been published. 我看到这是一个常见问题,但尚未发布任何解决方法。

Do you have any idea? 你有什么主意吗?

Thanks 谢谢

I managed to resolve this issue by using the dependancy 我设法通过使用依赖关系解决了这个问题

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

And changing my code to 并将我的代码更改为

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