org.directwebremoting.extend
Interface ScriptSessionManager

All Known Implementing Classes:
DefaultScriptSessionManager, TransientScriptSessionManager

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
 java.util.Collection<ScriptSession> getAllScriptSessions()
          Get a list of all the currently known ScriptSessions by id.
 java.lang.String getInitCode()
          Some implementations of ScriptSessionManager need to add custom code into engine.js to register ScriptSessions with the server.
 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<RealScriptSession> getScriptSessionsByHttpSessionId(java.lang.String httpSessionId)
          Lookup all the windows associated with a given browser
 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

getScriptSessionsByHttpSessionId

java.util.Collection<RealScriptSession> getScriptSessionsByHttpSessionId(java.lang.String httpSessionId)
Lookup all the windows associated with a given browser

Parameters:
httpSessionId - The browser id to lookup
Returns:
A list of script sessions for each open window

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.

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

getInitCode

java.lang.String getInitCode()
Some implementations of ScriptSessionManager need to add custom code into engine.js to register ScriptSessions with the server.


Copyright 2008