HtmlUnit 使用 JVM 属性的代理
似乎 HtmlUnit 使用它自己的集中式 ProxyConfig 对象来设置代理设置。有没有办法让它忽略 ProxyConfig 并使用 JVM 属性 https.proxyHost
、https.proxyPort
、http.proxyHost
和 http.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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
HtmlUnit 依赖于 Apache Commons HttpClient 并且后者不使用 JVM 开关<代码>http.proxyHost 和
http.proxyPort
。还讨论了此 HttpClient 问题 在这里。
解决方案是提交补丁到 HtmlUnit 甚至 HttpClient 来完成你想要的操作,或者在本地重新编译修补后的代码。
为了供将来参考,在撰写本文时版本为:
HtmlUnit depends on Apache Commons HttpClient and the latter doesn't use the JVM switches
http.proxyHost
andhttp.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: