com.isomorphic.rpc
Class RPCRequest

java.lang.Object
  |
  +--com.isomorphic.rpc.RPCRequest

public class RPCRequest
extends java.lang.Object

RPCRequest encapsulates the data sent by the client-side RPCManager. Use the server-side RPCManager class to parse an RPC HttpRequest and retrieve RPCRequest objects.

See Also:
RPCManager, RPCResponse

Method Summary
 RPCResponse execute()
          If this request is a DMI request, executes the request through the DMI layer and returns an RPCResponse.
 java.lang.Object getData()
          Retrieves the data sent by the client.
 boolean isDMI()
           
 

Method Detail

getData

public java.lang.Object getData()
Retrieves the data sent by the client. You'll need to cast the data to the appropriate type. The type is determined by the type of JavaScript object that you provided as the "data" parameter to RPCManager.send(). Here's the mapping of JS types to their corresponding Java types:
JS Type Java Type
Object: {} Map
Array: [] List
String String
Number Long|Double
Boolean Boolean
Date java.util.Date


Note that the order of keys/values in the Maps created on the server is not guaranteed because JavaScript Object literals do not guarantee order.

isDMI

public boolean isDMI()
Returns:
true if this request is a DMI request, false if it is a custom RPC.

execute

public RPCResponse execute()
                    throws java.lang.Exception
If this request is a DMI request, executes the request through the DMI layer and returns an RPCResponse.

If you're writing your own RPC endpoint to replace the provided IDACall, you can use this method in conjuction with isDMI() to preserve builtin DMI handling by writing a dispacher like so:

 if (rpcRequest.isDMI()) {
     rpcManager.send(rpcRequest, rpcRequest.execute());
 } else { 
     // Custom RPC - do something with it...
 }
 
Returns:
the RPCResponse as generated by the builtin RPC or DMI layer or an error RPCResponse if the request is not a DMI request.