• Post Reply Bookmark Topic Watch Topic
  • New Topic

want to end the session after specific time

 
amy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to close the session automatically after a certain period of time how can i use it .can any body help me which function to use.
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
amy,
Javaranch has a naming policy which is strictly enforced. Please change your display name to conform with this policy if you wish to keep posting here. Thanks.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sessions have a timeout value. The timeout clock starts ticking immediately after the last request that comes in. So if the timeout is 10 minutes, and you make a request at 10 minutes and 1 second, then your session will be timed out.

Look at your servlet container's documentation, each one is a bit different, when it comes to setting the session timeout.
 
Craig Schwabl
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try session.invalidate() to immediately remove the session, or session.setMaxInactiveInterval(int interval) to specify the timeout period.
 
Vikas Aggarwal
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The default servlet/JSP sessions are defined in the webserver/container itself. If you want to override that value use MaxInterval().
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!