javax.servlet.http
Class HttpServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
All Implemented Interfaces:
java.io.Serializable, Servlet, ServletConfig
Direct Known Subclasses:
AdminServlet, CGI, Debug, Default, Dump, Forward, Invoker, NotFoundServlet, RequestDispatchTest, SendRedirect, SessionDump

public abstract class HttpServlet
extends GenericServlet
implements java.io.Serializable

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:

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.

Servlets typically run on multithreaded servers, so be aware that a servlet must handle concurrent requests and be careful to synchronize access to shared resources. Shared resources include in-memory data such as instance or class variables and external objects such as files, database connections, and network connections. See the Java Tutorial on Multithreaded Programming for more information on handling multiple threads in a Java program.

Version:
$Version$
Author:
Various
See Also:
Serialized Form

Constructor Summary
HttpServlet()
          Does nothing, because this is an abstract class.
 
Method Summary
 void service(ServletRequest req, ServletResponse res)
          Dispatches client requests to the protected service method.
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpServlet

public HttpServlet()
Does nothing, because this is an abstract class.

Method Detail

service

public void service(ServletRequest req,
                    ServletResponse res)
             throws ServletException,
                    java.io.IOException
Dispatches client requests to the protected service method. There's no need to override this method.

Specified by:
service in interface Servlet
Specified by:
service in class GenericServlet
Parameters:
req - the HttpServletRequest object that contains the request the client made of the servlet
res - the ServletResponse object that will contain the servlet's response
Throws:
java.io.IOException - if an input or output error occurs while the servlet is handling the TRACE request
ServletException - if the request for the TRACE cannot be handled
See Also:
Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)


Copyright ? 2000 Mortbay Consulting Pty. Ltd. All Rights Reserved.