|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.web.method.annotation.SessionAttributesHandler
public class SessionAttributesHandler
Manages controller-specific session attributes declared via
@SessionAttributes. Actual storage is
performed via SessionAttributeStore.
When a controller annotated with @SessionAttributes adds
attributes to its model, those attributes are checked against names and
types specified via @SessionAttributes. Matching model attributes
are saved in the HTTP session and remain there until the controller calls
SessionStatus.setComplete().
| Constructor Summary | |
|---|---|
SessionAttributesHandler(Class<?> handlerType,
SessionAttributeStore sessionAttributeStore)
Creates a new instance for a controller type. |
|
| Method Summary | |
|---|---|
void |
cleanupAttributes(WebRequest request)
Cleans "known" attributes from the session - i.e. |
boolean |
hasSessionAttributes()
Whether the controller represented by this instance has declared session attribute names or types of interest via SessionAttributes. |
boolean |
isHandlerSessionAttribute(String attributeName,
Class<?> attributeType)
Whether the attribute name and/or type match those specified in the controller's @SessionAttributes annotation. |
Map<String,Object> |
retrieveAttributes(WebRequest request)
Retrieve "known" attributes from the session -- i.e. |
void |
storeAttributes(WebRequest request,
Map<String,?> attributes)
Stores a subset of the given attributes in the session. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SessionAttributesHandler(Class<?> handlerType,
SessionAttributeStore sessionAttributeStore)
@SessionAttributes if found.
handlerType - the controller typesessionAttributeStore - used for session access| Method Detail |
|---|
public boolean hasSessionAttributes()
SessionAttributes.
public boolean isHandlerSessionAttribute(String attributeName,
Class<?> attributeType)
@SessionAttributes annotation.
Attributes successfully resolved through this method are "remembered"
and used in retrieveAttributes(WebRequest) and
cleanupAttributes(WebRequest). In other words, retrieval and
cleanup only affect attributes previously resolved through here.
attributeName - the attribute name to check; must not be nullattributeType - the type for the attribute; or null
public void storeAttributes(WebRequest request,
Map<String,?> attributes)
@SessionAttributes are ignored.
request - the current requestattributes - candidate attributes for session storagepublic Map<String,Object> retrieveAttributes(WebRequest request)
@SessionAttributes and previously stored in the in the model
at least once.
request - the current request
public void cleanupAttributes(WebRequest request)
@SessionAttributes and previously stored in the in the model
at least once.
request - the current request
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||