public abstract class HttpServlet extends GenericServlet implements java.io.Serializable
Constructor and Description |
---|
HttpServlet()
Does nothing
|
Modifier and Type | Method and Description |
---|---|
protected void |
doDelete(HttpServletRequest request,
HttpServletResponse response)
This method is called on a "DELETE" request.
|
protected void |
doGet(HttpServletRequest request,
HttpServletResponse response)
This method is called on a "GET" request.
|
protected void |
doHead(HttpServletRequest request,
HttpServletResponse response)
This method is called on a "HEAD" request.
|
protected void |
doOptions(HttpServletRequest request,
HttpServletResponse response)
This method is called on a "OPTIONS" request.
|
protected void |
doPost(HttpServletRequest request,
HttpServletResponse response)
This method is called on a "POST" request.
|
protected void |
doPut(HttpServletRequest request,
HttpServletResponse response)
This method is called on a "PUT" request.
|
protected void |
doTrace(HttpServletRequest request,
HttpServletResponse response)
This method is called on a "TRACE" request.
|
protected long |
getLastModified(HttpServletRequest request)
Returns the time the requested uri was last modified in seconds since
1 january 1970.
|
protected void |
service(HttpServletRequest request,
HttpServletResponse response)
This method looks whether the request is a POST, GET, etc method,
and then calls the appropriate doPost, doGet, whatever method.
If the request method is something it can't handle it sends a HttpServletResponse.SC_BAD_REQUEST error through the response. |
void |
service(ServletRequest request,
ServletResponse response)
Frontend for calling service(HttpServletRequest,HttpServletResponse).
|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException
ServletException
- if an Servlet Exception occursjava.io.IOException
- if an IOException occursprotected long getLastModified(HttpServletRequest request)
protected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException
if(request.getMethod().equals("HEAD")) { ... }
ServletException
- if an Servlet Exception occursjava.io.IOException
- if an IOException occursprotected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException
ServletException
- if an Servlet Exception occursjava.io.IOException
- if an IOException occursprotected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException
ServletException
- if an Servlet Exception occursjava.io.IOException
- if an IOException occursprotected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException
ServletException
- if an Servlet Exception occursjava.io.IOException
- if an IOException occursprotected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException
ServletException
- if an Servlet Exception occursjava.io.IOException
- if an IOException occursprotected void doTrace(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException
ServletException
- if an Servlet Exception occursjava.io.IOException
- if an IOException occursprotected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException
ServletException
- an error has occuredjava.io.IOException
- an error has occuredpublic void service(ServletRequest request, ServletResponse response) throws ServletException, java.io.IOException
This method tries to typecast the ServletRequest and the
ServletResponse to HttpServletRequest and HttpServletResponse
and then call service(HttpServletRequest,HttpServletResponse).
service
in interface Servlet
service
in class GenericServlet
request
- The client's requestresponse
- The class to write the response date to.ServletException
- an error has occuredjava.io.IOException
- an error has occuredSingleThreadModel