users@jersey.java.net

[Jersey] Re: SSLContext not necessary any more for common HTTPS urls (https://www.chase.com/, for example)?

From: Michal Gajdos <michal.gajdos_at_oracle.com>
Date: Mon, 1 Sep 2014 16:21:52 +0200

Hi Jim,

if you don’t provide any SSL config (SSLContext, TrustStore, KeyStore) and you try to fetch secured resources then Jersey tries to create SSLContext from System properties. This means that might end up with a SSLContext that is not initialized with any trust/key manager.

Michal

> On 31 Aug, 2014, at 03:08 , Jianbao (Jim) Tao <jianbao.tao_at_gmail.com> wrote:
>
> Hi,
>
> I used the following groovy code to check how to use Jersey client to access HTTPS urls:
>
> @Test
> void "check https url"() {
> String url = 'https://www.chase.com/ <https://www.chase.com/>'
> Client client = ClientBuilder.newClient()
> Response response = client.target(url).request().get()
> assert response.status == 200
>
> String text = response.readEntity( String )
> assert text.contains('<title>CHASE Bank - Credit Cards, Mortgage, Personal & Commercial Banking')
> }
>
> Surprisingly, the test passed. I was thinking I might have to set up an SSLContext instance, but apparently I don't have to. So, what is happening behind the scene? Does Jersey automatically create an SSL context from the JRE cacerts file for HTTPS urls?
>
> In any case, I am very curious to know what's happening. Thank you.
>
> Best,
> Jim