HttpServlet class

public abstract class HttpServlet extends GenericServlet implements Serializable
The HttpServlet class extends GenericServlet, and proveds an HTTP-speecific implementation of the Servlet interface.
Method of HttpServlet Class
  1. public void service(ServletRequest request,ServletResponse response); This is an implementation of the service method in the GenericServlet. And this service() method calls the protected service() method after casting the arguments to HttpServletRequest and HttpServeletRespose respectively.
  2. protected void service(HttpServletRequest request, HttpServletResponse response); receives This method calls the one of the doXXX() methods, depending on the type of the HTTP request method.
  3. protected void doGet(HttpServletRequest request, HttpServletResponse response); This method is used to handle the GET request.
  4. protected void doPost(HttpServletRequest request, HttpServletResponse response); This method is used to handle the POST request.
  5. protected void doHead(HttpServletRequest request, HttpServletResponse response); This method is used to handle the HEAD request.
  6. protected void doOptions(HttpServletRequest request, HttpServletResponse response); This method is used to handle the OPTIONS request.
  7. protected void doPut(HttpServletRequest request, HttpServletResponse response); This method is used to handle the PUT request.
  8. protected void doTrace(HttpServletRequest request, HttpServletResponse response ); This method is used to handle the TRACE request.
  9. protected void doDelete(HttpServletRequest request, HttpServletResponse response); This method is used to handle the DELETE request.
  10. protected long getLastModified(HttpServletRequest request); This method returns the time when the servlet was last was last modified in milliseconds since March 27, 2013 00:00:00 GMT.
 



 

Latest Tutorial


Most Visited Tutorial