如果我按照如下所示创建了我的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并进行相应设置。
嗨,我处于类似的情况,你有没有找到办法做到这一点? –