Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes How to Manage HttpSession with inactive time period? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to Manage HttpSession with inactive time period?" Watch "How to Manage HttpSession with inactive time period?" New topic
Author

How to Manage HttpSession with inactive time period?

Amanda Mosby
Greenhorn

Joined: Apr 05, 2012
Posts: 3
In the following post , i found about how to mantain session objects
http://www.coderanch.com/t/365859/Servlets/java/session-object-session-ID

specifically






how to use this in my own servlet, how to setHttpSession and getHttpSession
each time i have a new request on my servlet
and how will remove it if the session from the map when its no longer in use again
so is there auto timer for each session, so that it get deleted automatically from the hashmap,
when the given time period is reached and its no longer used by my servlet/server application
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Your terminology is off. You are not adding or removing "sessions". There is only one session available to your servlet, and you are adding and removing "scoped variables", also called "attributes", to it.

I'm not really understanding what your question is. You can add or remove scoped variables to the session any time you like. All scoped variables in the session will automatically be removed if the session times out.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to Manage HttpSession with inactive time period?
 
Similar Threads
Get session object from session ID
destroy sessionContext from EJB?
How to invalidate user's session forcefully
Immediately Invalidate another user's session after admin locks a user or changes a user's authoriti
How do you retrieve all the sessions?