life span of HttpServletRequest and HttpServletResponse
posted 16 years ago
Hi, I was wondering about the life time of a HttpServletRequest object. I think it is longer than that of a HttpSession object, since a HttpSession is stored in a HttpServletRequest object. Then when is HttpServletRequest destroyed or expire? On the same token, how long is the life span of a HttpServletResponse object? When will it expire?
posted 15 years ago
The lifetime of an HttpServletRequest object is a single request (which may include forwarding to another page). The lifetime of an HttpSession object is dependent on the server settings (usually about 15min or less - for a single user session). I think what may be confusing you is the reference to the session object from within the request. The current user session is associated with the request, but is not part of the request. The actual session objects are managed by the session manager part of the servlet container. Hope this clears things up
------------------ Chris Stehno (Sun Certified Programmer for the Java 2 Platform)