Zaheer A Baloch wrote:When the webcontainer gets a requests it creates Request and Response objects. Then creates a thread for the servlet being requested and then passes the objects to service method of servlet. When the service method completes, the web container sends the response back. After that request and response objects are destroyed. Note that service method gets the objects as parameters and its job of container to create and destroy these objects.
Hope this helps
Chinmaya Chowdary wrote:Hi, Ravi. I think when a request comes, the container creates request and response object directly in the service method like service(new HttpServletRequestImpl(), new HttpServletResponseImpl()), not creating like HttpServletRequest request=new HttpServletRequestImpl() and HttpServletResponse response=new HttpServletResponseImpl() and pass to service(request, response).