aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes strange cookie behaviour Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "strange cookie behaviour" Watch "strange cookie behaviour" New topic
Author

strange cookie behaviour

avi sinha
Ranch Hand

Joined: Mar 15, 2009
Posts: 452



i have set the age to be 60*60. but whenever i restart the browser it gives the status new-user.
i have checked the settings in the browser which says "keep cookies until they expire ".
i checked the cookie folder after restarting and found the cookie with the previous value but the previous value is replaced while accessing the page.
what is the reason???
is anything wrong in the code???

i am uploading the app too. if anybody can help... its a zipped file with the extension jpg. moderators, if this is not allowed here please notify me.

avi sinha



[ch62.zip.jpg]



SCJP 5.0 SCWCD 5.0
Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
Hi Avi. Here the default 'JSESSIONID' cookie will not available after restarting the browser.

Use
avi sinha
Ranch Hand

Joined: Mar 15, 2009
Posts: 452

Chinmaya Chowdary wrote:Hi Avi. Here the default 'JSESSIONID' cookie will not available after restarting the browser.


i didn't get your point.please make it a bit more clear.
Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
Hi Avi. If we say the container first checks is there any cookie with name JSESSIONID, if found it gets the session id from that cookie and checks is there any session object associated with this id. If yes, it reuses that session object, if no creates new session object like and the response will be sent to the client. Now client is having JSESSIONID cookie, here the JESSIONID cookie time set was '-1' means the cookie will expire if we close the browser. After if we restart it will not present, so we are not able to communicate with the container. Here container creates new session object, get id from it, creating cookie object, setting time period, adds to the response object. This is default behaviour. If we set cookie time we know it will not expire after exiting the browser. It will stay for 1 hour at the client side.
avi sinha
Ranch Hand

Joined: Mar 15, 2009
Posts: 452

thanks chinmaya
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: strange cookie behaviour