|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.web.bind.support.DefaultSessionAttributeStore
public class DefaultSessionAttributeStore
Default implementation of the SessionAttributeStore
interface,
storing the attributes in the WebRequest session (i.e. HttpSession
or PortletSession).
setAttributeNamePrefix(java.lang.String)
,
RequestAttributes.setAttribute(java.lang.String, java.lang.Object, int)
,
RequestAttributes.getAttribute(java.lang.String, int)
,
RequestAttributes.removeAttribute(java.lang.String, int)
Field Summary | |
---|---|
private java.lang.String |
attributeNamePrefix
|
Constructor Summary | |
---|---|
DefaultSessionAttributeStore()
|
Method Summary | |
---|---|
void |
cleanupAttribute(WebRequest request,
java.lang.String attributeName)
Clean up the specified attribute in the backend session. |
protected java.lang.String |
getAttributeNameInSession(WebRequest request,
java.lang.String attributeName)
Calculate the attribute name in the backend session. |
java.lang.Object |
retrieveAttribute(WebRequest request,
java.lang.String attributeName)
Retrieve the specified attribute from the backend session. |
void |
setAttributeNamePrefix(java.lang.String attributeNamePrefix)
Specify a prefix to use for the attribute names in the backend session. |
void |
storeAttribute(WebRequest request,
java.lang.String attributeName,
java.lang.Object attributeValue)
Store the supplied attribute in the backend session. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.String attributeNamePrefix
Constructor Detail |
---|
public DefaultSessionAttributeStore()
Method Detail |
---|
public void setAttributeNamePrefix(java.lang.String attributeNamePrefix)
Default is to use no prefix, storing the session attributes with the same name as in the model.
public void storeAttribute(WebRequest request, java.lang.String attributeName, java.lang.Object attributeValue)
SessionAttributeStore
Can be called for new attributes as well as for existing attributes. In the latter case, this signals that the attribute value may have been modified.
storeAttribute
in interface SessionAttributeStore
request
- the current requestattributeName
- the name of the attributeattributeValue
- the attribute value to storepublic java.lang.Object retrieveAttribute(WebRequest request, java.lang.String attributeName)
SessionAttributeStore
This will typically be called with the expectation that the
attribute is already present, with an exception to be thrown
if this method returns null
.
retrieveAttribute
in interface SessionAttributeStore
request
- the current requestattributeName
- the name of the attribute
null
if nonepublic void cleanupAttribute(WebRequest request, java.lang.String attributeName)
SessionAttributeStore
Indicates that the attribute name will not be used anymore.
cleanupAttribute
in interface SessionAttributeStore
request
- the current requestattributeName
- the name of the attributeprotected java.lang.String getAttributeNameInSession(WebRequest request, java.lang.String attributeName)
The default implementation simply prepends the configured
"attributeNamePrefix"
, if any.
request
- the current requestattributeName
- the name of the attribute
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |