On Wed, 2014-07-16 at 12:30 +0000, Nicolae Marasoiu wrote:
> Hi,
>
>
>
> Context:
>
> According to
> http://stackoverflow.com/questions/9811828/common-httpclient-and-proxy
> it seems that some versions of HttpClient need a separate
> configuration / code to set an http proxy, while others use the JVM
> http.proxyHost and http.proxyPort as their default. Is my
> understanding correct?
>
>
>
> We configure Tomcat6 with JAVA_OPTS="-Dhttp.proxySet=true
> -Dhttp.proxyHost=<IP of proxy> -Dhttp.proxyPort=<Port of proxy (8080)>
> -Dhttp.nonProxyHosts=<hosts that should not be accessed through the
> proxy> $JAVA_OPTS"
>
> Problem:
>
> We use a third party software which, in an attempt of an HTTP POST
> with basic auth (which should use an http proxy server configured
> above) gives a stack trace ending in:
>
...
> My assumption so far is that the HttpClient in use needs a separate
> http proxy configuration (and does not take it from the JVM parameters
> intended for this purpose).
>
> An explanation of this is that it uses a standalone / embedded http
> stack, and only reuses the core tcp stack from the JVM. Is that the
> case?
>
>
>
> I am in the process of finding out the exact name and version of the
> apache artifact which contains the HttpClient class seen in the stack
> trace.
>
This behavior is not version specific. By default HttpClient does not
take system properties into account. One must explicitly configure
HttpClient to do so:
-----
CloseableHttpClient client1 = HttpClients.createSystem();
CloseableHttpClient client2 = HttpClients.custom()
.useSystemProperties()
.build();
-----
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]