Tuesday, October 18, 2005

What is the default life time of Session (or) JSESSIONID Cookies?

1800 seconds (or) 30 minutes

From Spec:

The default timeout period for sessions is defined by the servlet container and can be obtained via the getMaxInactiveInterval method of the HttpSession interface.

Example Code:

HttpSession session = request.getSession();

System.out.println("default timeout period for sessions : " + session.getMaxInactiveInterval());

Note:
Be careful not to assume that sessions expire as soon as they reach their expirey time, sometimes they only get closed by a very low level thread some time after they have timed out.


0 Comments:

Post a Comment

<< Home