wood burning stoves
The moose likes Servlets and the fly likes The persistence of cookies Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "The persistence of cookies" Watch "The persistence of cookies" New topic

The persistence of cookies

Art Metzer
Ranch Hand

Joined: Oct 31, 2000
Posts: 241
Hi, friends.
This may be a silly question, but I'll go ahead and ask it anyway.
I'm a servlet expert-in-training , currently studying cookies. The cookies that get created in the textbook examples that I'm running get stored in the HttpServletResponse as HTTP headers, where they presumably cease to exist once the session ends. But in my practical experience, "real" Web sites' cookies are truly persistent: Web servers store them in my C:\Windows\Cookies folder as those all-too familiar 1-KB text files. My toy examples don't do this, and my question is, what would I need to do to create my own truly persistent cookies?
Thanks for helping me along,
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347

This will make the cookie last for a year:

oops I just noticed there are 365 days in a year not 356
[This message has been edited by Randall Twede (edited February 22, 2001).]

Visit my download page
Art Metzer
Ranch Hand

Joined: Oct 31, 2000
Posts: 241
Thanks, Randall! setMaxAge() works beautifully, as advertised!
I agree. Here's the link: http://aspose.com/file-tools
subject: The persistence of cookies
It's not a secret anymore!