Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's the deal with Cookie.setMaxAge(Integer.MAX_VALUE)?

setMaxAge is supposed to control the maximum age of a cookie, so if my intention is to literally set the maximum age possible the logical thing would be doing:

cookie.setMaxAge(Integer.MAX_VALUE);

However this results in no Expires in cookie HTTP header at all, I'm testing it on a WebSphere 7. Setting it to something like 1 year measured in seconds works fine.

Why is that happening?

PS Have just tested on Tomcat7 - Integer.MAX_VALUE results in Max-Age=2147483647; Expires=Wed, 06-Mar-2080 21:30:32 GMT, so it must be something wrong with WebSphere.

like image 393
Oleg Mikheev Avatar asked Feb 17 '12 16:02

Oleg Mikheev


1 Answers

Problem is described in http://www-01.ibm.com/support/docview.wss?uid=swg1PM34869. Cause is a kind of millenium problem: WAS7 writes cookies date as YY, WAS6 as YYYY

like image 88
Gerrit van Brakel Avatar answered Oct 04 '22 21:10

Gerrit van Brakel