HttpServletRequest.getSession (false): When does it return null?

I would like to know when to expect "null" when calling HttpServletRequest.getSession (false)

Also: Are there any good tutorials on HttpSession? I would like information like: when is invalidate ()? what are the consequences? I need to check if the returned HttpSession is correct? ... <== Answer that in the comment please.

+5
source share
1 answer

You should hardly expect a null value. As stated in the documentation, if there is no active session for the request (usually you should check this in the query filter chain), a session will be created. If you get a null value from this, I would say that there is a problem in the base OS: not enough memory to create a session will come to mind.

+4
source

All Articles