Hi All,
I have written a simple method to read cookie value (code below). Code works fine in author environment but breaks in publish as request.getCookies() returns null to me. I have white-listed the cookie in Opt configuration. Please can someone help what should i do to fix this.
After it works fine in publish, I hope it works in Dispatcher also.
Thanks,
Shehjad
public static String readCookieValue(final SlingHttpServletRequest request, final String name) { final Cookie[] cookies = request.getCookies(); for (final Cookie cookie : cookies) { if(cookie.getName().equals(name)){ return cookie.getValue(); } } return null; }
Views
Replies
Total Likes
Hi,
Have you verified through browser console whether cookie is part of request or not?. if cookie is not part of request, kindly check how are you setting the cookie?
Regards,
Jitendra
Views
Replies
Total Likes
As mentioned by Jitendra,
This actually means that the request the client sent in contains no cookies. Please check them through browsers dev tools.
Or it could be the case that your cookie got expired.
~kautuk
Views
Replies
Total Likes
Did you got a solution?
Views
Replies
Total Likes
Views
Likes
Replies