加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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参数:
-Dhttp.proxyHost = _my_proxy_host_ -Dhttp.proxyPort = 80
并且仍然有相同的例外.

另一方面,以下代码段运行良好:

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读