public class IDACall
NOTE: This servlet is configured to automatically set character encoding on requests and
responses to UTF-8. If you wish to force a different encoding, you can do so by specifying
an init-param in your web.xml file, like so:
<servlet>
<servlet-name>IDACall</servlet-name>
<servlet-class>com.isomorphic.servlet.IDACall</servlet-class>
<init-param>
<param-name>encoding</param-name>
<param-value>some-other-encoding</param-value>
</init-param>
</servlet>
If you wish to switch off explicit encoding altogether, use the init-param to
set a value of "none".
Please see the client-side documentation on Internationalization for a discussion of why this procedure is necessary.
| Modifier and Type | Method and Description |
|---|---|
DSResponse |
handleDSRequest(DSRequest dsRequest,
RPCManager rpc,
RequestContext context)
This method is called by processRPCTransaction() to handle a DSRequest sent from the client.
|
RPCResponse |
handleRPCRequest(RPCRequest rpcRequest,
RPCManager rpc,
RequestContext context)
This method is called by processRPCTransaction() to handle a RPCRequest sent from the client.
|
void |
processRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Servlet entry point to process the request.
|
void |
processRPCTransaction(RPCManager rpc,
RequestContext context)
Process an RPC transaction.
|
public void processRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
IDACall.processRPCTransaction(RPCManager, RequestContext)
to handle each RPC encoded in this HTTP request.request - The HttpServletRequestresponse - The HttpServletResponsejavax.servlet.ServletException - As per HttpServlet.service()java.io.IOException - As per HttpServlet.service()public void processRPCTransaction(RPCManager rpc, RequestContext context) throws java.lang.Exception
IDACall.handleRPCRequest(RPCRequest, RPCManager, RequestContext)
or IDACall.handleDSRequest(DSRequest, RPCManager, RequestContext) depending on the
request type.request - The HttpServletRequestresponse - The HttpServletResponsejavax.servlet.ServletException - As per HttpServlet.service()java.io.IOException - As per HttpServlet.service()java.lang.Exceptionpublic DSResponse handleDSRequest(DSRequest dsRequest, RPCManager rpc, RequestContext context) throws java.lang.Exception
The default implementation of this method simply does this:
try {
return dsRequest.execute();
} catch (Exception e) {
DSResponse dsResponse = new DSResponse();
context.staticLog.warn("dsRequest.execute() failed: ", e);
dsResponse.setStatus(DSResponse.STATUS_FAILURE);
dsResponse.setData(e.getMessage());
return dsResponse;
}
dsRequest - The DSRequest to processRPCmanager - The RPCManager that was used to demultiplex the DSRequestRequestContext - RequestContext class provides accessors to Servlet basics like
HttpServletRequest, HttpServletResponsejava.lang.Exception - If an error occurs. If possible, you should wrap any error in a
DSResponse with an error status code and handle it on the client.public RPCResponse handleRPCRequest(RPCRequest rpcRequest, RPCManager rpc, RequestContext context) throws java.lang.Exception
The default implementation of this method simply does this:
try {
return rpcRequest.execute();
} catch (Exception e) {
context.staticLog.warn("rpcRequest.execute() failed: ", e);
RPCResponse rpcResponse = new RPCResponse();
rpcResponse.setStatus(RPCResponse.STATUS_FAILURE);
rpcResponse.setData(e.getMessage());
return rpcResponse;
}
dsRequest - The DSRequest to processRPCmanager - The RPCManager that was used to demultiplex the DSRequestRequestContext - RequestContext class provides accessors to Servlet basics like
HttpServletRequest, HttpServletResponsejava.lang.Exception - If an error occurs. If possible, you should wrap any error in a
RPCResponse with an error status code and handle it on the client.