java.lang.Object
cloud.piranha.webapp.impl.DefaultHttpSessionManager
- All Implemented Interfaces:
HttpSessionManager
,SessionCookieConfig
public class DefaultHttpSessionManager
extends Object
implements HttpSessionManager, SessionCookieConfig
The default HttpSessionManager.
- Author:
- Manfred Riem ([email protected])
-
Field Summary
Modifier and TypeFieldDescriptionprotected ArrayList<HttpSessionAttributeListener>
Stores the session listeners.protected String
Stores the comment.protected Set<SessionTrackingMode>
Stores the default session tracking modes.protected String
Stores the domain.protected boolean
Stores the HTTP only flag.protected ArrayList<HttpSessionIdListener>
Stores the session id listeners.protected int
Stores the max age.protected String
Stores the name.protected String
Stores the path.protected boolean
Stores the secure flag.protected ArrayList<HttpSessionListener>
Stores the session listeners.protected Map<String,HttpSession>
Stores the sessions.protected int
Stores the session timeout (in minutes).protected Set<SessionTrackingMode>
Stores the session tracking modes.protected WebApplication
Stores the web application. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T extends EventListener>
voidaddListener(T listener)
Add a listener.void
attributeAdded(HttpSession session, String name, Object value)
Attribute added.void
attributeRemoved(HttpSession session, String name, Object value)
Attribute removed.void
attributeReplaced(HttpSession session, String name, Object oldValue, Object newValue)
Attribute replaced.changeSessionId(HttpServletRequest request)
Change the session id.createSession(HttpServletRequest request)
Create a session.void
destroySession(HttpSession session)
Destroy the session.encodeRedirectURL(HttpServletResponse response, String url)
Encode the redirect URL.encodeURL(HttpServletResponse response, String url)
Encode the URL.Returns the comment.Returns the default session tracking modes.Returns the domain.Returns the effective session tracking modes.int
Returns the max age.getName()
Returns the name.getPath()
Returns the path.getSession(HttpServletRequest request, String currentSessionId)
Returns the session.Returns the session cookie config.int
Get the session timeout (in minutes).boolean
hasSession(String sessionId)
Has a session with the given id.boolean
Is HTTP only?boolean
isSecure()
Is secure.void
setComment(String comment)
Set the comment.void
Set the domain.void
setHttpOnly(boolean httpOnly)
Set the HTTP-only flag.void
setMaxAge(int maxAge)
Set the max age.void
Set the name.void
Set the path.void
setSecure(boolean secure)
Set the secure flag.void
setSessionTimeout(int sessionTimeout)
Set the session timeout.void
setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes)
Set the session tracking modes.void
setWebApplication(WebApplication webApplication)
Set the web application.
-
Field Details
-
attributeListeners
Stores the session listeners. -
comment
Stores the comment. -
defaultSessionTrackingModes
Stores the default session tracking modes. -
domain
Stores the domain. -
httpOnly
protected boolean httpOnlyStores the HTTP only flag. -
idListeners
Stores the session id listeners. -
maxAge
protected int maxAgeStores the max age. -
name
Stores the name. -
path
Stores the path. -
secure
protected boolean secureStores the secure flag. -
sessionListeners
Stores the session listeners. -
sessionTimeout
protected int sessionTimeoutStores the session timeout (in minutes). -
sessionTrackingModes
Stores the session tracking modes. -
sessions
Stores the sessions. -
webApplication
Stores the web application.
-
-
Constructor Details
-
DefaultHttpSessionManager
public DefaultHttpSessionManager()Constructor.
-
-
Method Details
-
createSession
Description copied from interface:HttpSessionManager
Create a session.- Specified by:
createSession
in interfaceHttpSessionManager
- Parameters:
request
- the request.- Returns:
- the session.
-
getSession
Description copied from interface:HttpSessionManager
Returns the session.- Specified by:
getSession
in interfaceHttpSessionManager
- Parameters:
request
- the request.currentSessionId
- the current session id.- Returns:
- the session
-
changeSessionId
Change the session id.- Specified by:
changeSessionId
in interfaceHttpSessionManager
- Parameters:
request
- the request.- Returns:
- the session id.
-
addListener
Add a listener.- Specified by:
addListener
in interfaceHttpSessionManager
- Type Parameters:
T
- the type.- Parameters:
listener
- the listener.
-
attributeAdded
Attribute added.- Specified by:
attributeAdded
in interfaceHttpSessionManager
- Parameters:
session
- the HTTP session.name
- the name.value
- the value.
-
attributeReplaced
Attribute replaced.- Specified by:
attributeReplaced
in interfaceHttpSessionManager
- Parameters:
session
- the HTTP session.name
- the name.oldValue
- the old value.newValue
- the new value.
-
attributeRemoved
Description copied from interface:HttpSessionManager
Attribute removed.- Specified by:
attributeRemoved
in interfaceHttpSessionManager
- Parameters:
session
- the HTTP session.name
- the name.value
- the value.
-
destroySession
Destroy the session.- Specified by:
destroySession
in interfaceHttpSessionManager
- Parameters:
session
- the session.
-
encodeRedirectURL
Encode the redirect URL.- Specified by:
encodeRedirectURL
in interfaceHttpSessionManager
- Parameters:
response
- the response.url
- the redirect url.- Returns:
- the encoded redirect url.
-
encodeURL
Encode the URL.- Specified by:
encodeURL
in interfaceHttpSessionManager
- Parameters:
response
- the response.url
- the url.- Returns:
- the encoded url.
-
getComment
Returns the comment.- Specified by:
getComment
in interfaceSessionCookieConfig
- Returns:
- the comment
-
getDefaultSessionTrackingModes
Returns the default session tracking modes.- Specified by:
getDefaultSessionTrackingModes
in interfaceHttpSessionManager
- Returns:
- the default session tracking modes
-
getDomain
Returns the domain.- Specified by:
getDomain
in interfaceSessionCookieConfig
- Returns:
- the domain
-
getEffectiveSessionTrackingModes
Returns the effective session tracking modes.- Specified by:
getEffectiveSessionTrackingModes
in interfaceHttpSessionManager
- Returns:
- the effective session tracking modes
-
getMaxAge
public int getMaxAge()Returns the max age.- Specified by:
getMaxAge
in interfaceSessionCookieConfig
- Returns:
- the max age
-
getName
Returns the name.- Specified by:
getName
in interfaceSessionCookieConfig
- Returns:
- the name
-
getPath
Returns the path.- Specified by:
getPath
in interfaceSessionCookieConfig
- Returns:
- the path
-
getSessionCookieConfig
Returns the session cookie config.- Specified by:
getSessionCookieConfig
in interfaceHttpSessionManager
- Returns:
- the session cookie config
-
getSessionTimeout
public int getSessionTimeout()Get the session timeout (in minutes).- Specified by:
getSessionTimeout
in interfaceHttpSessionManager
- Returns:
- the session timeout.
-
hasSession
Has a session with the given id.- Specified by:
hasSession
in interfaceHttpSessionManager
- Parameters:
sessionId
- the session id.- Returns:
- true if there is one, false otherwise.
-
isHttpOnly
public boolean isHttpOnly()Is HTTP only?- Specified by:
isHttpOnly
in interfaceSessionCookieConfig
- Returns:
- true if HTTP only, false otherwise.
-
isSecure
public boolean isSecure()Is secure.- Specified by:
isSecure
in interfaceSessionCookieConfig
- Returns:
- the secure flag.
-
setComment
Description copied from interface:SessionCookieConfig
Set the comment.- Specified by:
setComment
in interfaceSessionCookieConfig
- Parameters:
comment
- the comment.
-
setDomain
Description copied from interface:SessionCookieConfig
Set the domain.- Specified by:
setDomain
in interfaceSessionCookieConfig
- Parameters:
domain
- the domain.
-
setHttpOnly
public void setHttpOnly(boolean httpOnly)Description copied from interface:SessionCookieConfig
Set the HTTP-only flag.- Specified by:
setHttpOnly
in interfaceSessionCookieConfig
- Parameters:
httpOnly
- the HTTP-only flag.
-
setMaxAge
public void setMaxAge(int maxAge)Description copied from interface:SessionCookieConfig
Set the max age.- Specified by:
setMaxAge
in interfaceSessionCookieConfig
- Parameters:
maxAge
- the max age.
-
setName
Description copied from interface:SessionCookieConfig
Set the name.- Specified by:
setName
in interfaceSessionCookieConfig
- Parameters:
name
- the name.
-
setPath
Description copied from interface:SessionCookieConfig
Set the path.- Specified by:
setPath
in interfaceSessionCookieConfig
- Parameters:
path
- the path.
-
setSecure
public void setSecure(boolean secure)Description copied from interface:SessionCookieConfig
Set the secure flag.- Specified by:
setSecure
in interfaceSessionCookieConfig
- Parameters:
secure
- the secure flag.
-
setSessionTimeout
public void setSessionTimeout(int sessionTimeout)Set the session timeout.- Specified by:
setSessionTimeout
in interfaceHttpSessionManager
- Parameters:
sessionTimeout
- the session timeout.
-
setSessionTrackingModes
Set the session tracking modes.- Specified by:
setSessionTrackingModes
in interfaceHttpSessionManager
- Parameters:
sessionTrackingModes
- the session tracking modes.
-
setWebApplication
Set the web application.- Specified by:
setWebApplication
in interfaceHttpSessionManager
- Parameters:
webApplication
- the web application.
-