ix.util.http
Class HttpStringServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
ix.util.http.HttpObjectServlet
ix.util.http.HttpStringServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
public abstract class HttpStringServlet
- extends HttpObjectServlet
Handles HTTP requests that can be regarded as sending a string
and receiving one in reply.
An HttpStringServelt is like an HttpStringClient but on the
server side. Where a client sends a string, and receives a string reply,
the servlet receives a string, and sends one back.
At present, only POST requests are supported.
- See Also:
HttpServer,
Serialized Form
|
Method Summary |
protected java.lang.String |
decodeReceived(java.lang.String contents)
Turns request contents into an object. |
protected byte[] |
encodeForSend(java.lang.Object obj)
Turns an object into response contents. |
protected abstract java.lang.String |
handleRequest(javax.servlet.http.HttpServletRequest req,
java.lang.Object content)
The main part of handling the request. |
static void |
main(java.lang.String[] argv)
Main program for testing. |
| Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doGet, 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 |
HttpStringServlet
public HttpStringServlet()
handleRequest
protected abstract java.lang.String handleRequest(javax.servlet.http.HttpServletRequest req,
java.lang.Object content)
- Description copied from class:
HttpObjectServlet
- The main part of handling the request. The contents have
already been read and turned into an object by calling
HttpObjectServlet.decodeReceived(String). The HttpServletRequest
is passed primarily to allow this method to look at the
request headers.
- Specified by:
handleRequest in class HttpObjectServlet
- Returns:
- the object to encode and send as a response.
encodeForSend
protected byte[] encodeForSend(java.lang.Object obj)
throws java.io.UnsupportedEncodingException
- Description copied from class:
HttpObjectServlet
- Turns an object into response contents.
- Overrides:
encodeForSend in class HttpObjectServlet
- Throws:
java.io.UnsupportedEncodingException- See Also:
HttpObjectServlet.decodeReceived(String contents)
decodeReceived
protected java.lang.String decodeReceived(java.lang.String contents)
- Description copied from class:
HttpObjectServlet
- Turns request contents into an object. For example, the
content might be an XML representation of an object.
- Overrides:
decodeReceived in class HttpObjectServlet
- See Also:
HttpObjectServlet.encodeForSend(Object contents)
main
public static void main(java.lang.String[] argv)
- Main program for testing.