Tuesday, April 17, 2007

What is the difference between GenericServlet and HTTPServlet?

GenericServlet is an abstract class that defines a generic, protocol-independent servlet.Any protocol dependent servlet has to extend this class in order to provide a specific implementaion and override service method.e.g . HTTPServlet class extends GenericServlet class.
 
GenericServlet has a service(ServletRequest req, ServletResponse res) method which is called by the servlet container to allow the servlet to respond to a request.
 
HttpServlet extends GenericServlet and adds support for doGet(), doPost(), doHead() methods (HTTP 1.0) plus doPut(), doOptions(), doDelete(), doTrace() methods (HTTP 1.1). Both these classes are abstract.
 

3 comments:

Vivek said...

Good One this blog has lot of information

solanki on June 8, 2011 12:39 AM said...

gud one answer, i get different and well define from others blogs.

solanki on June 8, 2011 12:39 AM said...

i got well described answer from others blogs.

 

Disclaimer
Interview Questions On Java,Java EE Copyright © 2012