Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cookie lifetime

 
Dan Murphy
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can someone tell me what is the effect of
Does it mean:

(A) the cookie will expire when the browser is closed
(B) the cookie will never expire

If (A), then how do you make a cookie persist (indefinitely) on the client even after the browser has been closed?

Cheers,
Dan
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd think that the javadocs for that method make that rather clear, don't they?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cookie class in JavaDoc
 
Dan Murphy
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a look at the specs, and while it answers my question about what happens when the age is set to -1 (cookie is deleted when browser exits), it doesn't answer my other question. That was: "is there any way to ensure that a cookie lives forever"?

Cheers,
Dan
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the max age is an int, and negative ints won't work, then the maximum time a cookie can live is about 2^31-1 seconds. Not quite forever, but by then HTTP is most likely long forgotten
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic