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

后端 未结 1 1137
温柔的废话
温柔的废话 2020-12-18 06:14

I\'d like to know when to expect a \"null\" when calling HttpServletRequest.getSession(false)

Also: Are there good tutorials on HttpSession? I\'d like to get details

相关标签:
1条回答
  • 2020-12-18 06:36

    You should practically never expect a null value. As the documentation says, if there is no active session for a request (usually, you would check for that in the filter chain of a request), a session will be created. If you get a null value from this, I'd wager that there is a problem in the underlying OS: Not enough memory to spawn a session would come to mind.

    0 讨论(0)
提交回复
热议问题