users@jersey.java.net

Re: [Jersey] ApacheHttpClient using HTTPSProperties

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Wed, 1 Sep 2010 12:04:12 +0200

Hi David,

HTTPSProperties is only supported for HttpURLConnection.

For the Apache HTTP client i think you will have to modify the
HttpClient:

   ApacheHttpClient ahc = ...
   HttpClient hc = hc.getClientHandler().getHttpClient()

I found these may may help:

   http://hc.apache.org/httpclient-3.x/sslguide.html
   http://ross-o.com/index.php?/archives/19-Adding-SSL-to-
HttpClient.html

Paul.

On Sep 1, 2010, at 3:57 AM, David Smith wrote:

> Hello,
>
> I am trying to implement a Jersey client that can both handle
> cookies (which is why I am using the ApacheHttpClient
> implementation) and self-signed certificates. I created a custom
> SSLContext instance that will allow self-signed certificates to be
> handled properly and set this in the HTTPSProperties object that I
> am putting into the ApacheHttpClientConfig map. I can see that my
> custom SSLContext trust manager is being called when my client is
> created using Client.create() and a config map that has the
> HTTPSProperties set, but for some reason the ApacheHttpClient I
> construct is ignoring my SSLContext and seems to still use the
> default one even though I had the HTTPSProperties parameter set
> properly in its config map.
>
> Does ApacheHttpClientConfig support the HTTPSProperties property?
> If not, is there a way to allow cookie support for the default
> client instance without using ApacheHttpClientConfig?
>
> Thank you for your help!
>
>
> David Smith
> Information Sciences Institute
>