|
|||||||||
Home >> All >> openfuture >> util >> [ servlet overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
openfuture.util.servlet
Class HttpActionServlet

java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
openfuture.util.servlet.HttpActionServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- public class HttpActionServlet
- extends javax.servlet.http.HttpServlet
HTTP Servlet with unified GET and POST access. Request parameters for the GET are coded into the query string:
<action-name>(&<identifier>=<value>)*
The parameters for POST are accessible via
ServletRequest.getParameter(java.lang.String)>ServletRequest.getParameter(java.lang.String)
55 .
Subclasses should override handleAction(java.util.Hashtable, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
55 .
Created: Sun Nov 12 10:35:37 2000 (Originally created in Web Glossary).
- Version:
- $Revision: 1.2 $
Field Summary | |
static java.lang.String |
EQUAL_SIGN
The equal sign separating key and value. |
static java.lang.String |
SEPARATOR
The separator symbol separating key-value pairs. |
Fields inherited from class javax.servlet.http.HttpServlet |
|
Fields inherited from class javax.servlet.GenericServlet |
|
Constructor Summary | |
HttpActionServlet()
|
Method Summary | |
protected void |
addParameter(java.util.Hashtable parameters,
java.lang.String key,
java.lang.String value)
Add a new parameter to the hashtable. |
void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Extracts the action command and the parameters from the query string of GET requests and redirects it to handleAction(java.util.Hashtable, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 55 . |
void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Called by the server (via the service method)
to allow a servlet to handle a POST request. |
protected void |
handleAction(java.util.Hashtable parameters,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Dispatcher for the action commands. |
void |
logException(java.lang.Exception e)
Write an exception to the log file of the servlet container. |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
SEPARATOR
public static final java.lang.String SEPARATOR
- The separator symbol separating key-value pairs.
- See Also:
- Constant Field Values
EQUAL_SIGN
public static final java.lang.String EQUAL_SIGN
- The equal sign separating key and value.
- See Also:
- Constant Field Values
Constructor Detail |
HttpActionServlet
public HttpActionServlet()
Method Detail |
doGet
public void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, java.io.IOException
- Extracts the action command and the parameters from the
query string of GET requests and redirects it to
handleAction(java.util.Hashtable, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
55 .
doPost
public void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, java.io.IOException
- Description copied from class:
javax.servlet.http.HttpServlet
- Called by the server (via the
service
method) to allow a servlet to handle a POST request. The HTTP POST method allows the client to send data of unlimited length to the Web server a single time and is useful when posting information such as credit card numbers.When overriding this method, read the request data, write the response headers, get the response's writer or output stream object, and finally, write the response data. It's best to include content type and encoding. When using a
PrintWriter
object to return the response, set the content type before accessing thePrintWriter
object.The servlet container must write the headers before committing the response, because in HTTP the headers must be sent before the response body.
Where possible, set the Content-Length header (with the ServletResponse.setContentLength(int)>
ServletResponse.setContentLength(int)
55 method), to allow the servlet container to use a persistent connection to return its response to the client, improving performance. The content length is automatically set if the entire response fits inside the response buffer.When using HTTP 1.1 chunked encoding (which means that the response has a Transfer-Encoding header), do not set the Content-Length header.
This method does not need to be either safe or idempotent. Operations requested through POST can have side effects for which the user can be held accountable, for example, updating stored data or buying items online.
If the HTTP POST request is incorrectly formatted,
doPost
returns an HTTP "Bad Request" message.
handleAction
protected void handleAction(java.util.Hashtable parameters, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws java.io.IOException
- Dispatcher for the action commands. Shows the received action
and parameters.
Subclasses should override this method.
logException
public void logException(java.lang.Exception e)
- Write an exception to the log file of the servlet
container.
addParameter
protected void addParameter(java.util.Hashtable parameters, java.lang.String key, java.lang.String value)
- Add a new parameter to the hashtable. Each value
in the hashtable is an
String
array.
|
|||||||||
Home >> All >> openfuture >> util >> [ servlet overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |