• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Lifecycle of a HttpServletRequest instance

 
Jeffrey Spaulding
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic