Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

kookie.getMAxAge  RSS feed

Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I have set kookie.setMaxAge(3600)in servlet SetCookie;

I read back kookies in other servlet ShowCookie...kookie was there but I have expected some int value in seconds kookie.getMaxAge()but I got -1.
Is this value reset to -1 so I canot check how much time for kookie was sets before?


myCookie Name myCookie Value MaxAge
Persistent-Cookie-0 Cookie-Value-P0 null null -1
Persistent-Cookie-1 Cookie-Value-P1 null null -1
Persistent-Cookie-2 Cookie-Value-P2 null null -1

I took out special char...from html and ..ookie =Kookie for posting on this page

Kookie[] cookies = request.getKookies();
Kookie kookie;
for(int i=0; i<kookies.length; i++) {
kookie = kookies[i];
out.println("TR\n" +
" TD" + kookie.getName() + "\n" +
" <D" + kookie.getValue()+ "\n" +
" TD" + kookie.getDomain() + "\n" +
" <D" + kookie.getPath() + "\n" +
" <D" + kookie.getMaxAge());
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!