HTTP Request Handlers

The HttpServlet class extends the GenericServlet class and therefore inherits all of the standard servlet capabilities. In addition to the basic servlet life cycle methods and convenience method, the more complex HttpServlet class adds methods to aid in the processing of HTTP requests. These commonly used handler methods are

  • doGet: Handles HTTP GET requests

  • doPost: Handles HTTP POST requests

In the case of doGet, there is an additional method used for conditional HTTP GET support (the different HTTP request types are explained later in this section). The getLastModified method is like HTTP GET, but only returns content if it has changed since a specified time. This method can only be used if doGet has also been overridden ...

Get Developing Enterprise Java Applications with J2EE™ and UML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.