public class HttpSessionManager
extends java.util.HashMap
implements javax.servlet.http.HttpSessionBindingListener
Handles http session attributes. These are used to maintain a record of session parameters such as the user login name, the password, if the login was successful and variables related to a statefull session
| Constructor and Description |
|---|
HttpSessionManager() |
| Modifier and Type | Method and Description |
|---|---|
static HttpSessionManager |
getUserInfo(javax.servlet.http.HttpServletRequest request)
This gets the session information related to this session from the HTTP Session.
|
static void |
putUserInfo(javax.servlet.http.HttpServletRequest request,
HttpSessionManager userInfo)
This stores the user information back into the http session.
|
static java.lang.Object |
retrieve(javax.servlet.http.HttpServletRequest request,
java.lang.String key)
retrieve an entry from the Hashmap and return it to the user
|
static void |
store(javax.servlet.http.HttpServletRequest request,
java.lang.String key,
java.lang.Object value)
store an entry into the Hashmap and update it back into the session
|
java.lang.String |
toString()
This will return an xml list of all entries in the hashmap
|
void |
valueBound(javax.servlet.http.HttpSessionBindingEvent event) |
void |
valueUnbound(javax.servlet.http.HttpSessionBindingEvent event) |
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuespublic void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
valueBound in interface javax.servlet.http.HttpSessionBindingListenerThis gets called when we setAttribute(this) to the session.
public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
valueUnbound in interface javax.servlet.http.HttpSessionBindingListenerThis gets called when the session unbinds this object. Usually when the session is closed or another setAttribute call is made.
public static void store(javax.servlet.http.HttpServletRequest request,
java.lang.String key,
java.lang.Object value)
request - this is where we store our session variableskey - this is the HashMap Key indentifiervalue - this is the Key valuepublic static java.lang.Object retrieve(javax.servlet.http.HttpServletRequest request,
java.lang.String key)
request - this is where we store our session variableskey - this is the HashMap Key indentifierpublic static HttpSessionManager getUserInfo(javax.servlet.http.HttpServletRequest request)
public static void putUserInfo(javax.servlet.http.HttpServletRequest request,
HttpSessionManager userInfo)
request - the HttpServletRequest that contains our
HttpSessionManager with the HashMap informationuserInfo - is the HttpSessionManager we want stored in the http session.public java.lang.String toString()
toString in class java.util.AbstractMap