extends
AbstractMap
<K,V>
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
SessionMap
public SessionMap(javax.servlet.http.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.
clear
public void clear()
Removes all attributes from the session as well as clears entries in this
Specified by:
clear
in interface
Map
<
K
,
V
>
Overrides:
clear
in class
AbstractMap
<
K
,
V
>
entrySet
public Set<Map.Entry<K,V>> entrySet()
Returns a Set of attributes from the http session.
Specified by:
entrySet
in interface
Map
<
K
,
V
>
Specified by:
entrySet
in class
AbstractMap
<
K
,
V
>
Returns:
a Set of attributes from the http session.
public V 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
<
K
,
V
>
Overrides:
get
in class
AbstractMap
<
K
,
V
>
Parameters:
key
- the name of the session attribute.
Returns:
the session attribute or
null
if it doesn't exist.
containsKey
public boolean containsKey(Object key)
Checks if the specified session attribute with the given key exists.
Specified by:
containsKey
in interface
Map
<
K
,
V
>
Overrides:
containsKey
in class
AbstractMap
<
K
,
V
>
Parameters:
key
- the name of the session attribute.
Returns:
true
if the session attribute exits or
false
if it doesn't exist.