Hi. How to update expiration date of cookie? Say I have a cookie that remembers the user's token for 3 weeks. A copy of the token value is stored in the database on the server. After a week the user logs in. The expiration date of the cookie should now be 3 weeks from the time of this last login.
When I called
Cookie[] cookies = httpServletRequest.getCookies();
Cookie cookie = ...;
cookie.setMaxAge(... 3 weeks ...);
httpServletResponse.addCookie(cookie);
then on the browser I saw there were two cookies with the same name -- one with the original expiry date, and the other with the new expiry date.
Not calling httpServletResponse.addCookie(cookie) has no effect.