Class AbstractFlashMapManager
java.lang.Object
org.springframework.web.servlet.support.AbstractFlashMapManager
- All Implemented Interfaces:
- FlashMapManager
- Direct Known Subclasses:
- SessionFlashMapManager
A base class for 
FlashMapManager implementations.- Since:
- 3.1.1
- Author:
- Rossen Stoyanchev, Juergen Hoeller, Sam Brannen
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptiongetFlashMapsMutex(jakarta.servlet.http.HttpServletRequest request) Obtain a mutex for modifying the FlashMap List as handled byretrieveFlashMaps(HttpServletRequest)andupdateFlashMaps(List, HttpServletRequest, HttpServletResponse),intReturn the amount of time in seconds before a FlashMap expires.Deprecated, for removal: This API element is subject to removal in a future version.protected booleanisFlashMapForRequest(FlashMap flashMap, jakarta.servlet.http.HttpServletRequest request) Whether the given FlashMap matches the current request.retrieveAndUpdate(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) 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(jakarta.servlet.http.HttpServletRequest request) Retrieve saved FlashMap instances from the underlying storage.final voidsaveOutputFlashMap(FlashMap flashMap, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Save the given FlashMap, in some underlying storage and set the start of its expiration period.voidsetFlashMapTimeout(int flashMapTimeout) Set the amount of time in seconds after aFlashMapis saved (at request completion) and before it expires.voidsetUrlPathHelper(UrlPathHelper urlPathHelper) Deprecated, for removal: This API element is subject to removal in a future version.use ofPathMatcherandUrlPathHelperis deprecated for use at runtime in web modules in favor of parsed patterns withPathPatternParser.protected abstract voidupdateFlashMaps(List<FlashMap> flashMaps, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Update the FlashMap instances in the underlying storage.
- 
Field Details- 
loggerprotected final org.apache.commons.logging.Log logger
 
- 
- 
Constructor Details- 
AbstractFlashMapManagerpublic AbstractFlashMapManager()
 
- 
- 
Method Details- 
setFlashMapTimeoutpublic void setFlashMapTimeout(int flashMapTimeout) Set the amount of time in seconds after aFlashMapis saved (at request completion) and before it expires.The default value is 180 seconds. 
- 
getFlashMapTimeoutpublic int getFlashMapTimeout()Return the amount of time in seconds before a FlashMap expires.
- 
setUrlPathHelperDeprecated, for removal: This API element is subject to removal in a future version.use ofPathMatcherandUrlPathHelperis deprecated for use at runtime in web modules in favor of parsed patterns withPathPatternParser.Set the UrlPathHelper to use to match FlashMap instances to requests.
- 
getUrlPathHelperDeprecated, for removal: This API element is subject to removal in a future version.use ofPathMatcherandUrlPathHelperis deprecated for use at runtime in web modules in favor of parsed patterns withPathPatternParser.Return the UrlPathHelper implementation to use.
- 
retrieveAndUpdatepublic final @Nullable FlashMap retrieveAndUpdate(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Description copied from interface:FlashMapManagerFind 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.saveOutputFlashMap(FlashMap, HttpServletRequest, HttpServletResponse), which is invoked only when there are flash attributes to be saved - i.e. before a redirect.- Specified by:
- retrieveAndUpdatein interface- FlashMapManager
- Parameters:
- request- the current request
- response- the current response
- Returns:
- a FlashMap matching the current request or null
 
- 
isFlashMapForRequestprotected boolean isFlashMapForRequest(FlashMap flashMap, jakarta.servlet.http.HttpServletRequest request) Whether the given FlashMap matches the current request. Uses the expected request path and query parameters saved in the FlashMap.
- 
saveOutputFlashMappublic final void saveOutputFlashMap(FlashMap flashMap, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Description copied from interface:FlashMapManagerSave 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:
- saveOutputFlashMapin interface- FlashMapManager
- Parameters:
- flashMap- the FlashMap to save
- request- the current request
- response- the current response
 
- 
retrieveFlashMaps
- 
updateFlashMapsprotected abstract void updateFlashMaps(List<FlashMap> flashMaps, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Update the FlashMap instances in the underlying storage.- Parameters:
- flashMaps- a (potentially empty) list of FlashMap instances to save
- request- the current request
- response- the current response
 
- 
getFlashMapsMutexObtain a mutex for modifying the FlashMap List as handled byretrieveFlashMaps(HttpServletRequest)andupdateFlashMaps(List, HttpServletRequest, HttpServletResponse),The default implementation returns a shared static mutex. Subclasses are encouraged to return a more specific mutex, or nullto indicate that no synchronization is necessary.- Parameters:
- request- the current request
- Returns:
- the mutex to use (may be nullif none applicable)
- Since:
- 4.0.3
 
 
- 
PathMatcherandUrlPathHelperis deprecated for use at runtime in web modules in favor of parsed patterns withPathPatternParser.