org.directwebremoting.extend
Interface ScriptSessionManager

All Known Implementing Classes:
DefaultScriptSessionManager

public interface ScriptSessionManager

A ScriptSessionManager looks after a number of sessions (keyed using a Javascript variable)

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

Field Summary
static long DEFAULT_TIMEOUT_MILLIS
          The default length of time a session can go unused before it automatically becomes invalid and is recycled.
 
Method Summary
 void addScriptSessionListener(ScriptSessionListener li)
          Maintain the list of ScriptSessionListeners
 RealScriptSession createScriptSession(java.lang.String url, java.lang.String httpSessionId)
          When a new client page-loads, we create a script session.
 java.util.Collection<ScriptSession> getAllScriptSessions()
          Get a list of all the currently known ScriptSessions by id.
 RealScriptSession getScriptSession(java.lang.String id, java.lang.String url, java.lang.String httpSessionId)
          For a given script session id, return the related ScriptSession object or null if the id is not known.
 java.util.Collection<ScriptSession> getScriptSessionsByPage(java.lang.String url)
          For a given script session id, either create a new ScriptSession object or retrieve an existing one if one exists.
 long getScriptSessionTimeout()
          Accessor for the time (in milliseconds) when unused ScriptSessions will expire
 void removeScriptSessionListener(ScriptSessionListener li)
          Maintain the list of ScriptSessionListeners
 

Field Detail

DEFAULT_TIMEOUT_MILLIS

static final long DEFAULT_TIMEOUT_MILLIS
The default length of time a session can go unused before it automatically becomes invalid and is recycled. The default is 5mins

See Also:
Constant Field Values
Method Detail

getAllScriptSessions

java.util.Collection<ScriptSession> getAllScriptSessions()
Get a list of all the currently known ScriptSessions by id. Note that the list of known sessions is continually changing so it is possible that the list will be out of date by the time it is used. For this reason you should check that getScriptSession(String id) returns something non null.

Returns:
An iterator over the currently known sessions, by id

getScriptSessionsByPage

java.util.Collection<ScriptSession> getScriptSessionsByPage(java.lang.String url)
For a given script session id, either create a new ScriptSession object or retrieve an existing one if one exists.

Parameters:
url - The URL including 'http://', up to (but not including) '?' or '#'
Returns:
A ScriptSession.

getScriptSession

RealScriptSession getScriptSession(java.lang.String id,
                                   java.lang.String url,
                                   java.lang.String httpSessionId)
For a given script session id, return the related ScriptSession object or null if the id is not known.

Parameters:
id - The id to get a ScriptSession object for
url - The URL including 'http://', up to (but not including) '?' or '#' (or null if not known)
httpSessionId - The session ID (or null if not known)
Returns:
A ScriptSession to match the ID, or null if a match is not found.

createScriptSession

RealScriptSession createScriptSession(java.lang.String url,
                                      java.lang.String httpSessionId)
When a new client page-loads, we create a script session.

Parameters:
url - The URL including 'http://', up to (but not including) '?' or '#'
httpSessionId - The session ID (or null if not known)
Returns:
The new script session id

getScriptSessionTimeout

long getScriptSessionTimeout()
Accessor for the time (in milliseconds) when unused ScriptSessions will expire

Returns:
the scriptSessionTimeout

addScriptSessionListener

void addScriptSessionListener(ScriptSessionListener li)
Maintain the list of ScriptSessionListeners

Parameters:
li - the ScriptSessionListener to add

removeScriptSessionListener

void removeScriptSessionListener(ScriptSessionListener li)
Maintain the list of ScriptSessionListeners

Parameters:
li - the ScriptSessionListener to remove

Copyright ¬ 2005