Is there a nice way to pass cookie to all request that use same Client object?
Right now I must pass cookie to every request like this:
final Client client = ClientBuilder.newClient(clientConfig);
UriBuilder authenticate_url = UriBuilder.fromUri("xxxxxxxxx/authenticate");
WebTarget webTarget = client.target(authenticate_url);
Invocation.Builder invocationBuilder = webTarget.request(MediaType.APPLICATION_XML);
Response response = invocationBuilder.get();
Map<String, NewCookie> cookies = response.getCookies(); //store cookies
webTarget = client.target(other_url);
invocationBuilder = webTarget.request(MediaType.APPLICATION_XML).cookie(cookies.get("KEY"));
response = invocationBuilder.get(); //works
invocationBuilder = webTarget.request(MediaType.APPLICATION_XML);
response = invocationBuilder.get(); //does not work