Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ending of session

 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In hanumant deshmukh book [p-120], it's written that

Session ends when either the client explicitly ends the session or the server does not revieve any requests from the client within a predefined time limit.

Is the statement in bold correct? How can a client end the session?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can programmatically kill the session. If the client submits a request that results in such code being run on the server, the session is killed.
 
victor kamat
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For example if you are logged into a Bank website and log-off.
 
Muralidhar Adhikarla
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The client can do that by calling session.invalidate() method.
 
Atul Sawant
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correct. Like the user/client hits Log off triggering invalidate() in the servlet causing session to die.
 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes. but this doesn't mean that client is invalidating the session. It's always the code @ the SERVER which is invalidating the session. ( It may be due to client clicked checkout button).
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From a programmer point of view, yes. But thinking like that would mean that the user actually does nothing, and the server does everything
"the client explicitly ends the session" = "the client logs off and the servlet invalidates the session"
 
Tanveer Ahmad
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
There is nothing that gets executed in the client side. Every thing that you code is for server to execute. According to the book, CLIENT EXPLICITLY KILLING SESSION means, you writing a code where you have a button on the screen named "Kill Bill" which kills the session on click. so when you click the Kill Bill button then on the server the portion of code which calls session.invalidate() will execute (by the server). The "or" part of the book's statement means if you set the session time out to be say 300 sec and go to watch 300 (the movie), on return the session would have been killed by the server. Here also it is you who sets the timeout, but it is the server which dertermines the time and calls invalidate internally, you dont have to say session.invalidate() here.

Tanveer
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic