users@jersey.java.net

[Jersey] Cookie handling in jersey client 2.x

From: Sapna Bhargava <sapnabhargava.sb_at_gmail.com>
Date: Wed, 5 Nov 2014 15:29:22 +0530

Hi All,

I have moved from jersey 1.0 to 2.0. In jersey 1.0 Client I was using the
following snippet to handle session cookies :
ApacheHttpClientConfig config = new DefaultApacheHttpClientConfig();
config.getProperties().put(ApacheHttpClientConfig.PROPERTY_HANDLE_COOKIES,
true);

Is there any mechanism to do the same in jersey client 2? I tried the below
but it doesnt persist the cookies:
ClientConfig clientConfig = new ClientConfig();
clientConfig.property(ApacheClientProperties.DISABLE_COOKIES, false);

Do we need to create a RequestFilter to do the same?

Thanks in advance,
Sapna