Class javax.servlet.http.HttpServlet

javax.servlet.GenericServlet | 
+----javax.servlet.http.HttpServlet

public abstract class HttpServlet
extends GenericServlet
An abstract class that simplifies writing HTTP servlets. It extends the GenericServlet base class and provides an framework for handling the HTTP protocol. Because it is an abstract class, servlet writers must subclass it and override at least one method. The methods normally overridden are:
  • doGet, if HTTP GET requests are supported. Overriding the doGet method automatically also provides support for the HEAD and conditional GET operations. Where practical, the getLastModified method should also be overridden, to facilitate caching the HTTP response data. This improves performance by enabling smarter conditional GET support.
  • doPost, if HTTP POST requests are supported.
  • doPut, if HTTP PUT requests are supported.
  • doDelete, if HTTP DELETE requests are supported.
  • The lifecycle methods init and destroy, if the servlet writer needs to manage resources that are held for the lifetime of the servlet. Servlets that do not manage resources do not need to specialize these methods.
  • getServletInfo, to provide descriptive information through a service's administrative interfaces.
Notice that the service method is not typically overridden. The service method, as provided, supports standard HTTP requests by dispatching them to appropriate methods, such as the methods listed above that have the prefix "do". In addition, the service method also supports the HTTP 1.1 protocol's TRACE and OPTIONS methods by dispatching to the doTrace and doOptions methods. The doTrace and doOptions methods are not typically overridden.

Counters