File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes confusing cookies Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "confusing cookies" Watch "confusing cookies" New topic
Author

confusing cookies

sushant prabhu
Ranch Hand

Joined: Mar 22, 2001
Posts: 66
i hav been using cookies . if cookies r used for session tracking
they ideally r of no use once the session expires (i.e once the user closes his browser window) then what is the point in giving a max age of n number of days to the cookie so that it resides for that number of days on the client side.
as i assume when the user closes his browser andthen again requests for the page a new session will be started for which another cookie will be set .

i hav made a simple cookie example which i create it one servlet ,
give it a max age of 2 days and then add it to httpresponse object and retrieve it on the second servlet. now i open one ie browser window use that servlet and see the cookie value in the second servlet and close the browser. now ideally this cookie must reside in my machine for 2 days. i can see the cookie in the temp internet files
now after that i open another browser window again request for the same servlet now again i retrieve the content of the cookie
but it doesnot create another cookie txt file in theTemp internet files but just replaces the previous cookie.txt file with the new value i giv to the cookie. ideally what should happen in such a scenario.
the getCookies method associated


Sushant Prabhu<br />SCJP2<br />SCWCD<br />OCA9i
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: confusing cookies
 
Similar Threads
Use of Cookie
Browser close > session cookie vanishes ??
per-session cookies
Session Doubt?
How to set JSESSIONID's maxAge?