如果我按照如下所示創建了我的httpBuilder(假設proxyUsername已設置,因此setCredentials被調用),那麼正確傳入httpAddress-es的調用將通過代理進行路由。但是,該應用程序在本地網絡中有一些http調用。可以使用http.nonProxyHosts來解決此問題並繞過代理?如果是這樣,怎麼樣?使用System.setProperty?或者在HttpBuilder上的東西?Groovy HttpBuilder的NonProxyHosts用法
HTTPBuilder httpBuilder = new HTTPBuilder(httpAddress)
httpBuilder.setProxy(webProxyHost, webProxyPort, webProxyProtocol)
if (proxyUsername) {
httpBuilder.client.getCredentialsProvider().setCredentials(
new AuthScope(webProxyHost, webProxyPort),
new UsernamePasswordCredentials(proxyUsername, proxyPassword))
}
}
在上面的代碼中,所有各種命名元素(webProxyHost等)都聲明爲String並進行相應設置。
嗨,我處於類似的情況,你有沒有找到辦法做到這一點? –