简体   繁体   中英

HttpServletRequest getCookies() always returns null Jersey Api

I m able to add the cookie to response and view it on my chrome browser. I checked it through settings --> advancedSettings --> content settings.

@Context
HttpServletRequest servletRequest;
Cookie[] cookies = servletRequest.getCookies();

I m using @Context to get the request and getCookies() always returns null .

I m able to see the cookie in request headers in chrome using Inspect Element.

I was using @context UriInfo and uriInfo variable add a request with cookie part of its header.

I was able to extract the cookie as single String and do String manipulation over it but it works fine.

Still HttpServletRequest getCookies it didn't work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM