39. What is the differences between Http Servlet and generic Servlet

HttpServlet Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A subclass of HttpServlet must override at least one method, usually one of these:

  • doGet, if the servlet supports HTTP GET requests
  • doPost, for HTTP POST requests
  • doPut, for HTTP PUT requests
  • doDelete, for HTTP DELETE requests
  • init and destroy, to manage resources that are held for the life of the servlet
  • getServletInfo, which the servlet uses to provide information about itself

There’s almost no reason to override the service method. service handles standard HTTP requests by dispatching them to the handler methods for each HTTP request type (the doXXX methods listed above). Likewise, there’s almost no reason to override the doOptions and doTrace methods.

GenericServlet defines a generic, protocol-independent servlet. To write an HTTP servlet for use on the Web, extend HttpServlet instead.

GenericServlet implements the Servlet and ServletConfig interfaces. GenericServlet may be directly extended by a servlet, although it’s more common to extend a protocol-specific subclass such as HttpServlet.

GenericServlet makes writing servlets easier. It provides simple versions of the lifecycle methods init and destroy and of the methods in the ServletConfig interface. GenericServlet also implements the log method, declared in the ServletContext interface.

To write a generic servlet, you need only override the abstract service method.


17 Responses

  1. adfasdf

  2. This is good site

  3. good one

  4. itz okay

  5. […] interface. To write a generic servlet, you need only override the abstract service method. 5 comments September 7th, […]

  6. perfect

  7. Hi friends,
    Once try RoseIndia.net. This site is purely for java. Even freshers can also leran java easily. Try once this site. It’s very useful..

  8. Could you tell me my balance, please? bikini sling pics 438192

  9. How much were you paid in your last job? young asians pissing 745329

  10. Could you transfer $1000 from my current account to my deposit account? teen pov porn resrd

  11. I’d like to cancel this standing order young model

  12. nice answer but slightly bad

  13. Stolen credit card http://ehudutejupucu.blog.free.fr/ girls foto bbs anyone likes that fuck then let me know cos thats the type of fuck i do but better n bigger cock but the guy may be slightly better lookin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: