|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SessionManager
Session Manager. The API required to manage sessions for a servlet context.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle |
---|
LifeCycle.Listener |
Field Summary | |
---|---|
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. |
Method Summary | |
---|---|
HttpCookie |
access(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(HttpSession session)
Called by the SessionHandler when a session is last accessed by a request. |
String |
getClusterId(HttpSession session)
|
boolean |
getHttpOnly()
|
HttpSession |
getHttpSession(String id)
Returns the HttpSession with the given session id |
SessionIdManager |
getIdManager()
|
int |
getMaxCookieAge()
|
int |
getMaxInactiveInterval()
|
SessionIdManager |
getMetaManager()
Deprecated. use getIdManager() |
String |
getNodeId(HttpSession session)
|
boolean |
getSecureCookies()
|
String |
getSessionCookie()
|
HttpCookie |
getSessionCookie(HttpSession session,
String contextPath,
boolean requestIsSecure)
Gets a Cookie for a session. |
String |
getSessionDomain()
|
String |
getSessionIdPathParameterName()
|
String |
getSessionIdPathParameterNamePrefix()
|
String |
getSessionPath()
|
boolean |
isUsingCookies()
|
boolean |
isValid(HttpSession session)
|
HttpSession |
newHttpSession(HttpServletRequest request)
Creates a new HttpSession . |
void |
removeEventListener(EventListener listener)
Removes an event listener for for session-related events. |
void |
setIdManager(SessionIdManager idManager)
Sets the cross context session id manager |
void |
setMaxCookieAge(int maxCookieAge)
Sets the max age to set on the session cookie, in seconds |
void |
setMaxInactiveInterval(int seconds)
Sets the max period of inactivity, after which the session is invalidated, in seconds. |
void |
setSessionCookie(String cookieName)
Sets the session cookie name. |
void |
setSessionDomain(String domain)
Sets the domain to set on the session cookie |
void |
setSessionHandler(SessionHandler handler)
Sets the SessionHandler . |
void |
setSessionIdPathParameterName(String parameterName)
Sets the session id URL path parameter name. |
void |
setSessionPath(String path)
Sets the path to set on the session cookie |
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle |
---|
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
Field Detail |
---|
static final String __SessionCookieProperty
static final String __DefaultSessionCookie
static final String __SessionIdPathParameterNameProperty
static final String __DefaultSessionIdPathParameterName
static final String __SessionDomainProperty
static final String __DefaultSessionDomain
static final String __SessionPathProperty
static final String __MaxAgeProperty
Method Detail |
---|
HttpSession getHttpSession(String id)
HttpSession
with the given session id
id
- the session id
HttpSession
with the corresponding id or null if no session with the given id existsHttpSession newHttpSession(HttpServletRequest request)
HttpSession
.
request
- the HttpServletRequest containing the requested session id
HttpSession
boolean getSecureCookies()
boolean getHttpOnly()
Cookie#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(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 getIdManager()
setIdManager(SessionIdManager)
SessionIdManager getMetaManager()
getIdManager()
void setIdManager(SessionIdManager idManager)
idManager
- the cross context session id manager.getIdManager()
boolean isValid(HttpSession session)
session
- the session to test for validity
String getNodeId(HttpSession session)
session
- the session object
getClusterId(HttpSession)
String getClusterId(HttpSession session)
session
- the session object
getNodeId(HttpSession)
HttpCookie access(HttpSession session, boolean secure)
SessionHandler
when a session is first accessed by a request.
session
- the session objectsecure
- whether the request is secure or not
complete(HttpSession)
void complete(HttpSession session)
SessionHandler
when a session is last accessed by a request.
session
- the session objectaccess(HttpSession, boolean)
void setSessionCookie(String cookieName)
cookieName
- the session cookie namegetSessionCookie()
String getSessionCookie()
setSessionCookie(String)
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()
void setSessionDomain(String domain)
domain
- the domain to set on the session cookiegetSessionDomain()
String getSessionDomain()
setSessionDomain(String)
void setSessionPath(String path)
path
- the path to set on the session cookiegetSessionPath()
String getSessionPath()
setSessionPath(String)
void setMaxCookieAge(int maxCookieAge)
maxCookieAge
- the max age to set on the session cookie, in secondsgetMaxCookieAge()
int getMaxCookieAge()
setMaxCookieAge(int)
boolean isUsingCookies()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |