Class AbstractRequestAttributes
- java.lang.Object
- org.springframework.web.context.request.AbstractRequestAttributes
- All Implemented Interfaces:
RequestAttributes
- Direct Known Subclasses:
PortletRequestAttributes,ServletRequestAttributes
public abstract class AbstractRequestAttributes extends Object implements RequestAttributes
Abstract support class for RequestAttributes implementations, offering a request completion mechanism for request-specific destruction callbacks and for updating accessed session attributes.- Since:
- 2.0
- Author:
- Juergen Hoeller
- See Also:
requestCompleted()
Field Summary
Fields Modifier and Type Field Description protected Map<String,Runnable>requestDestructionCallbacksMap from attribute name String to destruction callback RunnableFields inherited from interface org.springframework.web.context.request.RequestAttributes
REFERENCE_REQUEST, REFERENCE_SESSION, SCOPE_GLOBAL_SESSION, SCOPE_REQUEST, SCOPE_SESSION
Constructor Summary
Constructors Constructor Description AbstractRequestAttributes()
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleanisRequestActive()Determine whether the original request is still active.protected voidregisterRequestDestructionCallback(String name, Runnable callback)Register the given callback as to be executed after request completion.protected voidremoveRequestDestructionCallback(String name)Remove the request destruction callback for the specified attribute, if any.voidrequestCompleted()Signal that the request has been completed.protected abstract voidupdateAccessedSessionAttributes()Update all session attributes that have been accessed during request processing, to expose their potentially updated state to the underlying session manager.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.web.context.request.RequestAttributes
getAttribute, getAttributeNames, getSessionId, getSessionMutex, registerDestructionCallback, removeAttribute, resolveReference, setAttribute
Field Detail
requestDestructionCallbacks
protected final Map<String,Runnable> requestDestructionCallbacks
Map from attribute name String to destruction callback Runnable
Constructor Detail
AbstractRequestAttributes
public AbstractRequestAttributes()
Method Detail
requestCompleted
public void requestCompleted()
Signal that the request has been completed.Executes all request destruction callbacks and updates the session attributes that have been accessed during request processing.
isRequestActive
protected final boolean isRequestActive()
Determine whether the original request is still active.- See Also:
requestCompleted()
registerRequestDestructionCallback
protected final void registerRequestDestructionCallback(String name, Runnable callback)
Register the given callback as to be executed after request completion.- Parameters:
name- the name of the attribute to register the callback forcallback- the callback to be executed for destruction
removeRequestDestructionCallback
protected final void removeRequestDestructionCallback(String name)
Remove the request destruction callback for the specified attribute, if any.- Parameters:
name- the name of the attribute to remove the callback for
updateAccessedSessionAttributes
protected abstract void updateAccessedSessionAttributes()
Update all session attributes that have been accessed during request processing, to expose their potentially updated state to the underlying session manager.