I trying to remove a cookie in a servlet with this code
Cookie minIdCookie = null;
for (Cookie c : req.getCookies()) {
if (c.getName().equals("iPlanetDirectoryPro")) {
minIdCookie = c;
break;
}
}
if (minIdCookie != null) {
minIdCookie.setMaxAge(0);
minIdCookie.setValue("");
minIdCookie.setPath("/");
res.addCookie(minIdCookie);
}
res.flushBuffer();
But this gives no effect and no change in the cookie properties.
I've also tried adding a cookie in this servlet and this works fine.
Why is it that I can not change the properties of an existing cookie.