• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

how does the server expire the session

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can any one tell me When a client request an jsp site from the server
The server will generate a seperate session Id for each client.
this is general
My question is How does the server detect that the client has closed the
explorer to expire the session ?
sangeetha
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the server doesn't.
It maintains a list of active sessions with a timestamp when the last access was.
Whenever a request is made the entry for that session is updated with a fresh timestamp (or a new entry made if it's a new session).
At regular intervals this list is polled to see which sessions haven't been accessed in the set timeout period, and those sessions are killed.
How this is implemented will of course differ between server implementations.
 
Author
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..
The session also resides in the user system as a Cookie & on the server & they are name-value pairs..as soon as the user closes the explorer..the cookie is lost & the container removes the session.
This all stuff is handled by the container..
hth
MB
 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Session can be invalidated by two methods. First is the server finds the last accessed time of the session(time stamp) and the current time , and finds the difference, and matches with the session time out parameter configured in webserver configuration file, or the explicitly set value for that particular session.
Second one is user can invalidate their session by invoking invalidate() method on the session object by the user.
regards,
Ganapathy,S
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Malhar Barai:
Hi..
The session also resides in the user system as a Cookie & on the server & they are name-value pairs..as soon as the user closes the explorer..the cookie is lost & the container removes the session.
This all stuff is handled by the container..
hth
MB


You're quite wrong there...
You will have to tell the server explicitly that you're closing the browser or it will never know until the session timeout occurs.
There is no "magic" by which the browser tells the server it is closing unless you specifically code an onunload event into your HTML that does a final request telling the server what's going on.
 
Vasantha Prabha
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
If the session is stored in cookie.Does the user browser save that cookie
in the client side ???

Regards,
Sangeetha
 
Malhar Barai
Author
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeroen Wenting:

You're quite wrong there...
You will have to tell the server explicitly that you're closing the browser or it will never know until the session timeout occurs.
There is no "magic" by which the browser tells the server it is closing unless you specifically code an onunload event into your HTML that does a final request telling the server what's going on.


Hi Jeroen...
Maybe I would agree to you on this...
But I had read it somewhere, & I am trying to get the source of it...else how would the container know when the browser has closed, if you hv noted that the session is lost on closing the browser..
Will get back to you as soon as I get the source...
& Sangeetha, the session is indeed refrenced by a cookie that resides on the client-side..
MB
 
Malhar Barai
Author
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi...
Check out this Thread
hth
MB
 
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When the browser is closed there is no way the server will come to know about it. It is only when the session times out the session dies.
 
Malhar Barai
Author
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


It may also be worth noting that session cookies are typically resident in memory only and disappear when the browser is closed, but they don't have to be


from this thread
still I m looking fr something to suffice my statement, & I dont say that I'm cent percent right..
Hope you all agree that the session is lost when browser is closed...how does this happen then...??
MB
[ November 28, 2003: Message edited by: Malhar Barai ]
 
Pradeep bhatt
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hope you all agree that the session is lost when browser is closed...how does this happen then...??


The cookie is lost when the browser is closed.
 
Malhar Barai
Author
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oops...
I got it wrong...indeed the cookie is lost...thats what I stated in my first post..


as soon as the user closes the explorer(browser)..the cookie is lost


I lose my 0.02 cents...
MB
 
Pradeep bhatt
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

& the container removes the session


This is what you got it wrong in the first post.
 
Malhar Barai
Author
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yup..agreed..
The container doesnt remove the session...but it gets expired after some time that is specified, & they are maintained in Hashtable...
So..am I right now..
MB
 
A teeny tiny vulgar attempt to get you to buy our stuff
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic