Package org.nuxeo.ecm.webengine.session
Class UserSession
- java.lang.Object
 - 
- java.util.AbstractMap<K,V>
 - 
- java.util.HashMap<String,Object>
 - 
- org.nuxeo.ecm.webengine.session.UserSession
 
 
 
 
- 
- All Implemented Interfaces:
 Serializable,Cloneable,Map<String,Object>
public final class UserSession extends HashMap<String,Object>
Used to store user session. This object is cached in a the HTTP session Principal, subject and credentials are immutable per user session- Author:
 - Bogdan Stefanescu
 - See Also:
 - Serialized Form
 
 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object> 
 - 
 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedUserSession(javax.servlet.http.HttpServletRequest request) 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddRequestCleanupHandler(javax.servlet.http.HttpServletRequest request, RequestCleanupHandler handler)Register a cleanup handler that will be invoked when HTTP request terminate.<T extends Component>
TfindComponent(Class<T> type, String name)Finds an existing component.<T extends Component>
TgetComponent(Class<T> type)<T extends Component>
TgetComponent(Class<T> type, String name)Gets a component given its class and an optional name.<T extends Component>
TgetComponent(String id)Gets component by ID.<T extends Component>
TgetComponent(String typeName, String name)static UserSessiongetCurrentSession(javax.servlet.http.HttpServletRequest request)PrincipalgetPrincipal()- 
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values 
- 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString 
 - 
 
 - 
 
- 
- 
Field Detail
- 
log
protected static final Log log
 
- 
comps
protected Map<Class<?>,ComponentMap<?>> comps
 
- 
request
protected javax.servlet.http.HttpServletRequest request
 
 - 
 
- 
Method Detail
- 
getCurrentSession
public static UserSession getCurrentSession(javax.servlet.http.HttpServletRequest request)
 
- 
getPrincipal
public Principal getPrincipal()
 
- 
addRequestCleanupHandler
public static void addRequestCleanupHandler(javax.servlet.http.HttpServletRequest request, RequestCleanupHandler handler)Register a cleanup handler that will be invoked when HTTP request terminate. This method is not thread safe. 
- 
findComponent
public <T extends Component> T findComponent(Class<T> type, String name)
Finds an existing component.The component state will not be modified before being returned as in
getComponent(Class, String).If the component was not found in that session, returns null.
 
- 
getComponent
public <T extends Component> T getComponent(Class<T> type, String name) throws SessionException
Gets a component given its class and an optional name.If the component was not yet created in this session, it will be created and registered against the session.
- Throws:
 SessionException
 
- 
getComponent
public <T extends Component> T getComponent(Class<T> type) throws SessionException
- Throws:
 SessionException
 
- 
getComponent
public <T extends Component> T getComponent(String typeName, String name) throws SessionException
- Throws:
 SessionException
 
- 
getComponent
public <T extends Component> T getComponent(String id) throws SessionException
Gets component by ID.The ID is of the form
type#namefor non-null names andtypefor null names.- Throws:
 SessionException
 
 - 
 
 -