Class FlashMap
- All Implemented Interfaces:
- Serializable,- Cloneable,- Comparable<FlashMap>,- Map<String,- Object> 
A FlashMap can be set up with a request path and request parameters to
 help identify the target request. Without this information, a FlashMap is
 made available to the next request, which may or may not be the intended
 recipient. On a redirect, the target URL is known and a FlashMap can be
 updated with that information. This is done automatically when the
 org.springframework.web.servlet.view.RedirectView is used.
 
Note: annotated controllers will usually not use FlashMap directly.
 See org.springframework.web.servlet.mvc.support.RedirectAttributes
 for an overview of using flash attributes in annotated controllers.
- Since:
- 3.1
- Author:
- Rossen Stoyanchev
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class java.util.AbstractMapAbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> 
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaddTargetRequestParam(String name, String value) Provide a request parameter identifying the request for this FlashMap.addTargetRequestParams(MultiValueMap<String, String> params) Provide request parameters identifying the request for this FlashMap.intCompare two FlashMaps and prefer the one that specifies a target URL path or has more target URL parameters.booleanlongReturn the expiration time for the FlashMap or -1 if the expiration period has not started.Return the parameters identifying the target request, or an empty map.Return the target URL path (ornullif none specified).inthashCode()booleanReturn whether this instance has expired depending on the amount of elapsed time since the call tostartExpirationPeriod(int).voidsetExpirationTime(long expirationTime) Set the expiration time for the FlashMap.voidsetTargetRequestPath(String path) Provide a URL path to help identify the target request for this FlashMap.voidstartExpirationPeriod(int timeToLive) Start the expiration period for this instance.toString()Methods inherited from class java.util.HashMapclear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
- 
Constructor Details- 
FlashMappublic FlashMap()
 
- 
- 
Method Details- 
setTargetRequestPathProvide a URL path to help identify the target request for this FlashMap.The path may be absolute (for example, "/application/resource") or relative to the current request (for example, "../resource"). 
- 
getTargetRequestPathReturn the target URL path (ornullif none specified).
- 
addTargetRequestParamsProvide request parameters identifying the request for this FlashMap.- Parameters:
- params- a Map with the names and values of expected parameters
 
- 
addTargetRequestParamProvide a request parameter identifying the request for this FlashMap.- Parameters:
- name- the expected parameter name (skipped if empty)
- value- the expected value (skipped if empty)
 
- 
getTargetRequestParamsReturn the parameters identifying the target request, or an empty map.
- 
startExpirationPeriodpublic void startExpirationPeriod(int timeToLive) Start the expiration period for this instance.- Parameters:
- timeToLive- the number of seconds before expiration
 
- 
setExpirationTimepublic void setExpirationTime(long expirationTime) Set the expiration time for the FlashMap. This is provided for serialization purposes but can also be used insteadstartExpirationPeriod(int).- Since:
- 4.2
 
- 
getExpirationTimepublic long getExpirationTime()Return the expiration time for the FlashMap or -1 if the expiration period has not started.- Since:
- 4.2
 
- 
isExpiredpublic boolean isExpired()Return whether this instance has expired depending on the amount of elapsed time since the call tostartExpirationPeriod(int).
- 
compareToCompare two FlashMaps and prefer the one that specifies a target URL path or has more target URL parameters. Before comparing FlashMap instances ensure that they match a given request.- Specified by:
- compareToin interface- Comparable<FlashMap>
 
- 
equals
- 
hashCodepublic int hashCode()
- 
toString- Overrides:
- toStringin class- AbstractMap<String,- Object> 
 
 
-