org.springframework.web.context.request
Class AbstractRequestAttributesScope
java.lang.Object
org.springframework.web.context.request.AbstractRequestAttributesScope
- All Implemented Interfaces:
- org.springframework.beans.factory.config.Scope
- Direct Known Subclasses:
- RequestScope, SessionScope
public abstract class AbstractRequestAttributesScope
- extends java.lang.Object
- implements org.springframework.beans.factory.config.Scope
Abstract Scope
implementation that reads from a particular scope
in the current thread-bound RequestAttributes
object.
Subclasses simply need to implement getScope()
to instruct
this class which RequestAttributes
scope to read attributes from.
Subclasses may wish to override the get(java.lang.String, org.springframework.beans.factory.ObjectFactory)
and remove(java.lang.String)
methods to add synchronization around the call back into this super class.
- Since:
- 2.0
- Author:
- Rod Johnson, Juergen Hoeller, Rob Harrop
Method Summary |
java.lang.Object |
get(java.lang.String name,
org.springframework.beans.factory.ObjectFactory objectFactory)
|
protected abstract int |
getScope()
Template method that determines the actual target scope. |
void |
registerDestructionCallback(java.lang.String name,
java.lang.Runnable callback)
|
java.lang.Object |
remove(java.lang.String name)
|
java.lang.Object |
resolveContextualObject(java.lang.String key)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.beans.factory.config.Scope |
getConversationId |
AbstractRequestAttributesScope
public AbstractRequestAttributesScope()
get
public java.lang.Object get(java.lang.String name,
org.springframework.beans.factory.ObjectFactory objectFactory)
- Specified by:
get
in interface org.springframework.beans.factory.config.Scope
remove
public java.lang.Object remove(java.lang.String name)
- Specified by:
remove
in interface org.springframework.beans.factory.config.Scope
registerDestructionCallback
public void registerDestructionCallback(java.lang.String name,
java.lang.Runnable callback)
- Specified by:
registerDestructionCallback
in interface org.springframework.beans.factory.config.Scope
resolveContextualObject
public java.lang.Object resolveContextualObject(java.lang.String key)
- Specified by:
resolveContextualObject
in interface org.springframework.beans.factory.config.Scope
getScope
protected abstract int getScope()
- Template method that determines the actual target scope.
- Returns:
- the target scope, in the form of an appropriate
RequestAttributes
constant - See Also:
RequestAttributes.SCOPE_REQUEST
,
RequestAttributes.SCOPE_SESSION
,
RequestAttributes.SCOPE_GLOBAL_SESSION