Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Expiration Doubt

 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q-2 . P-248,
Session cookie vanish when the client's browser quits, but you CAN tell a cookie to persists on the client even after the
browser shuts down.. (by specifying time-out as -1 in web.xml)

So this means if i have not specified the time-out as -1 in web.xml, the session will be invalid when the client closes his
browser ?
 
Louis Moloney
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think your alittle confused between session cookies and persistent cookies.

when you add a cookie to a response this will persist between opening and closing of the browser.

when you close a browser its session cookies (not cookies) will disappear from the browser. But the session will be alive on the web server as to such time as it times out.
 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is persistent cookie ?


HFSJ P-248 states that :
Session cookie vanish when the client's browser quits




Now when i am executing this for the first time, it's showing me : New Session

NOW I CLOSE MY BROWSER AND OPEN IT AGAIN :

Now when i access the servlet again, it shows me : Old Session

This means that session cookie DOESN'T Vanish even after i close my browser.


I am using mozilla, and i can see option :
Accept cookies from site:
Keep until : a) they expire
b) I close firefox
c) ask me everytime

Currently i have selected option a)

Does the concept has to do something with these options ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic