org.directwebremoting
Class ScriptSessions

java.lang.Object
  extended by org.directwebremoting.ScriptSessions

public class ScriptSessions
extends java.lang.Object

A class to act on the current ScriptSession(s).

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Constructor Summary
ScriptSessions()
           
 
Method Summary
static void addFunctionCall(java.lang.String funcName, java.lang.Object... params)
          Call a named function with one parameter.
static void addScript(ScriptBuffer script)
          Add a script to the list waiting for remote execution.
static void addScript(java.lang.String scriptString)
          Utility to add the given script to all known browsers.
static void removeAttribute(java.lang.String name)
          Removes the object bound with the specified name from this session.
static void setAttribute(java.lang.String name, java.lang.Object value)
          Binds an object to this session, using the name specified.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptSessions

public ScriptSessions()
Method Detail

setAttribute

public static void setAttribute(java.lang.String name,
                                java.lang.Object value)
Binds an object to this session, using the name specified. If an object of the same name is already bound to the session, the object is replaced.

After this method executes, and if the new object implements ScriptSessionBindingListener, the container calls ScriptSessionBindingListener.valueBound(org.directwebremoting.event.ScriptSessionBindingEvent).

If an object was already bound to this session of this name that implements ScriptSessionBindingListener, its ScriptSessionBindingListener.valueUnbound(org.directwebremoting.event.ScriptSessionBindingEvent) method is called.

If the value passed in is null, this has the same effect as calling removeAttribute(java.lang.String).

Parameters:
name - the name to which the object is bound; cannot be null
value - the object to be bound
Throws:
java.lang.IllegalStateException - if the page has been invalidated

removeAttribute

public static void removeAttribute(java.lang.String name)
Removes the object bound with the specified name from this session. If the session does not have an object bound with the specified name, this method does nothing.

After this method executes, and if the object implements ScriptSessionBindingListener, the container calls ScriptSessionBindingListener.valueUnbound(org.directwebremoting.event.ScriptSessionBindingEvent).

Parameters:
name - the name of the object to remove from this session
Throws:
java.lang.IllegalStateException - if the page has been invalidated

addScript

public static void addScript(ScriptBuffer script)
Add a script to the list waiting for remote execution.

Parameters:
script - The script to execute

addScript

public static void addScript(java.lang.String scriptString)
Utility to add the given script to all known browsers. This version automatically wraps the string in a ClientScript object.

Parameters:
scriptString - The Javascript to send to the browsers

addFunctionCall

public static void addFunctionCall(java.lang.String funcName,
                                   java.lang.Object... params)
Call a named function with one parameter.

Parameters:
funcName - The name of the function to call
params - The parameters to the above function

Copyright 2008