Package io.guise.framework.platform.web
Class HTTPServletGuiseSessionManager
- java.lang.Object
-
- io.guise.framework.platform.web.HTTPServletGuiseSessionManager
-
- All Implemented Interfaces:
java.util.EventListener
,javax.servlet.http.HttpSessionListener
public class HTTPServletGuiseSessionManager extends java.lang.Object implements javax.servlet.http.HttpSessionListener
Manages Guise sessions for an HTTP web application. Guise sessions are created and released in conjunction with associated HTTP servlet sessions. There may be multiple Guise applications within one web application.A HTTP request may override any HTTP session identified by the request by exlicitly identifying the Guise session UUID using the
WebPlatform.GUISE_SESSION_UUID_URI_QUERY_PARAMETER
parameter.- Author:
- Garret Wilson
- See Also:
HTTPServletGuiseContainer
-
-
Constructor Summary
Constructors Constructor Description HTTPServletGuiseSessionManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static GuiseSession
getGuiseSession(HTTPServletGuiseContainer guiseContainer, GuiseApplication guiseApplication, javax.servlet.http.HttpServletRequest httpRequest)
Retrieves a session for the given HTTP request, creating a session if necessary.protected static GuiseSession
getGuiseSession(HTTPServletGuiseContainer guiseContainer, GuiseApplication guiseApplication, javax.servlet.http.HttpServletRequest httpRequest, boolean createSession)
Retrieves a session for the given HTTP request.void
sessionCreated(javax.servlet.http.HttpSessionEvent httpSessionEvent)
void
sessionDestroyed(javax.servlet.http.HttpSessionEvent httpSessionEvent)
-
-
-
Method Detail
-
getGuiseSession
protected static GuiseSession getGuiseSession(HTTPServletGuiseContainer guiseContainer, GuiseApplication guiseApplication, javax.servlet.http.HttpServletRequest httpRequest)
Retrieves a session for the given HTTP request, creating a session if necessary. If aWebPlatform.GUISE_SESSION_UUID_URI_QUERY_PARAMETER
parameter is present in the HTTP request, it will be used to directly look up a Guise session, ignoring any identified HTTP session. If there is no Guise session matching a specified UUID, the Guise session will be retrieved normally.- Parameters:
guiseContainer
- The Guise container that owns the application.guiseApplication
- The application to install to own the created session..httpRequest
- The HTTP request with which the Guise session is to be associated.- Returns:
- The Guise session associated with the provided HTTP session.
- Throws:
java.lang.IllegalArgumentException
- if the provided HTTP session is not a session from this web application or the HTTP session has been invalidated, and there is therefore no corresponding Guise session.
-
getGuiseSession
protected static GuiseSession getGuiseSession(HTTPServletGuiseContainer guiseContainer, GuiseApplication guiseApplication, javax.servlet.http.HttpServletRequest httpRequest, boolean createSession)
Retrieves a session for the given HTTP request. If aWebPlatform.GUISE_SESSION_UUID_URI_QUERY_PARAMETER
parameter is present in the HTTP request, it will be used to directly look up a Guise session, ignoring any identified HTTP session. If there is no Guise session matching a specified UUID, the Guise session will be retrieved normally.- Parameters:
guiseContainer
- The Guise container that owns the application.guiseApplication
- The application to install to own the created session..httpRequest
- The HTTP request with which the Guise session is to be associated.createSession
- Whether a Guise session should be created if one does not already exist.- Returns:
- The Guise session associated with the provided HTTP request, or
null
if there is no Guise session and session creation was not requested. - Throws:
java.lang.IllegalArgumentException
- if the provided HTTP session is not a session from this web application or the HTTP session has been invalidated, and there is therefore no corresponding Guise session.
-
sessionCreated
public void sessionCreated(javax.servlet.http.HttpSessionEvent httpSessionEvent)
This implementation does nothing, as there is no way to tell with which Guise container and Guise application application a new Guise application should be associated.
- Specified by:
sessionCreated
in interfacejavax.servlet.http.HttpSessionListener
-
sessionDestroyed
public void sessionDestroyed(javax.servlet.http.HttpSessionEvent httpSessionEvent)
This implementation removes the corresponding Guise session.
- Specified by:
sessionDestroyed
in interfacejavax.servlet.http.HttpSessionListener
-
-