|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.servlet.support.DefaultFlashMapManager
public class DefaultFlashMapManager
A default FlashMapManager
implementation that stores FlashMap
instances in the HTTP session.
Field Summary | |
---|---|
private static java.lang.String |
FLASH_MAPS_SESSION_ATTRIBUTE
|
private int |
flashTimeout
|
private static Log |
logger
|
private UrlPathHelper |
urlPathHelper
|
Fields inherited from interface org.springframework.web.servlet.FlashMapManager |
---|
INPUT_FLASH_MAP_ATTRIBUTE, OUTPUT_FLASH_MAP_ATTRIBUTE |
Constructor Summary | |
---|---|
DefaultFlashMapManager()
|
Method Summary | |
---|---|
private java.lang.String |
decodeAndNormalizePath(java.lang.String path,
HttpServletRequest request)
|
protected boolean |
isFlashMapForRequest(FlashMap flashMap,
HttpServletRequest request)
Whether the given FlashMap matches the current request. |
private FlashMap |
lookupFlashMap(HttpServletRequest request)
Find the "input" FlashMap for the current request target by matching it to the target request information of all stored FlashMap instances. |
protected void |
onSaveFlashMap(FlashMap flashMap,
HttpServletRequest request)
Update a FlashMap before it is stored in the HTTP Session. |
private void |
removeExpiredFlashMaps(HttpServletRequest request)
Iterate all flash maps and remove expired ones. |
void |
requestCompleted(HttpServletRequest request)
Start the expiration period of the "output" FlashMap save it in the underlying storage. |
void |
requestStarted(HttpServletRequest request)
Perform the following tasks unless the FlashMapManager.OUTPUT_FLASH_MAP_ATTRIBUTE
request attribute exists:
Find the "input" FlashMap, expose it under the request attribute
FlashMapManager.INPUT_FLASH_MAP_ATTRIBUTE , and remove it from underlying storage. |
protected java.util.List<FlashMap> |
retrieveFlashMaps(HttpServletRequest request,
boolean allowCreate)
Retrieve all FlashMap instances from the current HTTP session. |
void |
setFlashMapTimeout(int flashTimeout)
Set the amount of time in seconds after a FlashMap is saved
(at request completion) and before it expires. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String FLASH_MAPS_SESSION_ATTRIBUTE
private static final Log logger
private int flashTimeout
private final UrlPathHelper urlPathHelper
Constructor Detail |
---|
public DefaultFlashMapManager()
Method Detail |
---|
public void setFlashMapTimeout(int flashTimeout)
FlashMap
is saved
(at request completion) and before it expires.
The default value is 180 seconds.
public void requestStarted(HttpServletRequest request)
FlashMapManager.OUTPUT_FLASH_MAP_ATTRIBUTE
request attribute exists:
FlashMapManager.INPUT_FLASH_MAP_ATTRIBUTE
, and remove it from underlying storage.
FlashMapManager.OUTPUT_FLASH_MAP_ATTRIBUTE
.
An HTTP session is never created by this method.
requestStarted
in interface FlashMapManager
request
- the current requestprivate FlashMap lookupFlashMap(HttpServletRequest request)
null
protected boolean isFlashMapForRequest(FlashMap flashMap, HttpServletRequest request)
protected java.util.List<FlashMap> retrieveFlashMaps(HttpServletRequest request, boolean allowCreate)
allowCreate
is "true" and no flash maps exist yet, a new list
is created and stored as a session attribute.
request
- the current requestallowCreate
- whether to create the session if necessary
null
assuming allowCreate
is "false".private void removeExpiredFlashMaps(HttpServletRequest request)
public void requestCompleted(HttpServletRequest request)
The "output" FlashMap should not be saved if it is empty or if it was not created by the current FlashMapManager instance.
An HTTP session is never created if the "output" FlashMap is empty.
requestCompleted
in interface FlashMapManager
request
- the current requestprotected void onSaveFlashMap(FlashMap flashMap, HttpServletRequest request)
The default implementation starts the expiration period and ensures the target request path is decoded and normalized if it is relative.
flashMap
- the flash map to be savedrequest
- the current requestprivate java.lang.String decodeAndNormalizePath(java.lang.String path, HttpServletRequest request)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |