Class selvlet
Package
Class
Tree
Deprecated
Index
Help
| | |
| PREV CLASS NEXT CLASS |FRAMES NO FRAMES | |
|SUMMARY: INNER | FIELD | CONSTR | METHOD |DETAIL: FIELD | CONSTR | METHOD | |
[pic]
javax.servlet.http
Class HttpServletjava.lang.Object
|
+--javax.servlet.GenericServlet
|
+--javax.servlet.http.HttpServlet
[pic]
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:
• doGet, if theservlet 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 handlesstandard 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 includein-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.
See Also:
Serialized Form
[pic]
|Constructor Summary|
|HttpServlet() | |
| Does nothing, because this is an abstract class. | |
|Method Summary|
|protected void |doDelete(HttpServletRequest req, HttpServletResponse resp) |
| | Called by the server (via the service method) to allow a servlet to handle a DELETE request. |
|protected void |doGet(HttpServletRequest req, HttpServletResponse resp)|
| | Called by the server (via the service method) to allow a servlet to handle a GET request. |
|protected void |doOptions(HttpServletRequest req, HttpServletResponse resp) |
| | Called by the server (via the service method) to allow a servlet to handle a OPTIONSrequest. |
|protected void |doPost(HttpServletRequest req, HttpServletResponse resp) |
| | Called by the server (via the service method) to allow a servlet to handle a POST request. |
|protected void |doPut(HttpServletRequest req, HttpServletResponse resp)|
| | Called by the server (via the service method) to allow a servlet to handle a PUT request. |
|protected void |doTrace(HttpServletRequest req, HttpServletResponse resp) |
| | Called by the server (via the service method) to allow a servlet to handle a TRACE request....
Regístrate para leer el documento completo.