On Fri, 2016-04-15 at 11:59 +0200, Philip Kahle wrote: > Hi, > > 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 > PoolingHttpClientConnectionManager(); > builder = > HttpClients.custom().setConnectionManager(cm).useSystemProperties(); > ... > 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); > setDefaultCredentialsProvider(credsProvider); > 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? >
Do not set fully initialized connection manager. It makes all connection management settings have no effect. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org