Project Wonder 5.0

er.ajax.json
Class JSONComponent

java.lang.Object
  extended by er.ajax.json.JSONComponent

public class JSONComponent
extends java.lang.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 CHANGE

Author:
mschrag

Constructor Summary
JSONComponent(com.webobjects.appserver.WOContext context)
          Constructs a new JSONComponent.
 
Method Summary
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>
T
componentWithName(java.lang.Class<T> componentClass)
          Returns a JSONComponent of the given type.
static
<T extends JSONComponent>
T
componentWithName(java.lang.Class<T> componentClass, com.webobjects.appserver.WOContext context)
          Returns a JSONComponent of the given type.
static
<T extends JSONComponent>
T
componentWithName(java.lang.String componentClassName, com.webobjects.appserver.WOContext context)
          Returns a JSONComponent of the given type.
protected  com.webobjects.appserver.WOContext context()
          Returns the current context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONComponent

public JSONComponent(com.webobjects.appserver.WOContext context)
Constructs a new JSONComponent.

Parameters:
context - the context that created the component
Method Detail

context

protected com.webobjects.appserver.WOContext context()
Returns the current context.

Returns:
the current context.

_setContext

protected void _setContext(com.webobjects.appserver.WOContext context)
Sets the current context.

Parameters:
context - the current context.

checkAccess

protected void checkAccess()
Called prior to issuing any calls to the component. Throw a SecurityException if the Session user's credentials are insufficient.


componentWithName

public <T extends JSONComponent> T componentWithName(java.lang.Class<T> componentClass)
Returns a JSONComponent of the given type.

Type Parameters:
T - the JSONComponent type
Parameters:
componentClass - the class to instantiate
Returns:
an instance of the given JSONComponent

componentWithName

public static <T extends JSONComponent> T componentWithName(java.lang.Class<T> componentClass,
                                                            com.webobjects.appserver.WOContext context)
Returns a JSONComponent of the given type.

Type Parameters:
T - the JSONComponent type
Parameters:
componentClass - the class to instantiate
context - the WOContext to create within
Returns:
an instance of the given JSONComponent

componentWithName

public static <T extends JSONComponent> T componentWithName(java.lang.String componentClassName,
                                                            com.webobjects.appserver.WOContext context)
Returns a JSONComponent of the given type.

Type Parameters:
T - the JSONComponent type
Parameters:
componentClassName - the name of the class to instantiate
context - the WOContext to create within
Returns:
an instance of the given JSONComponent

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.