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

Browser close > session cookie vanishes ??

 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Report post to moderator
HFSJ P-248,

Session cookie vanish when the client's browser quits....

There are 2 things :
1) session objects at server side
2) cookie at client side

If anyone of these vanishes, we can't use the same session again. Right?

I think the statement in bold is incorrect as i have specified the session-timeout as 10 min. I first access the servlet and it prints New Session. Then i closed my broswers window and open it again. then i access the same servlet, it prints old session...
Moreover i can see the cookie object in browsers options....

Also we say that session can expire in these cases
1) Timeout
2) invalidate()

These 2 options also doesn't corresponds to the statement in bold...

I am also aware of the cookie that we can attach to the response and this cookie has nothing to do with session( It's not a session cookie). This cookies timeout is specified by setMaxAge().
 
Gunnar Maluf
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Report post to moderator
Originally posted by Sandeep Vaid:
HFSJ P-248,

Session cookie vanish when the client's browser quits....

There are 2 things :
1) session objects at server side
2) cookie at client side

If anyone of these vanishes, we can't use the same session again. Right?

I think the statement in bold is incorrect as i have specified the session-timeout as 10 min. I first access the servlet and it prints New Session. Then i closed my broswers window and open it again. then i access the same servlet, it prints old session...
Moreover i can see the cookie object in browsers options....

Also we say that session can expire in these cases
1) Timeout
2) invalidate()

These 2 options also doesn't corresponds to the statement in bold...

I am also aware of the cookie that we can attach to the response and this cookie has nothing to do with session( It's not a session cookie). This cookies timeout is specified by setMaxAge().



In your case, the cookie will vanish afer 10 minutes if you specified this. It doesnt matter if the client closes the browser. If you doenst set it a timeout and the client closes the browser then the cookie will vanish.

Correct me if im wrong...

regards
Gunnar
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Sandeep, please do not create duplicate threads.

This conversation can be continued on the other instance of this thread:
http://www.coderanch.com/t/176771/java-Web-Component-SCWCD/certification/Browser-close-session-cookie-vanishes
 
    Bookmark Topic Watch Topic
  • New Topic