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.
FlashMapManager
| Modifier and Type | Field and Description |
|---|---|
| private long | |
| private final MultiValueMap | |
| private String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public FlashMap | addTargetRequestParam(String
the expected parameter name (skipped if empty) name, String the expected value (skipped if empty) value)Provide a request parameter identifying the request for this FlashMap. |
| public FlashMap | addTargetRequestParams(MultiValueMap<String, String>
a Map with the names and values of expected parameters params)Provide request parameters identifying the request for this FlashMap. |
| public int | compareTo(FlashMap
the object to be compared. other)Implements java. Compare two FlashMaps and prefer the one that specifies a target URL path or has more target URL parameters. |
| public boolean | equals(Object
object to be compared for equality with this map other)Overrides java. Implements java. Compares the specified object with this map for equality. |
| public long | getExpirationTime()
Return the expiration time for the FlashMap or -1 if the expiration period has not started. |
| public MultiValueMap | |
| public String | |
| public int | hashCode()
Overrides java. Implements java. Returns the hash code value for this map. |
| public boolean | isExpired()
Return whether this instance has expired depending on the amount of
elapsed time since the call to |
| public void | |
| public void | setTargetRequestPath(String path)
Provide a URL path to help identify the target request for this FlashMap. |
| public void | startExpirationPeriod(int
the number of seconds before expiration timeToLive)Start the expiration period for this instance. |
| public String |
| expirationTime | back to summary |
|---|---|
| private long expirationTime | |
| targetRequestParams | back to summary |
|---|---|
| private final MultiValueMap<String, String> targetRequestParams | |
| targetRequestPath | back to summary |
|---|---|
| private String targetRequestPath
| |
| FlashMap | back to summary |
|---|---|
| public FlashMap() | |
| addTargetRequestParam | back to summary |
|---|---|
| public FlashMap addTargetRequestParam(String name, String value) Provide a request parameter identifying the request for this FlashMap. | |
| addTargetRequestParams | back to summary |
|---|---|
| public FlashMap addTargetRequestParams(MultiValueMap<String, String> params) Provide request parameters identifying the request for this FlashMap.
| |
| compareTo | back to summary |
|---|---|
| public int compareTo(FlashMap other) Implements java. Compare 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.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Implements java. Doc from java. Compares the specified object with this map for equality. Returns
| |
| getExpirationTime | back to summary |
|---|---|
| public long getExpirationTime() Return the expiration time for the FlashMap or -1 if the expiration period has not started.
| |
| getTargetRequestParams | back to summary |
|---|---|
| public MultiValueMap Return the parameters identifying the target request, or an empty map. | |
| getTargetRequestPath | back to summary |
|---|---|
| public String getTargetRequestPath() Return the target URL path (or
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Implements java. Doc from java. Returns the hash code value for this map. The hash code of a map is
defined to be the sum of the hash codes of each entry in the map's
| |
| isExpired | back to summary |
|---|---|
| public boolean isExpired() Return whether this instance has expired depending on the amount of
elapsed time since the call to | |
| setExpirationTime | back to summary |
|---|---|
| public void setExpirationTime(long expirationTime) Set the expiration time for the FlashMap. This is provided for serialization
purposes but can also be used instead
| |
| setTargetRequestPath | back to summary |
|---|---|
| public void setTargetRequestPath(String path) Provide a URL path to help identify the target request for this FlashMap. The path may be absolute (e.g. "/application/resource") or relative to the current request (e.g. "../resource"). | |
| startExpirationPeriod | back to summary |
|---|---|
| public void startExpirationPeriod(int timeToLive) Start the expiration period for this instance.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of this map. The string representation
consists of a list of key-value mappings in the order returned by the
map's | |