public class RedirectAttributesModelMap extends org.springframework.ui.ModelMap implements RedirectAttributes
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.Constructor and Description |
---|
RedirectAttributesModelMap()
Default constructor without a DataBinder.
|
RedirectAttributesModelMap(org.springframework.validation.DataBinder dataBinder)
Constructor with a DataBinder.
|
Modifier and Type | Method and Description |
---|---|
RedirectAttributesModelMap |
addAllAttributes(java.util.Collection<?> attributeValues) |
RedirectAttributesModelMap |
addAllAttributes(java.util.Map<java.lang.String,?> attributes) |
RedirectAttributesModelMap |
addAttribute(java.lang.Object attributeValue) |
RedirectAttributesModelMap |
addAttribute(java.lang.String attributeName,
java.lang.Object attributeValue) |
RedirectAttributes |
addFlashAttribute(java.lang.Object attributeValue)
Add the given flash storage using a
generated name . |
RedirectAttributes |
addFlashAttribute(java.lang.String attributeName,
java.lang.Object attributeValue)
Add the given flash attribute.
|
java.util.Map<java.lang.String,java.lang.Object> |
asMap() |
java.util.Map<java.lang.String,?> |
getFlashAttributes()
Return the attributes candidate for flash storage or an empty Map.
|
RedirectAttributesModelMap |
mergeAttributes(java.util.Map<java.lang.String,?> attributes) |
java.lang.Object |
put(java.lang.String key,
java.lang.Object value) |
void |
putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> map) |
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putIfAbsent, remove, remove, replace, replace, size
public RedirectAttributesModelMap()
AbstractMap.toString()
.public RedirectAttributesModelMap(@Nullable org.springframework.validation.DataBinder dataBinder)
dataBinder
- used to format attribute values as Stringspublic java.util.Map<java.lang.String,?> getFlashAttributes()
getFlashAttributes
in interface RedirectAttributes
public RedirectAttributesModelMap addAttribute(java.lang.String attributeName, @Nullable java.lang.Object attributeValue)
Formats the attribute value as a String before adding it.
addAttribute
in interface org.springframework.ui.Model
addAttribute
in interface RedirectAttributes
addAttribute
in class org.springframework.ui.ModelMap
public RedirectAttributesModelMap addAttribute(java.lang.Object attributeValue)
Formats the attribute value as a String before adding it.
addAttribute
in interface org.springframework.ui.Model
addAttribute
in interface RedirectAttributes
addAttribute
in class org.springframework.ui.ModelMap
public RedirectAttributesModelMap addAllAttributes(@Nullable java.util.Collection<?> attributeValues)
Each attribute value is formatted as a String before being added.
addAllAttributes
in interface org.springframework.ui.Model
addAllAttributes
in interface RedirectAttributes
addAllAttributes
in class org.springframework.ui.ModelMap
public RedirectAttributesModelMap addAllAttributes(@Nullable java.util.Map<java.lang.String,?> attributes)
Each attribute value is formatted as a String before being added.
addAllAttributes
in interface org.springframework.ui.Model
addAllAttributes
in class org.springframework.ui.ModelMap
public RedirectAttributesModelMap mergeAttributes(@Nullable java.util.Map<java.lang.String,?> attributes)
Each attribute value is formatted as a String before being merged.
mergeAttributes
in interface org.springframework.ui.Model
mergeAttributes
in interface RedirectAttributes
mergeAttributes
in class org.springframework.ui.ModelMap
public java.util.Map<java.lang.String,java.lang.Object> asMap()
asMap
in interface org.springframework.ui.Model
public java.lang.Object put(java.lang.String key, @Nullable java.lang.Object value)
The value is formatted as a String before being added.
put
in interface java.util.Map<java.lang.String,java.lang.Object>
put
in class java.util.HashMap<java.lang.String,java.lang.Object>
public void putAll(@Nullable java.util.Map<? extends java.lang.String,? extends java.lang.Object> map)
Each value is formatted as a String before being added.
putAll
in interface java.util.Map<java.lang.String,java.lang.Object>
putAll
in class java.util.HashMap<java.lang.String,java.lang.Object>
public RedirectAttributes addFlashAttribute(java.lang.String attributeName, @Nullable java.lang.Object attributeValue)
RedirectAttributes
addFlashAttribute
in interface RedirectAttributes
attributeName
- the attribute name; never null
attributeValue
- the attribute value; may be null
public RedirectAttributes addFlashAttribute(java.lang.Object attributeValue)
RedirectAttributes
generated name
.addFlashAttribute
in interface RedirectAttributes
attributeValue
- the flash attribute value; never null