aspose file tools*
The moose likes Servlets and the fly likes cookie.getMaxage() question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "cookie.getMaxage() question" Watch "cookie.getMaxage() question" New topic
Author

cookie.getMaxage() question

Max Tomlinson
Ranch Hand

Joined: Jul 17, 2001
Posts: 365
Hi all-
How can I tell if a cookie is permanent vs. temporary?
I understand that a maxage of -1 means browser session only.
Is there a setting for permanent or is 'permanent' just a long-term persistent cookie?
thank you,
Max Tomlinson
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1506
I am not aware of any method that lets you set the maxage of a cookie permanently. You can just set it to as long as you want. For one year, you can do yourCookie.setMaxAge(31526000) or yourCookie.setMaxAge(60*60*24*365). I am sure you get the idea....


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Max Tomlinson
Ranch Hand

Joined: Jul 17, 2001
Posts: 365
Hey Bosun-
Thanks for the response. So it looks like I test for maxage of -1 (temp. cookie) otherwise I have to see if it has expired.
Max
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cookie.getMaxage() question
 
Similar Threads
Cookies issue
Permanent cookie
writing a cookie to the disk
WA #1.....word association
How to track real unique user?