We have an existed created cookies and they don't have any expiry date, so they are using 30 minutes default time to expire. I just wanted to make them expire in 2 minutes like below with set max age.
Cookie sessionCookie = new Cookie("sessioncookie", "345rfhthjii");
sessionCookie.setPath("/");
sessionCookie.setSecure(true);
sessionCookie.setMaxAge(120);
response.addCookie(sessionCookie);
The above code does not work, So i went through the other posts which are related to this session expiration but every solution tells about date/time which needs to set in jsp pages.
Can't we do any thing in the servlet itself?
I know this was a few years ago, but I have been searching the min time one can set to Max-age, and on my trials the browser does not store anything less than 5 minutes, maybe that's the minimum.