This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Lifecycle of a HttpServletRequest instance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Lifecycle of a HttpServletRequest instance" Watch "Lifecycle of a HttpServletRequest instance" New topic
Author

Lifecycle of a HttpServletRequest instance

Jeffrey Spaulding
Ranch Hand

Joined: Jan 15, 2004
Posts: 149
Hi,

im writing a webapp that uses a chain of Servlets. Controlflow is managed via dispatching and everything works fine right now.

Out of curiosity - how long does this instance of HttpServletRequest live?

I didnt pursue the matter further, but during testing i had the Hash for the request object in the Log to trace the flow of parallel requests.

It seemed that Tomcat reuses this instance sometimes for Requests coming from the same Client.

As i said, it works, but im curious...

Any form of enlightenment is welcome :-)

J.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12758
    
    5
It is up to the servlet container to create and manage HttpServletRequest and response objects. If the container wants to use a pool of request objects instead of creating new ones for each request, that is OK. Presumably it provides for clearing the old data before reuse.
Bill
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

For the curious:
http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/Request.java?view=markup

Search for the "recycle" method.
[ February 02, 2005: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Lifecycle of a HttpServletRequest instance
 
Similar Threads
record lock&unlock
outputText i want to split a string whith <br/> or /n dosent work ?
doFilter() method parameters
Probelm in applet/servlet communication
Tomcat Virtual Hosting + many PCs