How long is the last default session?

How long is the session:

HttpSession session = request.getSession(); 

last when I do not declare explicitly session.setMaxInactiveInterval(int i) ? Suppose a user does not delete cookies from his browser.

+4
source share
2 answers

So far, the session-timeout value has been declared in web.xml . If there is no specified value, the container solves this parameter.

+7
source

HttpSession has a getMaxInactiveInterval method that can tell you how many sessions will remain available to the user.

If you setMaxInactiveInterval to a negative number, it will never expire until it deletes cookies.

EDIT:. For your comment to another answer, where I cannot add a comment, if the user does not accept cookies, he will never have a session. Therefore, if he removes it, he will begin a new session.

+2
source

All Articles