aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "The persistence of cookies" Watch "The persistence of cookies" New topic
Author

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,
Art
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

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).]


SCJP
Visit my download page
Art Metzer
Ranch Hand

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