Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts2.dispatcher
Class SessionMap

    java.lang.Object
      java.util.AbstractMap
          org.apache.struts2.dispatcher.SessionMap

All Implemented Interfaces:
  Serializable, Map

    public class SessionMap

extends AbstractMap
implements Serializable

A simple implementation of the `Map` interface to handle a collection of HTTP session attributes. The `entrySet()` method enumerates over all session attributes and creates a Set of entries. Note, this will occur lazily - only when the entry set is asked for.

See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from interface java.util.Map
`Map.Entry<K,V>`

Field Summary
`protected Set<Object>` | `entries`
`protected HttpServletRequest` | `request`
`private static long` | `serialVersionUID`
`protected HttpSession` | `session`

Constructor Summary
`SessionMap(HttpServletRequest request)` Creates a new session map given a http servlet request.

Method Summary
`void` | `clear()` Removes all attributes from the session as well as clears entries in this map.
`Set` | `entrySet()` Returns a Set of attributes from the http session.
`Object` | `get(Object key)` Returns the session attribute associated with the given key or `null` if it doesn't exist.
`void` | `invalidate()` Invalidate the http session.
`Object` | `put(Object key, Object value)` Saves an attribute in the session.
`Object` | `remove(Object key)` Removes the specified session 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`

Field Detail

### serialVersionUID

    private static final long serialVersionUID

See Also:
  Constant Field Values

### session

    protected HttpSession session

### entries

    protected Set<Object> entries

### request

    protected HttpServletRequest request

Constructor Detail

### SessionMap

    public SessionMap(HttpServletRequest request)

  Creates a new session map given a http servlet request. Note, ths enumeration of request attributes will occur when the map entries are asked for.

  Parameters:
    `request` - the http servlet request object.

Method Detail

### invalidate

    public void invalidate()

  Invalidate the http session.

### clear

    public void clear()

  Removes all attributes from the session as well as clears entries in this map.

  Specified by:
    `clear` in interface `Map`
  Overrides:
    `clear` in class `AbstractMap`

### entrySet

    public Set entrySet()

  Returns a Set of attributes from the http session.

  Specified by:
    `entrySet` in interface `Map`
  Specified by:
    `entrySet` in class `AbstractMap`
  Returns:
    a Set of attributes from the http session.

### get

    public Object get(Object key)

  Returns the session attribute associated with the given key or `null` if it doesn't exist.

  Specified by:
    `get` in interface `Map`
  Overrides:
    `get` in class `AbstractMap`
  Parameters:
    `key` - the name of the session attribute.
  Returns:
    the session attribute or `null` if it doesn't exist.

### put

    public Object put(Object key,
                      Object value)

  Saves an attribute in the session.

  Specified by:
    `put` in interface `Map`
  Overrides:
    `put` in class `AbstractMap`
  Parameters:
    `key` - the name of the session attribute.
    `value` - the value to set.
  Returns:
    the object that was just set.

### remove

    public Object remove(Object key)

  Removes the specified session attribute.

  Specified by:
    `remove` in interface `Map`
  Overrides:
    `remove` in class `AbstractMap`
  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).

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.