public class JSONComponent extends Object
The base class for JSON "Components". JSONComponents provide a framework for implementing stateful JSON services. If you are providing a JSON service that is only used on a page, you can use AjaxProxy to provide a stateful JSON interface to a page. However, if you would like to provide stateful services to non-page-based clients, AjaxProxy isn't sufficient. By extending JSONComponent, all of your public methods are exposed as RPC calls to your clients that can be accessed by constructing a URL to a JSON Request Handler. For instance, /json/MyComponentName will give you a stateful service endpoint
If a method returns another JSONComponent, the client will be sent a JSONRedirect that contains the URL to communicate with the instance you returned.
THIS API IS STILL EXPERIMENTAL AND SUBJECT TO CHANGEConstructor and Description |
---|
JSONComponent(com.webobjects.appserver.WOContext context)
Constructs a new JSONComponent.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_setContext(com.webobjects.appserver.WOContext context)
Sets the current context.
|
protected void |
checkAccess()
Called prior to issuing any calls to
the component.
|
<T extends JSONComponent> |
componentWithName(Class<T> componentClass)
Returns a JSONComponent of the given type.
|
static <T extends JSONComponent> |
componentWithName(Class<T> componentClass,
com.webobjects.appserver.WOContext context)
Returns a JSONComponent of the given type.
|
static <T extends JSONComponent> |
componentWithName(String componentClassName,
com.webobjects.appserver.WOContext context)
Returns a JSONComponent of the given type.
|
protected com.webobjects.appserver.WOContext |
context()
Returns the current context.
|
public JSONComponent(com.webobjects.appserver.WOContext context)
context
- the context that created the componentprotected com.webobjects.appserver.WOContext context()
protected void _setContext(com.webobjects.appserver.WOContext context)
context
- the current context.protected void checkAccess()
public <T extends JSONComponent> T componentWithName(Class<T> componentClass)
T
- the JSONComponent typecomponentClass
- the class to instantiatepublic static <T extends JSONComponent> T componentWithName(Class<T> componentClass, com.webobjects.appserver.WOContext context)
T
- the JSONComponent typecomponentClass
- the class to instantiatecontext
- the WOContext to create withinpublic static <T extends JSONComponent> T componentWithName(String componentClassName, com.webobjects.appserver.WOContext context)
T
- the JSONComponent typecomponentClassName
- the name of the class to instantiatecontext
- the WOContext to create withinCopyright © 2002 – 2020 Project Wonder.