Package org.apache.struts2.dispatcher

# Class RequestMap

java.lang.Object
java.util.AbstractMap<String,Object>
org.apache.struts2.dispatcher.RequestMap

All Implemented Interfaces:
  `Serializable`, `Map<String,Object>`

public class RequestMap extends AbstractMap<String,Object> implements Serializable
A simple implementation of the `Map` interface to handle a collection of request attributes.

See Also:
  - Serialized Form

- ## 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>`

  ## Nested classes/interfaces inherited from interface java.util.Map

  `Map.Entry<K extends Object,V extends Object>`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RequestMap(jakarta.servlet.http.HttpServletRequest request)`
  Saves the request to use as the backing for getting and setting values

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear()`
  Removes all attributes from the request as well as clears entries in this map.
  `Set<Map.Entry<String,Object>>`
  `entrySet()`
  Returns a Set of attributes from the http request.
  `Object`
  `get(Object key)`
  Returns the request attribute associated with the given key or `null` if it doesn't exist.
  `Object`
  `put(String key, Object value)`
  Saves an attribute in the request.
  `Object`
  `remove(Object key)`
  Removes the specified request attribute.

  ### Methods inherited from class java.util.AbstractMap

  `clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, toString, values`

  ### Methods inherited from class java.lang.Object

  `finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface java.util.Map

  `compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll`

- ## Constructor Details

  - ### RequestMap

    public RequestMap(jakarta.servlet.http.HttpServletRequest request)
    Saves the request to use as the backing for getting and setting values
    Parameters:
      `request` - the http servlet request.

- ## Method Details

  - ### clear

    public void clear()
    Removes all attributes from the request as well as clears entries in this map.
    Specified by:
      `clear` in interface `Map<String,Object>`
    Overrides:
      `clear` in class `AbstractMap<String,Object>`

  - ### entrySet

    public Set<Map.Entry<String,Object>> entrySet()
    Returns a Set of attributes from the http request.
    Specified by:
      `entrySet` in interface `Map<String,Object>`
    Specified by:
      `entrySet` in class `AbstractMap<String,Object>`
    Returns:
      a Set of attributes from the http request.

  - ### get

    public Object get(Object key)
    Returns the request attribute associated with the given key or `null` if it doesn't exist.
    Specified by:
      `get` in interface `Map<String,Object>`
    Overrides:
      `get` in class `AbstractMap<String,Object>`
    Parameters:
      `key` - the name of the request attribute.
    Returns:
      the request attribute or `null` if it doesn't exist.

  - ### put

    public Object put(String key, Object value)
    Saves an attribute in the request.
    Specified by:
      `put` in interface `Map<String,Object>`
    Overrides:
      `put` in class `AbstractMap<String,Object>`
    Parameters:
      `key` - the name of the request attribute.
      `value` - the value to set.
    Returns:
      the object that was just set.

  - ### remove

    public Object remove(Object key)
    Removes the specified request attribute.
    Specified by:
      `remove` in interface `Map<String,Object>`
    Overrides:
      `remove` in class `AbstractMap<String,Object>`
    Parameters:
      `key` - the name of the attribute to remove.
    Returns:
      the value that was removed or `null` if the value was not found (and hence, not removed).