Package org.apache.struts2.dispatcher
Class SessionMap
- All Implemented Interfaces:
- Serializable,- Map<String,- Object> 
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:
- 
Nested Class SummaryNested classes/interfaces inherited from class java.util.AbstractMapAbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> 
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionSessionMap(jakarta.servlet.http.HttpServletRequest request) Creates a new session map given a http servlet request.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclear()Removes all attributes from the session as well as clears entries in this map.booleancontainsKey(Object key) Checks if the specified session attribute with the given key exists.entrySet()Returns a Set of attributes from the http session.Returns the session attribute associated with the given key or null if it doesn't exist.voidInvalidate the http session.Saves an attribute in the session.Removes the specified session attribute.Methods inherited from class java.util.AbstractMapclone, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, toString, valuesMethods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Mapcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
- 
Field Details- 
sessionprotected jakarta.servlet.http.HttpSession session
- 
entries
- 
requestprotected jakarta.servlet.http.HttpServletRequest request
 
- 
- 
Constructor Details- 
SessionMappublic SessionMap(jakarta.servlet.http.HttpServletRequest request) Creates a new session map given a http servlet request. Note, the enumeration of request attributes will occur when the map entries are asked for.- Parameters:
- request- the http servlet request object.
 
 
- 
- 
Method Details- 
invalidatepublic void invalidate()Invalidate the http session.
- 
clearpublic void clear()Removes all attributes from the session as well as clears entries in this map.
- 
entrySetReturns a Set of attributes from the http session.
- 
getReturns the session attribute associated with the given key or null if it doesn't exist. Note: Must use the same signature asAbstractMap.get(java.lang.Object)to ensure the expected specialized behaviour is performed here (and not the generic ancestor behaviour).
- 
putSaves an attribute in the session.
- 
removeRemoves the specified session attribute. Note: Must use the same signature asAbstractMap.remove(java.lang.Object)to ensure the expected specialized behaviour is performed here (and not the generic ancestor behaviour).
- 
containsKeyChecks if the specified session attribute with the given key exists. Note: Must use the same signature asAbstractMap.containsKey(java.lang.Object)to ensure the expected specialized behaviour is performed here (and not the generic ancestor behaviour).- Specified by:
- containsKeyin interface- Map<String,- Object> 
- Overrides:
- containsKeyin class- AbstractMap<String,- Object> 
- Parameters:
- key- the name of the session attribute.
- Returns:
- true if the session attribute exits or false if it doesn't exist.
 
 
-