Class RedirectAttributesModelMap
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<String,Object>
org.springframework.ui.ModelMap
org.springframework.web.servlet.mvc.support.RedirectAttributesModelMap
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,
,Object> org.springframework.ui.Model
,RedirectAttributes
public class RedirectAttributesModelMap
extends org.springframework.ui.ModelMap
implements RedirectAttributes
A
ModelMap
implementation of RedirectAttributes
that formats
values as Strings using a DataBinder
. Also provides a place to store
flash attributes so they can survive a redirect without the need to be
embedded in the redirect URL.- Since:
- 3.1
- Author:
- Rossen Stoyanchev
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
ConstructorDescriptionDefault constructor without a DataBinder.RedirectAttributesModelMap
(org.springframework.validation.DataBinder dataBinder) Constructor with a DataBinder. -
Method Summary
Modifier and TypeMethodDescriptionaddAllAttributes
(Collection<?> attributeValues) addAllAttributes
(Map<String, ?> attributes) addAttribute
(Object attributeValue) addAttribute
(String attributeName, Object attributeValue) addFlashAttribute
(Object attributeValue) Add the given flash storage using agenerated name
.addFlashAttribute
(String attributeName, Object attributeValue) Add the given flash attribute.asMap()
Return the attributes candidate for flash storage or an empty Map.mergeAttributes
(Map<String, ?> attributes) void
Methods inherited from class org.springframework.ui.ModelMap
containsAttribute, getAttribute
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putIfAbsent, remove, remove, replace, replace, size
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, putIfAbsent, remove, remove, replace, replace, size
Methods inherited from interface org.springframework.ui.Model
containsAttribute, getAttribute
-
Constructor Details
-
RedirectAttributesModelMap
public RedirectAttributesModelMap()Default constructor without a DataBinder. Attribute values are converted to String viaAbstractMap.toString()
. -
RedirectAttributesModelMap
public RedirectAttributesModelMap(@Nullable org.springframework.validation.DataBinder dataBinder) Constructor with a DataBinder.- Parameters:
dataBinder
- used to format attribute values as Strings
-
-
Method Details
-
getFlashAttributes
Return the attributes candidate for flash storage or an empty Map.- Specified by:
getFlashAttributes
in interfaceRedirectAttributes
-
addAttribute
public RedirectAttributesModelMap addAttribute(String attributeName, @Nullable Object attributeValue) Formats the attribute value as a String before adding it.
- Specified by:
addAttribute
in interfaceorg.springframework.ui.Model
- Specified by:
addAttribute
in interfaceRedirectAttributes
- Overrides:
addAttribute
in classorg.springframework.ui.ModelMap
-
addAttribute
Formats the attribute value as a String before adding it.
- Specified by:
addAttribute
in interfaceorg.springframework.ui.Model
- Specified by:
addAttribute
in interfaceRedirectAttributes
- Overrides:
addAttribute
in classorg.springframework.ui.ModelMap
-
addAllAttributes
Each attribute value is formatted as a String before being added.
- Specified by:
addAllAttributes
in interfaceorg.springframework.ui.Model
- Specified by:
addAllAttributes
in interfaceRedirectAttributes
- Overrides:
addAllAttributes
in classorg.springframework.ui.ModelMap
-
addAllAttributes
Each attribute value is formatted as a String before being added.
- Specified by:
addAllAttributes
in interfaceorg.springframework.ui.Model
- Overrides:
addAllAttributes
in classorg.springframework.ui.ModelMap
-
mergeAttributes
Each attribute value is formatted as a String before being merged.
- Specified by:
mergeAttributes
in interfaceorg.springframework.ui.Model
- Specified by:
mergeAttributes
in interfaceRedirectAttributes
- Overrides:
mergeAttributes
in classorg.springframework.ui.ModelMap
-
asMap
- Specified by:
asMap
in interfaceorg.springframework.ui.Model
-
put
The value is formatted as a String before being added.
-
putAll
Each value is formatted as a String before being added.
-
addFlashAttribute
Description copied from interface:RedirectAttributes
Add the given flash attribute.- Specified by:
addFlashAttribute
in interfaceRedirectAttributes
- Parameters:
attributeName
- the attribute name; nevernull
attributeValue
- the attribute value; may benull
-
addFlashAttribute
Description copied from interface:RedirectAttributes
Add the given flash storage using agenerated name
.- Specified by:
addFlashAttribute
in interfaceRedirectAttributes
- Parameters:
attributeValue
- the flash attribute value; nevernull
-