public class JSONScreen extends RawScreen
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.
Modifier and Type | Field and Description |
---|---|
protected static int |
BUFFER_SIZE |
protected static String |
JSONRPC_CONTENT_TYPE |
protected JsonRpcService |
jsonRpcService
Injected service instance
|
CACHE_SIZE_DEFAULT, CACHE_SIZE_KEY, NAME, PREFIX
Constructor and Description |
---|
JSONScreen() |
Modifier and Type | Method and Description |
---|---|
protected void |
doOutput(PipelineData pipelineData)
Output the dynamic content.
|
protected String |
getContentType(PipelineData pipelineData)
Set the content type.
|
protected static final String JSONRPC_CONTENT_TYPE
protected static final int BUFFER_SIZE
protected JsonRpcService jsonRpcService
public JSONScreen()
protected String getContentType(PipelineData pipelineData)
RawScreen
getContentType
in class RawScreen
pipelineData
- Turbine information.RawScreen.getContentType(org.apache.turbine.pipeline.PipelineData)
protected void doOutput(PipelineData pipelineData) throws Exception
JSONRPC_CONTENT_TYPE
: "application/json;charset=utf-8".Copyright © 2000–2019 The Apache Software Foundation. All rights reserved.