|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ikrs.json.rpc.JSONRPCHandler
public class JSONRPCHandler
This is the RPC handler which translates JSONRPC requests into method calls. The handler holds a variable set of anonymous objects; each must implement the RPCInvocationTarget interface.
Constructor Summary | |
---|---|
JSONRPCHandler()
Create a new empty JSON-RPC handler. |
Method Summary | |
---|---|
boolean |
addInvocationTarget(java.lang.String name,
RPCInvocationTarget target,
boolean useAsDefaultTarget)
Add a new invocation target. |
JSONRPCRequest |
buildRPCRequest(java.io.Reader reader)
This method builds a JSONRPCRequest from the JSON data provided by the given reader. |
JSONRPCResponse |
call(JSONRPCRequest request)
Calls the method as specified in the JSON-RPC request. |
JSONRPCResponse |
call(java.io.Reader reader)
Calls the method as specified in the JSON-RPC request from the reader. |
JSONRPCResponse |
call(java.lang.String jsonString)
Calls the method as specified in the JSON-RPC request string. |
static void |
main(java.lang.String[] argv)
For testign purposes only. |
boolean |
removeInvocationTarget(java.lang.String name)
Removes the invocation target with the given name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JSONRPCHandler()
Method Detail |
---|
public boolean addInvocationTarget(java.lang.String name, RPCInvocationTarget target, boolean useAsDefaultTarget) throws java.lang.NullPointerException
name
- The name to use.target
- The target to add.useAsDefaultTarget
- If true passed the target will be used as the default target.
java.lang.NullPointerException
- If name or target is null.public boolean removeInvocationTarget(java.lang.String name)
name
- The target's name.
public JSONRPCResponse call(java.lang.String jsonString) throws java.lang.NullPointerException
jsonString
- The JSON-RPC string to execute.
java.lang.NullPointerException
- If the json string is null.public JSONRPCResponse call(java.io.Reader reader) throws java.lang.NullPointerException
reader
- A reader to read the JSON-RPC request from.
java.lang.NullPointerException
- If the reader is null.public JSONRPCResponse call(JSONRPCRequest request) throws java.lang.NullPointerException
request
- The request to execute.
java.lang.NullPointerException
- If the request is null.public JSONRPCRequest buildRPCRequest(java.io.Reader reader) throws java.lang.NullPointerException, JSONSyntaxException, JSONRPCException, JSONException, java.io.IOException
reader
- The reader to read from (must not be null).
java.lang.NullPointerException
- If reader is null.
JSONSyntaxException
- If the provided data does not represent a valid JSON value.
JSONRPCException
- If the provided JSON value does not represent a valid JSON-RPC request.
JSONException
- If any type errors occur.
java.io.IOException
- If any IO errors occur while reading from the reader.public static void main(java.lang.String[] argv)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |