|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.context.request.AbstractRequestAttributesScope org.springframework.web.context.request.SessionScope
public class SessionScope
Session-backed Scope implementation. Relies on a thread-bound RequestAttributes instance, which can be exported through RequestContextListener, RequestContextFilter or DispatcherServlet.
This Scope will also work for Portlet environments, through an alternate RequestAttributes implementation (as exposed out-of-the-box by Spring's DispatcherPortlet).
RequestContextHolder.currentRequestAttributes()
,
RequestAttributes.SCOPE_SESSION
,
RequestAttributes.SCOPE_GLOBAL_SESSION
,
RequestContextListener
,
RequestContextFilter
,
DispatcherServlet
,
DispatcherPortlet
Constructor Summary | |
---|---|
SessionScope()
Create a new SessionScope, storing attributes in a locally isolated session. |
|
SessionScope(boolean globalSession)
Create a new SessionScope, specifying whether to store attributes in the global session, provided that such a distinction is available. |
Method Summary | |
---|---|
Object |
get(String name,
ObjectFactory objectFactory)
Return the object from the underlying scope, creating it if not found. |
String |
getConversationId()
Return the conversation id for the current underlying scope, if any. |
protected int |
getScope()
Template method that determines the actual target scope. |
Object |
remove(String name)
Remove the object with the given name from the underlying scope. |
Methods inherited from class org.springframework.web.context.request.AbstractRequestAttributesScope |
---|
registerDestructionCallback |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public 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.
PortletRequestAttributes
,
ServletRequestAttributes
Method Detail |
---|
protected int getScope()
AbstractRequestAttributesScope
getScope
in class AbstractRequestAttributesScope
RequestAttributes
constantpublic String getConversationId()
Scope
null
if there is no
conversation id concept for this scopepublic Object get(String name, ObjectFactory objectFactory)
Scope
get
in interface Scope
get
in class AbstractRequestAttributesScope
name
- the name to bind withobjectFactory
- the ObjectFactory
used to create the scoped object if not present
public Object remove(String name)
Scope
Returns 'null
' if no object was found; otherwise
returns the removed Object
.
remove
in interface Scope
remove
in class AbstractRequestAttributesScope
name
- the name of the object to remove
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |