hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: How to configure SSLSocket Factory per route using Apache HTTP Components
Date Sun, 10 Apr 2016 13:22:48 GMT
On Sun, 2016-04-10 at 15:29 +0530, Venkata Pavan Kumar Sannisetty wrote:
> Is there any way to setup a separate SSL Context Factory for each route in
> Apache HTTP Client. From the documentation i can only see we can configure
> SSLContextFactory per scheme not per route.
> Registry<ConnectionSocketFactory> r =
> RegistryBuilder.<ConnectionSocketFactory>create()
>             .register("http", plainsf)
>             .register("https", sslsf)
>             .build();
>     HttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(r);
>     HttpClients.custom()
>             .setConnectionManager(cm)
>             .build();
> All my target endpoints are protected with HTTPS and mandates client
> certificate authentication. For each of these endpoint i have to select a
> specific client certificate & present it to the endpoint server. Currently
> i am seeing the only is to create a separate HTTPClient instance for each
> target endpoint route.
> I am here looking for any pointers to improving this design.
> Thanks.

One can use 'http.socket-factory-registry' context attribute to that end
but please note this feature is considered undocumented. 


Please also note that one can build a custom ConnectionSocketFactory
that makes use of custom context attributes when creating SSL sockets.
That would be the recommended way to solve the issue.


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

View raw message