Package com.auth0
Class SessionUtils
java.lang.Object
com.auth0.SessionUtils
Helper class to handle easy session key-value storage.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectGet the attribute with the given name from the request session.protected static javax.servlet.http.HttpSessiongetSession(javax.servlet.http.HttpServletRequest req) Extracts the HttpSession from the given request.static ObjectSame asget(HttpServletRequest, String)but it also removes the value from the request session.static voidSet's the attribute value to the request session.
-
Constructor Details
-
SessionUtils
public SessionUtils()
-
-
Method Details
-
getSession
protected static javax.servlet.http.HttpSession getSession(javax.servlet.http.HttpServletRequest req) Extracts the HttpSession from the given request.- Parameters:
req- a valid request to get the session from- Returns:
- the session of the request
-
set
Set's the attribute value to the request session.- Parameters:
req- a valid request to get the session fromname- the name of the attributevalue- the value to set
-
get
Get the attribute with the given name from the request session.- Parameters:
req- a valid request to get the session fromname- the name of the attribute- Returns:
- the attribute stored in the session or null if it doesn't exists
-
remove
Same asget(HttpServletRequest, String)but it also removes the value from the request session.- Parameters:
req- a valid request to get the session fromname- the name of the attribute- Returns:
- the attribute stored in the session or null if it doesn't exists
-