java.lang.Objectorg.mozilla.javascript.ScriptableObject
org.wso2.mashup.hostobjects.session.SessionHostObject
public class SessionHostObject
This is a JavaScript Rhino host object to provide the ability for the users to share objects across different service invocations. Scope for the session of a deployed mashup can be given using the "scope" service property annotation. For more information refer to JavaScript Session Host Object.
| Field Summary | |
|---|---|
static java.lang.String |
MASHUP_SESSION_OBJECT
|
| Fields inherited from class org.mozilla.javascript.ScriptableObject |
|---|
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST |
| Fields inherited from interface org.mozilla.javascript.Scriptable |
|---|
NOT_FOUND |
| Constructor Summary | |
|---|---|
SessionHostObject()
Contructor that will be used by the java engine.. |
|
| Method Summary | |
|---|---|
java.lang.String |
getClassName()
|
static org.mozilla.javascript.Scriptable |
jsConstructor(org.mozilla.javascript.Context cx,
java.lang.Object[] args,
org.mozilla.javascript.Function ctorObj,
boolean inNewExpr)
Constructor that gets called when creating the session object from Rhino. |
void |
jsFunction_clear()
Removes all values (clears) from the current java script session object. |
java.lang.Object |
jsFunction_get(java.lang.String key)
Retrieves the value associated with the given "key" from the current java script session object. |
void |
jsFunction_put(java.lang.String key,
java.lang.Object object)
Puts the key value pair in to the java script session object. |
void |
jsFunction_remove(java.lang.String key)
Removes the value associated with the given "key" from the current java script session object. |
| Methods inherited from class org.mozilla.javascript.ScriptableObject |
|---|
associateValue, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, get, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String MASHUP_SESSION_OBJECT
| Constructor Detail |
|---|
public SessionHostObject()
| Method Detail |
|---|
public static org.mozilla.javascript.Scriptable jsConstructor(org.mozilla.javascript.Context cx,
java.lang.Object[] args,
org.mozilla.javascript.Function ctorObj,
boolean inNewExpr)
throws java.io.IOException
Constructor that gets called when creating the session object from Rhino.
Retrieve the instance of this class available in the ServiceGroupContext of the current invocation and returns is to the user. If an instance of this is not available in the ServiceGroupContext, create an instance of this object and stores it in the ServiceGroupContext of the current message.
java.io.IOExceptionpublic java.lang.String getClassName()
getClassName in interface org.mozilla.javascript.ScriptablegetClassName in class org.mozilla.javascript.ScriptableObject
public void jsFunction_put(java.lang.String key,
java.lang.Object object)
session.put("name", "WSO2 Mashup Server");
key - - The key of the object added to the sessionobject - - The value of the object added to the sessionpublic java.lang.Object jsFunction_get(java.lang.String key)
session.get("name");
key - - The key of the object that the value is needed for
public void jsFunction_remove(java.lang.String key)
session.remove("name");
key - - The key of the object that needs to be removedpublic void jsFunction_clear()
session.clear();