to.etc.domui.ajax
Class RpcCallHandler

java.lang.Object
  extended by to.etc.domui.ajax.RpcCallHandler

public class RpcCallHandler
extends java.lang.Object

A generic class that allows for Java services (methods on a service class) to be called using several calling sequences and entries.

Author:
Frits Jalvingh Created on Nov 16, 2006

Constructor Summary
RpcCallHandler()
           
 
Method Summary
 void executeBulkJSON(IRpcCallContext cb, java.lang.String json)
          Reads and executes a JSON bulk request.
 void executeSingleCall(IRpcCallContext cb, IParameterProvider pv, java.lang.String callsign, ResponseFormat formatoverride)
          This executes a single call.
static
<T extends java.lang.annotation.Annotation>
T
findAnnotation(java.lang.annotation.Annotation[] annar, java.lang.Class<T> clz)
           
 ResponseFormat getDefaultFormat()
           
 JSONRegistry getJSONRegistry()
           
 XmlRegistry getXmlRegistry()
           
 void setDefaultResponseFormat(ResponseFormat rf)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RpcCallHandler

public RpcCallHandler()
Method Detail

executeSingleCall

public void executeSingleCall(IRpcCallContext cb,
                              IParameterProvider pv,
                              java.lang.String callsign,
                              ResponseFormat formatoverride)
                       throws java.lang.Exception
This executes a single call. Both "return value" and "parameter 1 is output" calls are supported.

Throws:
java.lang.Exception

findAnnotation

public static <T extends java.lang.annotation.Annotation> T findAnnotation(java.lang.annotation.Annotation[] annar,
                                                                           java.lang.Class<T> clz)

executeBulkJSON

public void executeBulkJSON(IRpcCallContext cb,
                            java.lang.String json)
                     throws java.lang.Exception
Reads and executes a JSON bulk request. The JSON structure is an array of objects. Each object has the following keys:
method: string
The full class and method name of the thing to call. The classname and method name are separated by a dot.
parameters: object
The call's parameters, as an object where each key will get evaluated as a parameter.
id: string or number
When present the response will echo this ID
cancelonerror: boolean
When present and true, the bulk handler will cancel the rest of the calls if one call fails.

Parameters:
json -
Throws:
java.lang.Exception

getXmlRegistry

public XmlRegistry getXmlRegistry()

getDefaultFormat

public ResponseFormat getDefaultFormat()

setDefaultResponseFormat

public void setDefaultResponseFormat(ResponseFormat rf)

getJSONRegistry

public JSONRegistry getJSONRegistry()