Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

strange cookie behaviour

 
Ranch Hand
Posts: 453
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
[Thumbnail for ch62.zip.jpg]
web-app
 
Ranch Hand
Posts: 437
Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Avi. Here the default 'JSESSIONID' cookie will not available after restarting the browser.

Use
 
avi sinha
Ranch Hand
Posts: 453
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 437
Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 453
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks chinmaya
 
It sure was nice of your sister to lend us her car. Let's show our appreciation by sharing this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic