How to change the CookieSpec in Jersey Client?

331 Views Asked by At

I used Jersey Client in the project like this:

clientConfig.connectorProvider(new ApacheConnectorProvider());
clientConfig.register(MultiPartFeature.class);
client = ClientBuilder.newClient(clientConfig);

it actually use httpClient to do the job. but now I encountered the CookieSpec issue in this question: Fixing HttpClient warning “Invalid expires attribute” using fluent API. I need to change the CookieSpec but I cannot find where to change the config.

1

There are 1 best solutions below

0
On BEST ANSWER

Maybe you can try to use the below solution:

RequestConfig requestConfig = RequestConfig.custom()
                .setCookieSpec(CookieSpecs.STANDARD).build();
        clientConfig.property(ApacheClientProperties.REQUEST_CONFIG, requestConfig);