Class SessionScope
- All Implemented Interfaces:
- Scope
Scope
 implementation.
 Relies on a thread-bound RequestAttributes instance, which
 can be exported through RequestContextListener,
 RequestContextFilter or
 DispatcherServlet.
- Since:
- 2.0
- Author:
- Rod Johnson, Juergen Hoeller, Rob Harrop
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionget(String name, ObjectFactory<?> objectFactory) Return the object with the given name from the underlying scope,creating itif not found in the underlying storage mechanism.Return the conversation ID for the current underlying scope, if any.protected intgetScope()Template method that determines the actual target scope.Remove the object with the givennamefrom the underlying scope.Methods inherited from class org.springframework.web.context.request.AbstractRequestAttributesScoperegisterDestructionCallback, resolveContextualObject
- 
Constructor Details- 
SessionScopepublic SessionScope()
 
- 
- 
Method Details- 
getScopeprotected int getScope()Description copied from class:AbstractRequestAttributesScopeTemplate method that determines the actual target scope.- Specified by:
- getScopein class- AbstractRequestAttributesScope
- Returns:
- the target scope, in the form of an appropriate
 RequestAttributesconstant
- See Also:
 
- 
getConversationIdDescription copied from interface:ScopeReturn the conversation ID for the current underlying scope, if any.The exact meaning of the conversation ID depends on the underlying storage mechanism. In the case of session-scoped objects, the conversation ID would typically be equal to (or derived from) the session ID; in the case of a custom conversation that sits within the overall session, the specific ID for the current conversation would be appropriate.Note: This is an optional operation. It is perfectly valid to return nullin an implementation of this method if the underlying storage mechanism has no obvious candidate for such an ID.Since 7.0, this interface method returns nullby default.- Returns:
- the conversation ID, or nullif there is no conversation ID for the current scope
 
- 
getDescription copied from interface:ScopeReturn the object with the given name from the underlying scope,creating itif not found in the underlying storage mechanism.This is the central operation of a Scope, and the only operation that is absolutely required. - Specified by:
- getin interface- Scope
- Overrides:
- getin class- AbstractRequestAttributesScope
- Parameters:
- name- the name of the object to retrieve
- objectFactory- the- ObjectFactoryto use to create the scoped object if it is not present in the underlying storage mechanism
- Returns:
- the desired object (never null)
 
- 
removeDescription copied from interface:ScopeRemove the object with the givennamefrom the underlying scope.Returns nullif no object was found; otherwise returns the removedObject.Note that an implementation should also remove a registered destruction callback for the specified object, if any. It does, however, not need to execute a registered destruction callback in this case, since the object will be destroyed by the caller (if appropriate). Note: This is an optional operation. Implementations may throw UnsupportedOperationExceptionif they do not support explicitly removing an object.- Specified by:
- removein interface- Scope
- Overrides:
- removein class- AbstractRequestAttributesScope
- Parameters:
- name- the name of the object to remove
- Returns:
- the removed object, or nullif no object was present
- See Also:
 
 
-