I am using a Spring controller with a HttpServletRequest and response to remove cookies.
When I need to remove the cookie, I have this code:
Cookie allCookies = request.getCookies();
for (int i = 0; i < allCookies.length; i++)
String name = allCookies[i].getName();
logger.info(i + " Name=" + name + " Value=" + allCookies[i].getValue());
cookieToDelete = allCookies[i];
After this execution, all cookies with the name JSESSIONID should be removed.
What is my mistake?
Try setting the content type and domain as explained here How do you remove a Cookie in a Java Servlet .You cold also try expiring the session using SessionRegistry explained here