Class JSONScreen

  • All Implemented Interfaces:
    Assembler, Screen
    Direct Known Subclasses:
    JSONSecureScreen

    public class JSONScreen
    extends RawScreen
    A Screen class for dealing with JSON-RPC requests. Typically you would extend this class and override the doOutput() method to use TurbineJsonRpc to register the POJOs that will provide the functions you are making available via JSON-RPC. Use JSONSecureScreen if you need the user to be logged in prior to executing the functions you provide.

    Here is an example from a superclass: public void doOutput(PipelineData data) throws Exception { User user = data.getUser(); MyJsonFunctions myFunctions = new MyJsonFunctions(user.getName()); // Session specific TurbineJsonRpc.registerObject(data.getSession(), "myFunctions", myFunctions); // Global //TurbineJsonRpc.registerObjectGlobal("testGlobal", testObject); super.doOutput(data); }

    The class MyFunctions would be something like: public class MyJsonFunctions { private String getHello(String clientParameter) { return "Hello " + clientParameter; } }

    This code is derived from the com.metaparadigm.jsonrpc.JSONRPCServlet and (after upgrade) checked against org.jabsorb.JSONRPCServlet.

    Version:
    $Id$
    Author:
    brad@folkens.com, Scott Eade