Package de.hybris.platform.util
Class WebSessionFunctions
- java.lang.Object
-
- de.hybris.platform.util.WebSessionFunctions
-
public class WebSessionFunctions extends java.lang.ObjectHelper class for session handling.
-
-
Constructor Summary
Constructors Constructor Description WebSessionFunctions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclearCurrentHttpServletRequest()Unassigns the current thread from its current http servlet request.static voidclearSession(javax.servlet.http.HttpSession session)static javax.servlet.http.HttpServletRequestgetCurrentHttpServletRequest()Returns the http servlet request associated with the current thread, ornullif no request had been stored.static javax.servlet.http.HttpSessiongetCurrentHttpSession()Returns the http session associated with the current thread.static JaloSessiongetSession(java.lang.String cookiename, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean skipSystemInitTest)returns a JaloSession objectstatic JaloSessiongetSession(java.lang.String cookiename, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Class sessionClass, boolean skipSystemInitTest)returns a JaloSession objectstatic JaloSessiongetSession(java.util.Map connProp, java.lang.String cookiename, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)returns a JaloSession objectstatic JaloSessiongetSession(java.util.Map _connProp, java.lang.String cookiename, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Class sessionClass)returns a JaloSession objectstatic JaloSessiongetSession(javax.servlet.http.HttpServletRequest request)returns a JaloSession object.static JaloSessiongetSession(javax.servlet.http.HttpServletRequest request, boolean skipSystemInitTest)returns a JaloSession object.static 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 JaloSessiontryGetJaloSession(javax.servlet.http.HttpSession session)
-
-
-
Method Detail
-
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
public static final JaloSession tryGetJaloSession(javax.servlet.http.HttpSession session)
-
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(java.util.Map connProp, java.lang.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(java.util.Map _connProp, java.lang.String cookiename, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.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(java.lang.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(java.lang.String cookiename, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.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
-
-