| Author |
How container Handle request
|
Gaurav Gambhir
Ranch Hand
Joined: Mar 04, 2006
Posts: 252
|
|
Hi All All servlets extend HttpServlet and it has a method service() My question is when a request come for a servlet which sequence is right The container calls the service(ServletRequest,ServletResponse) method of HttpServlet and then the service(ServletRequest,ServletResponse) method of HttpServlet calls service(HttpServletRequest,HttpServletResponse) method of the same class,as the service() method is overloaded in HttpServlet class. or Container directly call the service(HttpServletRequest,HttpServletResponse) method and why,Please explain. Thanks & Regards Gaurav
|
 |
Mahendar Reddy
Ranch Hand
Joined: Sep 27, 2005
Posts: 73
|
|
As I know above statement is correct. Why b'coz for non http request logic is provided in service(ServletRequest,ServletResponse) method. Keep in mind that u have to override this method. In this method the container checks if it is http or non-http.If it is http it is forwarded to service HttpServletRequest,HttpServletResponse) method. [ March 05, 2006: Message edited by: Mahendar Reddy ]
|
SCJP- 98%<br />SCWCD-92%
|
 |
Gaurav Gambhir
Ranch Hand
Joined: Mar 04, 2006
Posts: 252
|
|
Thanx for reply But Deshmukh's Book says If you override the service method in your servlet class, you will loose the functionality provided by the HttpServlet class and the doXXX() methods will not be called automatically.In your implementation, you will have to determine the HTTP method used in request and then you will have to call the appropriate doXXX() method yourself.
|
 |
 |
|
|
subject: How container Handle request
|
|
|