org.apache.click.util
Class SessionMap
java.lang.Object
org.apache.click.util.SessionMap
- All Implemented Interfaces:
- Map<String,Object>
public class SessionMap
- extends Object
- implements Map<String,Object>
Provides a Map adaptor for HttpSession objects. A SessionMap instance is
available in each Velocity page using the name "session".
For example suppose we have a User object in the session with the
attribute name "user" when a user is logged on. We can display the users
name in the page when the are logged onto the system.
#if ($session.user)
$session.user.fullname you are logged on.
#else
You are not logged on.
#end
The ClickServlet adds a SessionMap instance to the Velocity Context before
it is merged with the page template.
The SessionMap supports FlashAttribute
which when accessed via
get(Object)
are removed from the session.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
session
protected HttpSession session
- The internal session attribute.
SessionMap
public SessionMap(HttpSession value)
- Create a HttpSession Map adaptor.
- Parameters:
value
- the http session
size
public int size()
- Specified by:
size
in interface Map<String,Object>
- See Also:
Map.size()
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface Map<String,Object>
- See Also:
Map.isEmpty()
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interface Map<String,Object>
- See Also:
Map.containsKey(Object)
containsValue
public boolean containsValue(Object value)
- This method is not supported and will throw
UnsupportedOperationException if invoked.
- Specified by:
containsValue
in interface Map<String,Object>
- See Also:
Map.containsValue(Object)
get
public Object get(Object key)
- If the stored object is a FlashObject this method will return the
FlashObject value and then remove it from the session.
- Specified by:
get
in interface Map<String,Object>
- See Also:
Map.get(Object)
put
public Object put(String key,
Object value)
- Specified by:
put
in interface Map<String,Object>
- See Also:
Map.put(Object, Object)
remove
public Object remove(Object key)
- Specified by:
remove
in interface Map<String,Object>
- See Also:
Map.remove(Object)
putAll
public void putAll(Map<? extends String,?> map)
- Specified by:
putAll
in interface Map<String,Object>
- See Also:
Map.putAll(Map)
clear
public void clear()
- Specified by:
clear
in interface Map<String,Object>
- See Also:
Map.clear()
keySet
public Set<String> keySet()
- Specified by:
keySet
in interface Map<String,Object>
- See Also:
Map.keySet()
values
public Collection<Object> values()
- Specified by:
values
in interface Map<String,Object>
- See Also:
Map.values()
entrySet
public Set<Map.Entry<String,Object>> entrySet()
- Specified by:
entrySet
in interface Map<String,Object>
- See Also:
Map.entrySet()