M
Miguel De Anda
We're starting to move our asp work into java servlets and my boss said
something that I find a bit hard to believe. If we have a servlet like this:
class MyServlet ... {
private HttpServletRequest requestObject;
protected void doGet(HttpServletRequest request, HttpServletResponse
response)
{
this.requestObject = request;
...
}
}
Does the requestObject stay in memory after the servlet is finished loading?
I guess my questio is, if we have a servlet, does every request to the
servlet use the same instance of it? Does it call the constructor only once
until the server is shut down or does it create a new instance of it on
every request?
something that I find a bit hard to believe. If we have a servlet like this:
class MyServlet ... {
private HttpServletRequest requestObject;
protected void doGet(HttpServletRequest request, HttpServletResponse
response)
{
this.requestObject = request;
...
}
}
Does the requestObject stay in memory after the servlet is finished loading?
I guess my questio is, if we have a servlet, does every request to the
servlet use the same instance of it? Does it call the constructor only once
until the server is shut down or does it create a new instance of it on
every request?