|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.Dictionary<K,V>
java.util.Hashtable
wt.session.SessionContext
public class SessionContext
A specialized Hashtable for maintaining static context partitioned by user session.
Supported API: true
Extendable: false
| Constructor Summary | |
|---|---|
SessionContext()
Construct a new session context. |
|
| Method Summary | |
|---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. |
static SessionContext |
getContext()
Get current session context. |
static SessionContext |
getContext(boolean authenticate)
Get current session context. |
static SessionContext |
getContext(String session_id)
Get the session context corresponding to a given session id. |
static SessionContext |
getContext(String prefix,
String sessionId)
Get current session context using a "prefix" and the JSP/Servlet Session Id as the key. |
static WTPrincipal |
getEffectivePrincipal()
Get the effective principal object associated with the current thread. |
String |
getSessionId()
Get the unique session id associated with this context. |
static SessionContext |
newContext()
Create a new SessionContext object associated with the current thread. |
Object |
put(Object key,
Object value)
Put a new value in this method context. |
void |
register()
Register a session context in the session cache. |
Object |
remove(Object key)
Remove a value from this session context. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. |
static SessionContext |
setContext(SessionContext session_context)
Explicitly set the SessionContext object associated with the current thread. |
static WTPrincipal |
setEffectivePrincipal(WTPrincipal principal)
Set the effective principal object associated with the current thread. |
| Methods inherited from class java.util.Hashtable |
|---|
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, putAll, rehash, size, toString, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SessionContext()
register is called.
Until registered, there is no unique session id associated with this object.
| Method Detail |
|---|
public String getSessionId()
public void register()
public static SessionContext getContext()
MethodContextpublic static SessionContext getContext(boolean authenticate)
authenticate - perform user authentication if creating a new session context.
MethodContextpublic static SessionContext getContext(String session_id)
session_id - the session id
public Object put(Object key,
Object value)
hashtable.put to update master session cache maintained
in the server manager and add property change support.
put in interface Mapput in class Hashtablepublic Object remove(Object key)
Hashtable.remove to update master session cache
maintained in the server manager and add property change support.
remove in interface Mapremove in class Hashtablepublic static SessionContext setContext(SessionContext session_context)
SessionContext object associated with the current thread.
This method will typically be used in conjunction with a try/finally block to
reset the value later. Setting to null restores the default.
For example:
...
SessionContext new_context = ...
SessionContext previous_context = SessionContext.setContext(new_context);
try
{
SessionMgr.setPrincipal(AdministrativeDomainHelper.ADMINISTRATOR_NAME);
doAdminStuff();
}
catch (...)
{
...
}
finally
{
SessionContext.setContext(previous_context);
}
session_context - a SessionContext object or null
public static SessionContext newContext()
SessionContext object associated with the current thread.
This method will typically be used in conjunction with a try/finally block.
For example:
...
SessionContext previous_context = SessionContext.newContext();
try
{
SessionMgr.setPrincipal(AdministrativeDomainHelper.ADMINISTRATOR_NAME);
doAdminStuff();
}
catch (...)
{
...
}
finally
{
SessionContext.setContext(previous_context);
}
public static WTPrincipal setEffectivePrincipal(WTPrincipal principal)
This method will typically be used in conjunction with a try/finally block to
reset the value later.
For example:
...
WTPrincipal principal = ...
WTPrincipal previous = SessionContext.setEffectivePrincipal(principal);
try
{
// Do special stuff
}
catch (...)
{
...
}
finally
{
SessionContext.setEffectivePrincipal(previous);
}
principal - a WTPrincipal object or null
public static WTPrincipal getEffectivePrincipal()
Principal object or null if not set.public void addPropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener to the listener list.
Property change events will be fired to all registered listeners whenever a
value in this hashtable is added, changed, or removed.
listener - the PropertyChangeListener to be addedpublic void removePropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener from the listener list.
listener - the PropertyChangeListener to be removed
public static SessionContext getContext(String prefix,
String sessionId)
prefix - used guarentee uniqueness to the keysessionId - session id of the JSP/Servlet engine calling the method server
MethodContext
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||