public interface SessionManager extends LifeCycle
LifeCycle.Listener
Modifier and Type | Field and Description |
---|---|
static String |
__CheckRemoteSessionEncoding |
static String |
__DefaultSessionCookie |
static String |
__DefaultSessionDomain |
static String |
__DefaultSessionIdPathParameterName |
static String |
__MaxAgeProperty
Session Max Age.
|
static String |
__SessionCookieProperty
Session cookie name.
|
static String |
__SessionDomainProperty
Session Domain.
|
static String |
__SessionIdPathParameterNameProperty
Session id path parameter name.
|
static String |
__SessionPathProperty
Session Path.
|
Modifier and Type | Method and Description |
---|---|
HttpCookie |
access(javax.servlet.http.HttpSession session,
boolean secure)
Called by the
SessionHandler when a session is first accessed by a request. |
void |
addEventListener(EventListener listener)
Adds an event listener for session-related events.
|
void |
clearEventListeners()
Removes all event listeners for session-related events.
|
void |
complete(javax.servlet.http.HttpSession session)
Called by the
SessionHandler when a session is last accessed by a request. |
String |
getClusterId(javax.servlet.http.HttpSession session) |
Set<javax.servlet.SessionTrackingMode> |
getDefaultSessionTrackingModes() |
Set<javax.servlet.SessionTrackingMode> |
getEffectiveSessionTrackingModes() |
boolean |
getHttpOnly() |
javax.servlet.http.HttpSession |
getHttpSession(String id)
Returns the
HttpSession with the given session id |
int |
getMaxInactiveInterval() |
SessionIdManager |
getMetaManager()
Deprecated.
|
String |
getNodeId(javax.servlet.http.HttpSession session) |
HttpCookie |
getSessionCookie(javax.servlet.http.HttpSession session,
String contextPath,
boolean requestIsSecure)
Gets a Cookie for a session.
|
javax.servlet.SessionCookieConfig |
getSessionCookieConfig() |
SessionIdManager |
getSessionIdManager() |
String |
getSessionIdPathParameterName() |
String |
getSessionIdPathParameterNamePrefix() |
boolean |
isCheckingRemoteSessionIdEncoding() |
boolean |
isUsingCookies() |
boolean |
isUsingURLs() |
boolean |
isValid(javax.servlet.http.HttpSession session) |
javax.servlet.http.HttpSession |
newHttpSession(javax.servlet.http.HttpServletRequest request)
Creates a new
HttpSession . |
void |
removeEventListener(EventListener listener)
Removes an event listener for for session-related events.
|
void |
setCheckingRemoteSessionIdEncoding(boolean remote) |
void |
setMaxInactiveInterval(int seconds)
Sets the max period of inactivity, after which the session is invalidated, in seconds.
|
void |
setSessionHandler(SessionHandler handler)
Sets the
SessionHandler . |
void |
setSessionIdManager(SessionIdManager idManager)
Sets the cross context session id manager
|
void |
setSessionIdPathParameterName(String parameterName)
Sets the session id URL path parameter name.
|
void |
setSessionTrackingModes(Set<javax.servlet.SessionTrackingMode> sessionTrackingModes) |
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
static final String __SessionCookieProperty
JSESSIONID
, but can be set with the
org.eclipse.jetty.servlet.SessionCookie
context init parameter.static final String __DefaultSessionCookie
static final String __SessionIdPathParameterNameProperty
jsessionid
, but can be set with the
org.eclipse.jetty.servlet.SessionIdPathParameterName
context init parameter.
If set to null or "none" no URL rewriting will be done.static final String __DefaultSessionIdPathParameterName
static final String __CheckRemoteSessionEncoding
static final String __SessionDomainProperty
static final String __DefaultSessionDomain
static final String __SessionPathProperty
static final String __MaxAgeProperty
javax.servlet.http.HttpSession getHttpSession(String id)
HttpSession
with the given session idid
- the session idHttpSession
with the corresponding id or null if no session with the given id existsjavax.servlet.http.HttpSession newHttpSession(javax.servlet.http.HttpServletRequest request)
HttpSession
.request
- the HttpServletRequest containing the requested session idHttpSession
boolean getHttpOnly()
HttpCookie.isHttpOnly()
int getMaxInactiveInterval()
setMaxInactiveInterval(int)
void setMaxInactiveInterval(int seconds)
seconds
- the max inactivity period, in seconds.getMaxInactiveInterval()
void setSessionHandler(SessionHandler handler)
SessionHandler
.handler
- the SessionHandler
objectvoid addEventListener(EventListener listener)
listener
- the session event listener to add
Individual SessionManagers implementations may accept arbitrary listener types,
but they are expected to at least handle HttpSessionActivationListener,
HttpSessionAttributeListener, HttpSessionBindingListener and HttpSessionListener.removeEventListener(EventListener)
void removeEventListener(EventListener listener)
listener
- the session event listener to removeaddEventListener(EventListener)
void clearEventListeners()
removeEventListener(EventListener)
HttpCookie getSessionCookie(javax.servlet.http.HttpSession session, String contextPath, boolean requestIsSecure)
session
- the session to which the cookie should refer.contextPath
- the context to which the cookie should be linked.
The client will only send the cookie value when requesting resources under this path.requestIsSecure
- whether the client is accessing the server over a secure protocol (i.e. HTTPS).SessionManager
uses cookies, then this method will return a new
cookie object
that should be set on the client in order to link future HTTP requests
with the session
. If cookies are not in use, this method returns null
.SessionIdManager getSessionIdManager()
setSessionIdManager(SessionIdManager)
@Deprecated SessionIdManager getMetaManager()
getSessionIdManager()
void setSessionIdManager(SessionIdManager idManager)
idManager
- the cross context session id manager.getSessionIdManager()
boolean isValid(javax.servlet.http.HttpSession session)
session
- the session to test for validityString getNodeId(javax.servlet.http.HttpSession session)
session
- the session objectgetClusterId(HttpSession)
String getClusterId(javax.servlet.http.HttpSession session)
session
- the session objectgetNodeId(HttpSession)
HttpCookie access(javax.servlet.http.HttpSession session, boolean secure)
SessionHandler
when a session is first accessed by a request.session
- the session objectsecure
- whether the request is secure or notcomplete(HttpSession)
void complete(javax.servlet.http.HttpSession session)
SessionHandler
when a session is last accessed by a request.session
- the session objectaccess(HttpSession, boolean)
void setSessionIdPathParameterName(String parameterName)
parameterName
- the URL path parameter name for session id URL rewriting (null or "none" for no rewriting).getSessionIdPathParameterName()
,
getSessionIdPathParameterNamePrefix()
String getSessionIdPathParameterName()
setSessionIdPathParameterName(String)
String getSessionIdPathParameterNamePrefix()
getSessionIdPathParameterName()
, by default
";" + sessionIdParameterName + "=", for easier lookup in URL strings.getSessionIdPathParameterName()
boolean isUsingCookies()
boolean isUsingURLs()
Set<javax.servlet.SessionTrackingMode> getDefaultSessionTrackingModes()
Set<javax.servlet.SessionTrackingMode> getEffectiveSessionTrackingModes()
void setSessionTrackingModes(Set<javax.servlet.SessionTrackingMode> sessionTrackingModes)
javax.servlet.SessionCookieConfig getSessionCookieConfig()
boolean isCheckingRemoteSessionIdEncoding()
void setCheckingRemoteSessionIdEncoding(boolean remote)
remote
- True if absolute URLs are check for remoteness before being session encoded.Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.