public final class UserSession extends HashMap<String,Object>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Field and Description |
---|---|
protected Map<Class<?>,ComponentMap<?>> |
comps |
protected static org.apache.commons.logging.Log |
log |
protected javax.servlet.http.HttpServletRequest |
request |
Modifier | Constructor and Description |
---|---|
protected |
UserSession(javax.servlet.http.HttpServletRequest request) |
Modifier and Type | Method and Description |
---|---|
static void |
addRequestCleanupHandler(javax.servlet.http.HttpServletRequest request,
RequestCleanupHandler handler)
Register a cleanup handler that will be invoked when HTTP request terminate.
|
<T extends Component> |
findComponent(Class<T> type,
String name)
Finds an existing component.
|
<T extends Component> |
getComponent(Class<T> type) |
<T extends Component> |
getComponent(Class<T> type,
String name)
Gets a component given its class and an optional name.
|
<T extends Component> |
getComponent(String id)
Gets component by ID.
|
<T extends Component> |
getComponent(String typeName,
String name) |
static UserSession |
getCurrentSession(javax.servlet.http.HttpServletRequest request) |
Principal |
getPrincipal() |
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
equals, hashCode, toString
protected static final org.apache.commons.logging.Log log
protected Map<Class<?>,ComponentMap<?>> comps
protected javax.servlet.http.HttpServletRequest request
protected UserSession(javax.servlet.http.HttpServletRequest request)
public static UserSession getCurrentSession(javax.servlet.http.HttpServletRequest request)
public Principal getPrincipal()
public static void addRequestCleanupHandler(javax.servlet.http.HttpServletRequest request, RequestCleanupHandler handler)
public <T extends Component> T findComponent(Class<T> type, String name)
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.
public <T extends Component> T getComponent(Class<T> type, String name) throws SessionException
If the component was not yet created in this session, it will be created and registered against the session.
SessionException
public <T extends Component> T getComponent(Class<T> type) throws SessionException
SessionException
public <T extends Component> T getComponent(String typeName, String name) throws SessionException
SessionException
public <T extends Component> T getComponent(String id) throws SessionException
The ID is of the form type#name
for non-null names and type
for null names.
SessionException
Copyright © 2015 Nuxeo SA. All rights reserved.