Package de.hybris.platform.util
Class WebSessionFunctions
java.lang.Object
de.hybris.platform.util.WebSessionFunctions
Helper class for session handling.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidUnassigns the current thread from its current http servlet request.static final voidclearSession(javax.servlet.http.HttpSession session) static javax.servlet.http.HttpServletRequestReturns the http servlet request associated with the current thread, ornullif no request had been stored.static javax.servlet.http.HttpSessionReturns the http session associated with the current thread.static final JaloSessiongetSession(String cookiename, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean skipSystemInitTest) returns a JaloSession objectstatic final JaloSessiongetSession(String cookiename, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Class sessionClass, boolean skipSystemInitTest) returns a JaloSession objectstatic final JaloSessiongetSession(Map connProp, String cookiename, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) returns a JaloSession objectstatic final JaloSessiongetSession(Map _connProp, String cookiename, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Class sessionClass) returns a JaloSession objectstatic final JaloSessiongetSession(javax.servlet.http.HttpServletRequest request) returns a JaloSession object.static final JaloSessiongetSession(javax.servlet.http.HttpServletRequest request, boolean skipSystemInitTest) returns a JaloSession object.static final voidinvalidateSession(javax.servlet.http.HttpSession session) Closes the HTTP and JaloSession (if one is present under key 'jalosession').static booleanisStaleRequest(javax.servlet.http.HttpServletRequest request) Allows you to check if request is part of the stale session.static voidmarkRequestAsStale(javax.servlet.http.HttpServletRequest request) Allows you to mark request as part of the stale session.static voidsetCurrentHttpServletRequest(javax.servlet.http.HttpServletRequest request) Assigns the given http servlet request to this thread.static final JaloSessiontryGetJaloSession(javax.servlet.http.HttpSession session)
-
Constructor Details
-
WebSessionFunctions
public WebSessionFunctions()
-
-
Method Details
-
isStaleRequest
public static boolean isStaleRequest(javax.servlet.http.HttpServletRequest request) Allows you to check if request is part of the stale session.- Parameters:
request- request to check.- Returns:
- true if request is part of the stale session, false otherwise.
-
markRequestAsStale
public static void markRequestAsStale(javax.servlet.http.HttpServletRequest request) Allows you to mark request as part of the stale session.- Parameters:
request- request to be marked.
-
getCurrentHttpServletRequest
public static javax.servlet.http.HttpServletRequest getCurrentHttpServletRequest()Returns the http servlet request associated with the current thread, ornullif no request had been stored. -
getCurrentHttpSession
public static javax.servlet.http.HttpSession getCurrentHttpSession()Returns the http session associated with the current thread. This is based on the current http servlet request being assigned to this thread. Therefore the method returnsnullif no request had been assigned. -
clearCurrentHttpServletRequest
public static void clearCurrentHttpServletRequest()Unassigns the current thread from its current http servlet request. -
setCurrentHttpServletRequest
public static void setCurrentHttpServletRequest(javax.servlet.http.HttpServletRequest request) Assigns the given http servlet request to this thread. -
invalidateSession
public static final void invalidateSession(javax.servlet.http.HttpSession session) Closes the HTTP and JaloSession (if one is present under key 'jalosession'). -
clearSession
public static final void clearSession(javax.servlet.http.HttpSession session) -
tryGetJaloSession
-
getSession
public static final JaloSession getSession(javax.servlet.http.HttpServletRequest request) throws JaloConnectException, JaloSystemNotInitializedException returns a JaloSession object.If you don't want to use cookies and are connecting to the local server, this is the preferred method to get or create a JaloSession object.
- Parameters:
request- the HttpServletRequest object- Returns:
- the JaloSession
- Throws:
JaloConnectException- in case of a connection errorJaloSystemNotInitializedException- in case the connection was successful but the system not yet initialized
-
getSession
public static final JaloSession getSession(Map connProp, String cookiename, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws JaloSystemNotInitializedException returns a JaloSession object- if a JaloSession is stored inside of the HttpSession (key 'jalosession'), this JaloSession is returned.
- if cookies are not used, or no cookie was found, an anonymous session is created, put in the HttpSession and returned
- if cookies are used and a cookie was found, then we try to 'reactivate' the customer stored inside the cookie, if this was not successful, an anonymous session is created.
- Parameters:
connProp- deprecated, use always NULLcookiename- if null, no cookies are used, otherwise this is the cookiename that should be used.session- the HttpSession objectrequest- the HttpServletRequest objectresponse- the HttpServletRespone object- Throws:
JaloSystemNotInitializedException- in case the connection was successful but the system not yet initialized
-
getSession
public static final JaloSession getSession(Map _connProp, String cookiename, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Class sessionClass) throws JaloSystemNotInitializedException returns a JaloSession object- if a JaloSession is stored inside of the HttpSession (key 'jalosession'), this JaloSession is returned.
- if cookies are not used, or no cookie was found, an anonymous session is created, put in the HttpSession and returned
- if cookies are used and a cookie was found, then we try to 'reactivate' the customer stored inside the cookie, if this was not successful, an anonymous session is created.
- Parameters:
_connProp- Deprecated, use always NULLcookiename- if null, no cookies are used, otherwise this is the cookiename that should be used.session- the HttpSession objectrequest- the HttpServletRequest objectresponse- the HttpServletRespone objectsessionClass- the jalo class of the new session, if nullJaloSessionwill be taken- Throws:
JaloSystemNotInitializedException- in case the connection was successful but the system not yet initialized
-
getSession
public static final JaloSession getSession(javax.servlet.http.HttpServletRequest request, boolean skipSystemInitTest) throws JaloConnectException, JaloSystemNotInitializedException returns a JaloSession object.If you don't want to use cookies and are connecting to the local server, this is the preferred method to get or create a JaloSession object.
- Parameters:
request- the HttpServletRequest objectskipSystemInitTest- is true, this metod will not execute a db statement in order to determine if the system is initialize- Returns:
- the JaloSession
- Throws:
JaloConnectException- in case of a connection errorJaloSystemNotInitializedException- in case the connection was successful but the system not yet initialized
-
getSession
public static final JaloSession getSession(String cookiename, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean skipSystemInitTest) throws JaloSystemNotInitializedException returns a JaloSession object- if a JaloSession is stored inside of the HttpSession (key 'jalosession'), this JaloSession is returned.
- if cookies are not used, or no cookie was found, an anonymous session is created, put in the HttpSession and returned
- if cookies are used and a cookie was found, then we try to 'reactivate' the customer stored inside the cookie, if this was not successful, an anonymous session is created.
- Parameters:
cookiename- if null, no cookies are used, otherwise this is the cookiename that should be used.session- the HttpSession objectrequest- the HttpServletRequest objectresponse- the HttpServletRespone objectskipSystemInitTest- is true, this metod will not execute a db statement in order to determine if the system is initialize- Throws:
JaloSystemNotInitializedException- in case the connection was successful but the system not yet initialized
-
getSession
public static final JaloSession getSession(String cookiename, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Class sessionClass, boolean skipSystemInitTest) throws JaloSystemNotInitializedException returns a JaloSession object- if a JaloSession is stored inside of the HttpSession (key 'jalosession'), this JaloSession is returned.
- if cookies are not used, or no cookie was found, an anonymous session is created, put in the HttpSession and returned
- if cookies are used and a cookie was found, then we try to 'reactivate' the customer stored inside the cookie, if this was not successful, an anonymous session is created.
- Parameters:
cookiename- if null, no cookies are used, otherwise this is the cookiename that should be used.session- the HttpSession objectrequest- the HttpServletRequest objectresponse- the HttpServletRespone objectsessionClass- the jalo class of the new session, if nullJaloSessionwill be takenskipSystemInitTest- is true, this metod will not execute a db statement in order to determine if the system is initialize- Throws:
JaloSystemNotInitializedException- in case the connection was successful but the system not yet initialized
-