public class DefaultHttpSessionManager extends Object implements HttpSessionManager, javax.servlet.SessionCookieConfig
Modifier and Type | Field and Description |
---|---|
protected ArrayList<javax.servlet.http.HttpSessionAttributeListener> |
attributeListeners
Stores the session listeners.
|
protected String |
comment
Stores the comment.
|
protected Set<javax.servlet.SessionTrackingMode> |
defaultSessionTrackingModes
Stores the default session tracking modes.
|
protected String |
domain
Stores the domain.
|
protected boolean |
httpOnly
Stores the HTTP only flag.
|
protected ArrayList<javax.servlet.http.HttpSessionIdListener> |
idListeners
Stores the session id listeners.
|
protected int |
maxAge
Stores the max age.
|
protected String |
name
Stores the name.
|
protected String |
path
Stores the path.
|
protected boolean |
secure
Stores the secure flag.
|
protected ArrayList<javax.servlet.http.HttpSessionListener> |
sessionListeners
Stores the session listeners.
|
protected Map<String,javax.servlet.http.HttpSession> |
sessions
Stores the sessions.
|
protected int |
sessionTimeout
Stores the session timeout (in minutes).
|
protected Set<javax.servlet.SessionTrackingMode> |
sessionTrackingModes
Stores the session tracking modes.
|
protected WebApplication |
webApplication
Stores the web application.
|
Constructor and Description |
---|
DefaultHttpSessionManager()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
<T extends EventListener> |
addListener(T listener)
Add a listener.
|
void |
attributeAdded(javax.servlet.http.HttpSession session,
String name,
Object value)
Attribute added.
|
void |
attributeRemoved(javax.servlet.http.HttpSession session,
String name)
Attributed removed.
|
void |
attributeReplaced(javax.servlet.http.HttpSession session,
String name,
Object value)
Attribute removed.
|
String |
changeSessionId(javax.servlet.http.HttpServletRequest request)
Change the session id.
|
javax.servlet.http.HttpSession |
createSession(WebApplication webApplication,
javax.servlet.http.HttpServletRequest request)
Create the session.
|
void |
destroySession(javax.servlet.http.HttpSession session)
Destroy the session.
|
String |
encodeRedirectURL(javax.servlet.http.HttpServletResponse response,
String url)
Encode the redirect URL.
|
String |
encodeURL(javax.servlet.http.HttpServletResponse response,
String url)
Encode the URL.
|
String |
getComment()
Get the comment.
|
Set<javax.servlet.SessionTrackingMode> |
getDefaultSessionTrackingModes()
Get the default session tracking modes.
|
String |
getDomain()
Get the domain.
|
Set<javax.servlet.SessionTrackingMode> |
getEffectiveSessionTrackingModes()
Get the effective session tracking modes.
|
int |
getMaxAge()
Get the max age.
|
String |
getName()
Get the name.
|
String |
getPath()
Get the path.
|
javax.servlet.http.HttpSession |
getSession(WebApplication webApplication,
javax.servlet.http.HttpServletRequest request,
String currentSessionId)
Get the session.
|
javax.servlet.SessionCookieConfig |
getSessionCookieConfig()
Get the session cookie config.
|
int |
getSessionTimeout()
Get the session timeout (in minutes).
|
boolean |
hasSession(String sessionId)
Has a session with the given id.
|
boolean |
isHttpOnly()
Is HTTP only?
|
boolean |
isSecure()
Is secure.
|
void |
setComment(String comment)
Set the comment.
|
void |
setDomain(String domain)
Set the domain.
|
void |
setHttpOnly(boolean httpOnly)
Set the HTTP only flag.
|
void |
setMaxAge(int maxAge)
Set the max age.
|
void |
setName(String name)
Set the name.
|
void |
setPath(String path)
Set the path.
|
void |
setSecure(boolean secure)
Set the secure flag.
|
void |
setSessionTimeout(int sessionTimeout)
Set the session timeout.
|
void |
setSessionTrackingModes(Set<javax.servlet.SessionTrackingMode> sessionTrackingModes)
Set the session tracking modes.
|
protected final ArrayList<javax.servlet.http.HttpSessionAttributeListener> attributeListeners
protected String comment
protected final Set<javax.servlet.SessionTrackingMode> defaultSessionTrackingModes
protected String domain
protected boolean httpOnly
protected final ArrayList<javax.servlet.http.HttpSessionIdListener> idListeners
protected int maxAge
protected String name
protected String path
protected boolean secure
protected final ArrayList<javax.servlet.http.HttpSessionListener> sessionListeners
protected int sessionTimeout
protected Set<javax.servlet.SessionTrackingMode> sessionTrackingModes
protected WebApplication webApplication
public javax.servlet.http.HttpSession createSession(WebApplication webApplication, javax.servlet.http.HttpServletRequest request)
createSession
in interface HttpSessionManager
webApplication
- the web application.request
- the request.public javax.servlet.http.HttpSession getSession(WebApplication webApplication, javax.servlet.http.HttpServletRequest request, String currentSessionId)
getSession
in interface HttpSessionManager
webApplication
- the web application.request
- the request.currentSessionId
- the current session id.public String changeSessionId(javax.servlet.http.HttpServletRequest request)
changeSessionId
in interface HttpSessionManager
request
- the request.public <T extends EventListener> void addListener(T listener)
addListener
in interface HttpSessionManager
T
- the type.listener
- the listener.public void attributeAdded(javax.servlet.http.HttpSession session, String name, Object value)
attributeAdded
in interface HttpSessionManager
session
- the HTTP session.name
- the name.value
- the value.public void attributeReplaced(javax.servlet.http.HttpSession session, String name, Object value)
attributeReplaced
in interface HttpSessionManager
session
- the HTTP session.name
- the name.value
- the value.public void attributeRemoved(javax.servlet.http.HttpSession session, String name)
attributeRemoved
in interface HttpSessionManager
session
- the HTTP session.name
- the name.public void destroySession(javax.servlet.http.HttpSession session)
destroySession
in interface HttpSessionManager
session
- the session.public String encodeRedirectURL(javax.servlet.http.HttpServletResponse response, String url)
encodeRedirectURL
in interface HttpSessionManager
response
- the response.url
- the redirect url.public String encodeURL(javax.servlet.http.HttpServletResponse response, String url)
encodeURL
in interface HttpSessionManager
response
- the response.url
- the url.public String getComment()
getComment
in interface javax.servlet.SessionCookieConfig
public Set<javax.servlet.SessionTrackingMode> getDefaultSessionTrackingModes()
getDefaultSessionTrackingModes
in interface HttpSessionManager
public String getDomain()
getDomain
in interface javax.servlet.SessionCookieConfig
public Set<javax.servlet.SessionTrackingMode> getEffectiveSessionTrackingModes()
getEffectiveSessionTrackingModes
in interface HttpSessionManager
public int getMaxAge()
getMaxAge
in interface javax.servlet.SessionCookieConfig
public String getName()
getName
in interface javax.servlet.SessionCookieConfig
public String getPath()
getPath
in interface javax.servlet.SessionCookieConfig
public javax.servlet.SessionCookieConfig getSessionCookieConfig()
getSessionCookieConfig
in interface HttpSessionManager
public int getSessionTimeout()
getSessionTimeout
in interface HttpSessionManager
public boolean hasSession(String sessionId)
hasSession
in interface HttpSessionManager
sessionId
- the session id.public boolean isHttpOnly()
isHttpOnly
in interface javax.servlet.SessionCookieConfig
public boolean isSecure()
isSecure
in interface javax.servlet.SessionCookieConfig
public void setComment(String comment)
setComment
in interface javax.servlet.SessionCookieConfig
comment
- the comment.public void setDomain(String domain)
setDomain
in interface javax.servlet.SessionCookieConfig
domain
- the domainpublic void setHttpOnly(boolean httpOnly)
setHttpOnly
in interface javax.servlet.SessionCookieConfig
httpOnly
- the HTTP only flag.public void setMaxAge(int maxAge)
setMaxAge
in interface javax.servlet.SessionCookieConfig
maxAge
- the max age.public void setName(String name)
setName
in interface javax.servlet.SessionCookieConfig
name
- the name.public void setPath(String path)
setPath
in interface javax.servlet.SessionCookieConfig
path
- the path.public void setSecure(boolean secure)
setSecure
in interface javax.servlet.SessionCookieConfig
secure
- the secure flag.public void setSessionTimeout(int sessionTimeout)
setSessionTimeout
in interface HttpSessionManager
sessionTimeout
- the session timeout.public void setSessionTrackingModes(Set<javax.servlet.SessionTrackingMode> sessionTrackingModes)
setSessionTrackingModes
in interface HttpSessionManager
sessionTrackingModes
- the session tracking modes.Copyright © 2020. All rights reserved.