public abstract class SessionUtils
extends java.lang.Object
Constructor and Description |
---|
SessionUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
get(javax.servlet.http.HttpServletRequest req,
java.lang.String name)
Get the attribute with the given name from the request session.
|
protected static javax.servlet.http.HttpSession |
getSession(javax.servlet.http.HttpServletRequest req)
Extracts the HttpSession from the given request.
|
static java.lang.Object |
remove(javax.servlet.http.HttpServletRequest req,
java.lang.String name)
Same as
get(HttpServletRequest, String) but it also removes the value from the request session. |
static void |
set(javax.servlet.http.HttpServletRequest req,
java.lang.String name,
java.lang.Object value)
Set's the attribute value to the request session.
|
protected static javax.servlet.http.HttpSession getSession(javax.servlet.http.HttpServletRequest req)
req
- a valid request to get the session frompublic static void set(javax.servlet.http.HttpServletRequest req, java.lang.String name, java.lang.Object value)
req
- a valid request to get the session fromname
- the name of the attributevalue
- the value to setpublic static java.lang.Object get(javax.servlet.http.HttpServletRequest req, java.lang.String name)
req
- a valid request to get the session fromname
- the name of the attributepublic static java.lang.Object remove(javax.servlet.http.HttpServletRequest req, java.lang.String name)
get(HttpServletRequest, String)
but it also removes the value from the request session.req
- a valid request to get the session fromname
- the name of the attribute