bezmax
bezmax

Reputation: 26132

HtmlUnit to use proxy from JVM properties

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.

Upvotes: 2

Views: 650

Answers (1)

opyate
opyate

Reputation: 5428

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

Upvotes: 1

Related Questions