How do I keep track of the session for each servlet request, until I use it? Singletons wont work?
Posted
by corgrath
on Stack Overflow
See other posts from Stack Overflow
or by corgrath
Published on 2010-05-19T21:55:56Z
Indexed on
2010/05/19
22:00 UTC
Read the original article
Hit count: 262
For each servlet request I get, I pass, perhaps, 10 methods before I am at where I need to check something in the session and I need the HttpSession.
The only way I can get the HttpSession is from the HttpServletRequest, correct?
How do I keep track of the session for each servlet request? Unfortuantly I cannot simple make a singleton (ex, SessionInformation.instance().getAttribute("name")) because that session would then be used over all requests.
Is there a way to store the session globally for each request without having to pass it (or it's information) down all the methods just in case I need it?
© Stack Overflow or respective owner