Top Description Fields Constructors Methods
org.springframework.web.bind.support

public Class DefaultSessionAttributeStore

extends Object
implements SessionAttributeStore
Class Inheritance
All Implemented Interfaces
org.springframework.web.bind.support.SessionAttributeStore
Imports
org.springframework.lang.Nullable, org.springframework.util.Assert, org.springframework.web.context.request.WebRequest

Default implementation of the SessionAttributeStore interface, storing the attributes in the WebRequest session (i.e. HttpSession).
Author
Juergen Hoeller
Since
2.5
See Also
setAttributeNamePrefix, org.springframework.web.context.request.WebRequest#setAttribute, org.springframework.web.context.request.WebRequest#getAttribute, org.springframework.web.context.request.WebRequest#removeAttribute

Field Summary

Modifier and TypeField and Description
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
cleanupAttribute(WebRequest
the current request
request
,
String
the name of the attribute
attributeName
)

Implements org.springframework.web.bind.support.SessionAttributeStore.cleanupAttribute.

Clean up the specified attribute in the backend session.

protected String

Returns:

the attribute name in the backend session
getAttributeNameInSession
(WebRequest
the current request
request
,
String
the name of the attribute
attributeName
)

Calculate the attribute name in the backend session.

public Object
retrieveAttribute(WebRequest
the current request
request
,
String
the name of the attribute
attributeName
)

Implements org.springframework.web.bind.support.SessionAttributeStore.retrieveAttribute.

Retrieve the specified attribute from the backend session.

public void
setAttributeNamePrefix(String attributeNamePrefix)

Specify a prefix to use for the attribute names in the backend session.

public void
storeAttribute(WebRequest
the current request
request
,
String
the name of the attribute
attributeName
,
Object
the attribute value to store
attributeValue
)

Implements org.springframework.web.bind.support.SessionAttributeStore.storeAttribute.

Store the supplied attribute in the backend session.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeNamePrefixback to summary
private String attributeNamePrefix

Constructor Detail

DefaultSessionAttributeStoreback to summary
public DefaultSessionAttributeStore()

Method Detail

cleanupAttributeback to summary
public void cleanupAttribute(WebRequest request, String attributeName)

Implements org.springframework.web.bind.support.SessionAttributeStore.cleanupAttribute.

Doc from org.springframework.web.bind.support.SessionAttributeStore.cleanupAttribute.

Clean up the specified attribute in the backend session.

Indicates that the attribute name will not be used anymore.

Parameters
request:WebRequest

the current request

attributeName:String

the name of the attribute

Annotations
@Override
getAttributeNameInSessionback to summary
protected String getAttributeNameInSession(WebRequest request, String attributeName)

Calculate the attribute name in the backend session.

The default implementation simply prepends the configured "attributeNamePrefix", if any.

Parameters
request:WebRequest

the current request

attributeName:String

the name of the attribute

Returns:String

the attribute name in the backend session

retrieveAttributeback to summary
public Object retrieveAttribute(WebRequest request, String attributeName)

Implements org.springframework.web.bind.support.SessionAttributeStore.retrieveAttribute.

Doc from org.springframework.web.bind.support.SessionAttributeStore.retrieveAttribute.

Retrieve the specified attribute from the backend session.

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.

Parameters
request:WebRequest

the current request

attributeName:String

the name of the attribute

Returns:Object

the current attribute value, or null if none

Annotations
@Override
@Nullable
setAttributeNamePrefixback to summary
public void setAttributeNamePrefix(String attributeNamePrefix)

Specify a prefix to use for the attribute names in the backend session.

Default is to use no prefix, storing the session attributes with the same name as in the model.

storeAttributeback to summary
public void storeAttribute(WebRequest request, String attributeName, Object attributeValue)

Implements org.springframework.web.bind.support.SessionAttributeStore.storeAttribute.

Doc from org.springframework.web.bind.support.SessionAttributeStore.storeAttribute.

Store the supplied attribute in the backend session.

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.

Parameters
request:WebRequest

the current request

attributeName:String

the name of the attribute

attributeValue:Object

the attribute value to store

Annotations
@Override