Win a copy of Learning Java by Building Android Games this week in the Android 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
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

doubt regarding sessions  RSS feed

 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone,

i have a small doubt regarding sessions that i would like to clarify with you guys. say that a user closes the browser while on a site. does the servlet give up the session as soon as the user closes his/her browser or does it close the session when the maxInActiveInterval() has reached?

thank you

Dinuka Arseculeratne.
 
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arseculeratne,
i guess the server has no way of knowing that the browser was closed.So it should be like invalidating the session only after the max interval time has elapsed.
 
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The application cannot find out when the user has closed his browser. So the session times out when the interval inactive interval times out.
 
Dinuka Arsakularatne
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you guys for clearing my doubt.

Dinuka Arseculeratne
 
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey i will give a nice example to clarify more -

Say you went at a shopping mall, filled your shopping cart with things,
suddenly you got a urgent call from home and left for home keeping the cart as it is there.The person at the shopping mall wont have a idea and will not even touch your cart. But after some time, may be at the end of the day he will disassemble your cart.

Similary, if you are into a SESSION on a website, and suddenly close the browser, your session is still maintained. The server/container will not touch it for some time - determined by the setMaxAgeInterval( ) [if its set]. After that interval expires OR after some CONTAINER speecific time expires, the container will INVALIDATE the session

Hope that helps you understand even better
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!