Class AbstractFlashMapManager
java.lang.Object
com.aspectran.core.activity.support.AbstractFlashMapManager
- All Implemented Interfaces:
FlashMapManager
- Direct Known Subclasses:
SessionFlashMapManager
A base class for
FlashMapManager
implementations.- Since:
- 8.4.0
-
Field Summary
Fields inherited from interface com.aspectran.core.activity.FlashMapManager
FLASH_MAP_MANAGER_BEAN_ID
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
getFlashMapsMutex
(Translet translet) Obtain a mutex for modifying the FlashMap List as handled byretrieveFlashMaps(com.aspectran.core.activity.Translet)
andupdateFlashMaps(java.util.List<com.aspectran.core.activity.FlashMap>, com.aspectran.core.activity.Translet)
,int
Return the amount of time in seconds before a FlashMap expires.protected boolean
isFlashMapForRequest
(FlashMap flashMap, Translet translet) Whether the given FlashMap matches the current request.final FlashMap
retrieveAndUpdate
(Translet translet) Find a FlashMap saved by a previous request that matches to the current request, remove it from underlying storage, and also remove other expired FlashMap instances.retrieveFlashMaps
(Translet translet) Retrieve saved FlashMap instances from the underlying storage.final void
saveFlashMap
(Translet translet) Save the given FlashMap in some underlying storage and set the start of its expiration period.void
setFlashMapTimeout
(int flashMapTimeout) Set the amount of time in seconds after aFlashMap
is saved (at request completion) and before it expires.protected abstract void
updateFlashMaps
(List<FlashMap> flashMaps, Translet translet) Update the FlashMap instances in the underlying storage.
-
Constructor Details
-
AbstractFlashMapManager
public AbstractFlashMapManager()
-
-
Method Details
-
setFlashMapTimeout
public void setFlashMapTimeout(int flashMapTimeout) Set the amount of time in seconds after aFlashMap
is saved (at request completion) and before it expires.The default value is 180 seconds.
-
getFlashMapTimeout
public int getFlashMapTimeout()Return the amount of time in seconds before a FlashMap expires. -
retrieveAndUpdate
Description copied from interface:FlashMapManager
Find a FlashMap saved by a previous request that matches to the current request, remove it from underlying storage, and also remove other expired FlashMap instances.This method is invoked in the beginning of every request in contrast to
FlashMapManager.saveFlashMap(com.aspectran.core.activity.Translet)
, which is invoked only when there are flash attributes to be saved - i.e. before a redirect.- Specified by:
retrieveAndUpdate
in interfaceFlashMapManager
- Parameters:
translet
- the current translet- Returns:
- a FlashMap matching the current request or
null
-
isFlashMapForRequest
Whether the given FlashMap matches the current request. Uses the expected request path and query parameters saved in the FlashMap. -
saveFlashMap
Description copied from interface:FlashMapManager
Save the given FlashMap in some underlying storage and set the start of its expiration period.NOTE: Invoke this method prior to a redirect in order to allow saving the FlashMap in the HTTP session or in a response cookie before the response is committed.
- Specified by:
saveFlashMap
in interfaceFlashMapManager
- Parameters:
translet
- the current translet
-
retrieveFlashMaps
Retrieve saved FlashMap instances from the underlying storage.- Parameters:
translet
- the current translet- Returns:
- a List with FlashMap instances, or
null
if none found
-
updateFlashMaps
Update the FlashMap instances in the underlying storage.- Parameters:
flashMaps
- a (potentially empty) list of FlashMap instances to savetranslet
- the current translet
-
getFlashMapsMutex
Obtain a mutex for modifying the FlashMap List as handled byretrieveFlashMaps(com.aspectran.core.activity.Translet)
andupdateFlashMaps(java.util.List<com.aspectran.core.activity.FlashMap>, com.aspectran.core.activity.Translet)
,The default implementation returns a shared static mutex. Subclasses are encouraged to return a more specific mutex, or
null
to indicate that no synchronization is necessary.- Parameters:
translet
- the current translet- Returns:
- the mutex to use (may be
null
if none applicable) - Since:
- 4.0.3
-