public class SessionScope extends AbstractRequestAttributesScope
Scope
implementation.
Relies on a thread-bound RequestAttributes instance, which
can be exported through RequestContextListener,
RequestContextFilter or
org.springframework.web.servlet.DispatcherServlet.
This Scope will also work for Portlet environments,
through an alternate RequestAttributes implementation
(as exposed out-of-the-box by Spring's
org.springframework.web.portlet.DispatcherPortlet.
RequestContextHolder.currentRequestAttributes(),
RequestAttributes.SCOPE_SESSION,
RequestAttributes.SCOPE_GLOBAL_SESSION,
RequestContextListener,
RequestContextFilter,
org.springframework.web.servlet.DispatcherServlet,
org.springframework.web.portlet.DispatcherPortlet| Constructor and Description |
|---|
SessionScope()
Create a new SessionScope, storing attributes in a locally
isolated session (or default session, if there is no distinction
between a global session and a component-specific session).
|
SessionScope(boolean globalSession)
Create a new SessionScope, specifying whether to store attributes
in the global session, provided that such a distinction is available.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
get(String name,
org.springframework.beans.factory.ObjectFactory<?> objectFactory) |
String |
getConversationId() |
protected int |
getScope()
Template method that determines the actual target scope.
|
Object |
remove(String name) |
registerDestructionCallback, resolveContextualObjectpublic SessionScope()
public SessionScope(boolean globalSession)
This distinction is important for Portlet environments, where there are two notions of a session: "portlet scope" and "application scope". If this flag is on, objects will be put into the "application scope" session; else they will end up in the "portlet scope" session (the typical default).
In a Servlet environment, this flag is effectively ignored.
globalSession - true in case of the global session as target;
false in case of a component-specific session as targetorg.springframework.web.portlet.context.PortletRequestAttributes,
ServletRequestAttributesprotected int getScope()
AbstractRequestAttributesScopegetScope in class AbstractRequestAttributesScopeRequestAttributes constantRequestAttributes.SCOPE_REQUEST,
RequestAttributes.SCOPE_SESSION,
RequestAttributes.SCOPE_GLOBAL_SESSIONpublic String getConversationId()
public Object get(String name, org.springframework.beans.factory.ObjectFactory<?> objectFactory)
get in interface org.springframework.beans.factory.config.Scopeget in class AbstractRequestAttributesScopepublic Object remove(String name)
remove in interface org.springframework.beans.factory.config.Scoperemove in class AbstractRequestAttributesScope