| 
 |   | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--sunlabs.brazil.session.SessionManager
The SessionManager associates an object with a Session ID
 to give Handlers the ability to maintain state that lasts for the
 duration of a session instead of just for the duration of a request.
 
 The SessionManager operates as a bag of globally
 accessible resources.  Existing subclasses of the
 SessionManager also provide persistence, that is, a way to
 recover these resources even if the server process is terminated and
 later restarted, to get back to the state things were in.
 
A session manager is like a Dictionary only with fewer guarantees. Enumeration is not possible, and a "get" might return null even if there was a previous "put", so users should be prepared to handle that case.
Unlike a typical dictionary, a session manager uses two keys to identify to identify each resource. The first key, by convention, represents a client session id. The second (or resource) key is chosen to identify the resource within a session.
Care should be used when choosing resource keys, as they are global to a JVM, which may have several unrelated Brazil servers running at once. Sharing session manager resources between servers can cause unexpected behavior if done unintentionally.
 Existing session manager implementations arrange for session resources 
 that are Java Properties to be saved across restarts
 of the JVM, and should be used when practical.
| Constructor Summary | |
| SessionManager() | |
| Method Summary | |
| static Object | get(Object session,
    Object ident)get an object from the session manager. | 
| static Object | getSession(Object session,
           Object ident,
           Class type)Returns the object associated with the given Session ID. | 
| static void | put(Object session,
    Object ident,
    Object data)put an object into the session manager. | 
| static void | remove(Object session,
       Object ident)Remove an object from the session manager. | 
| static void | setSessionManager(SessionManager mgr)Installs the given SessionManagerobject as the
 default session manager to be invoked whengetSessionis called. | 
| Methods inherited from class java.lang.Object | 
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
public SessionManager()
| Method Detail | 
public static void setSessionManager(SessionManager mgr)
SessionManager object as the
 default session manager to be invoked when getSession
 is called.
mgr - The SessionManager object.
public static Object getSession(Object session,
                                Object ident,
                                Class type)
session - The Session ID for the persistent session information.  If
		the session does not exist, a new one is created.ident - An arbitray identifier used to determine which object
		(associated with the given session) the caller
		wants.type - The Class of the object to create.  If the given
		session and ident did not specify
		an existing object, a new one is created by calling
		newInstance based on the type.
		If null, then this method returns
		null if the object didn't exist, instead of
		allocating a new object.
type, or null if
		the object doesn't exist and type is null.
public static Object get(Object session,
                         Object ident)
SessionManager instance.
public static void put(Object session,
                       Object ident,
                       Object data)
SessionManager instance.
public static void remove(Object session,
                          Object ident)
SessionManager instance.
| 
 | Version 2.1, Generated 12/30/04 Copyright (c) 2001-2004, Sun Microsystems. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||