aspose file tools*
The moose likes Servlets and the fly likes life span of HttpServletRequest and HttpServletResponse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "life span of HttpServletRequest and HttpServletResponse" Watch "life span of HttpServletRequest and HttpServletResponse" New topic
Author

life span of HttpServletRequest and HttpServletResponse

Cameron Park
Ranch Hand

Joined: Apr 06, 2001
Posts: 371
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?
Chris Stehno
Ranch Hand

Joined: Feb 26, 2001
Posts: 180
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)


- Chris Stehno, SCPJ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: life span of HttpServletRequest and HttpServletResponse