hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philip Kahle <philip.ka...@uibk.ac.at>
Subject HttpClientBuilder does not use system properties for proxy
Date Fri, 15 Apr 2016 09:59:59 GMT

I am instantiating a HttpClientBuilder like this and tried to make it
use the Java system properties for a proxy server via useSystemProperties():

protected static HttpClientBuilder builder;
PoolingHttpClientConnectionManager cm = new
builder =
CloseableHttpClient httpClient = builder.build();

However it does not set the proxy (all hostname, port, username and
password have been set at this point).

I don't see how to get a SystemDefaultHttpClient at this point, which to
my understanding should be used at this point, and I did not find the
correct solution besides passing all the data manually, e.g. like this:

NTCredentials ntCreds = new NTCredentials(user, password,
localMachineName, domainName );
CredentialsProvider credsProvider = new BasicCredentialsProvider();
setCredentials( new AuthScope(host,port), ntCreds);
setProxyAuthenticationStrategy(new ProxyAuthenticationStrategy());

However, here localMachineName and domainName have to be guessed somehow...

What is the correct solution to set a proxy in this setting?

Many thanks and best regards,

To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

View raw message