HtmlUnit 使用 JVM 属性的代理

发布于 2024-11-18 02:59:11 字数 289 浏览 6 评论 0原文

似乎 HtmlUnit 使用它自己的集中式 ProxyConfig 对象来设置代理设置。有没有办法让它忽略 ProxyConfig 并使用 JVM 属性 https.proxyHosthttps.proxyPorthttp.proxyHosthttp.proxyPort

当然,手动复制值是一种选择,但这不是最好的选择,因为我的 WebClient 应该使用具有不同代理的 https 和 http。

提前致谢。

it seems that HtmlUnit uses it's own centralized ProxyConfig object to set up proxy settings. Is there a way to make it ignore the ProxyConfig and use JVM properties https.proxyHost,https.proxyPort,http.proxyHost and http.proxyPort?

Sure, copying the values manually is an option, but it is not the best option as my WebClient should use both https and http which have different proxies.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

再见回来 2024-11-25 02:59:11

HtmlUnit 依赖于 Apache Commons HttpClient 并且后者不使用 JVM 开关<代码>http.proxyHost 和http.proxyPort

还讨论了此 HttpClient 问题 在这里

解决方案是提交补丁到 HtmlUnit 甚至 HttpClient 来完成你想要的操作,或者在本地重新编译修补后的代码。

为了供将来参考,在撰写本文时版本为:

  • HtmlUnit 2.8
  • HttpClient 4.0.1

HtmlUnit depends on Apache Commons HttpClient and the latter doesn't use the JVM switches http.proxyHost and http.proxyPort.

This HttpClient issue was also discussed here.

The solution would be to submit a patch to HtmlUnit or even HttpClient that does what you want, or re-compile the patched code locally.

For future reference, at the time of writing the versions are:

  • HtmlUnit 2.8
  • HttpClient 4.0.1
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文