I have the following HTTP headers in a request and I want to extract the JSESSIONID
from it:
Accept=application/json
Accept-Encoding=gzip
deflate,Accept-Language=en-us
Connection=keep-alive
Content-Length=0
Content-Type=application/json
Cookie=JSESSIONID=ss0ox8w99o9142b73rssvc0r
Host=localhost:8080
User-Agent=Test_QA/34 CFNetwork/711.5.7 Darwin/14.5.0 (x86_64)
I'm using a ContainerRequestContext
as following:
@Override
public void filter(final ContainerRequestContext requestContext) throws IOException {
System.out.println("***HEADER VALUE**: " + requestContext.getHeaderString("Cookie"));
}
Getting result as:
JSESSIONID=zv71od6l2fd41hv6yf0980khy
And:
@Override
public void filter(final ContainerRequestContext requestContext) throws IOException {
Map<String, javax.ws.rs.core.Cookie> clientCookie = requestContext.getCookies();
System.out.println("Client Cookie Map: " + clientCookie);
}
Getting result as:
Clinet Cookie Map: {JSESSIONID=JSESSIONID=1of1x5u1s1l4hdxfg2azlep42}
What is the best way to extract the JSESSIONID
from the request?