scala – 在代理后使用调度0.9.5?
发布时间:2020-12-16 19:08:05 所属栏目:安全 来源:网络整理
导读:我正在尝试从代理后面执行(在IntelliJ IDE或sbt命令行中)这个非常基本的调度片段: import dispatch._val svc = url("http://api.hostip.info/country.php")val country = Http(svc as.String)println(country()) 而我所能得到的只是一个例外: java.net.Con
我正在尝试从代理后面执行(在IntelliJ IDE或sbt命令行中)这个非常基本的调度片段:
import dispatch._ val svc = url("http://api.hostip.info/country.php") val country = Http(svc > as.String) println(country()) 而我所能得到的只是一个例外: java.net.ConnectException: Connection timed out: no further information to http://api.hostip.info/country.php java.util.concurrent.ExecutionException: java.net.ConnectException: Connection timed out: no further information to http://api.hostip.info/country.php 我尝试没有确定的结果来设置通常的vm参数: 另一方面,以下代码段运行良好: import dispatch._ val svc = url("http://api.hostip.info/country.php") setProxyServer(new com.ning.http.client.ProxyServer(myproxyhost,80)) val country = Http(svc > as.String) println(country()) 因为它看起来不太美观,也不像scala-ish,我想知道在这种情况下它是否真的应该是我应该做的. 如果提前感谢,欢迎任何帮助. 解决方法
如果设置此参数,将使用http.proxyHost和http.proxyPort:
-Dcom.ning.http.client.AsyncHttpClientConfig.useProxyProperties=true 另外还有参数: -Dcom.ning.http.client.AsyncHttpClientConfig.proxy.user=user -Dcom.ning.http.client.AsyncHttpClientConfig.proxy.password=password -Dcom.ning.http.client.AsyncHttpClientConfig.proxy.protocol=NTLM (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |