org.mortbay.jetty
Interface SessionManager

All Superinterfaces:
LifeCycle, Serializable
All Known Implementing Classes:
AbstractSessionManager

public interface SessionManager
extends LifeCycle, Serializable

Session Manager. The API required to manage sessions for a servlet context.

Author:
Greg Wilkins

Field Summary
static String __DefaultMaxAge
           
static String __DefaultSessionCookie
           
static String __DefaultSessionDomain
           
static String __DefaultSessionURL
           
static String __MaxAgeProperty
          Session Max Age.
static String __MaxAgeSystemProperty
           
static String __SessionCookieProperty
          Session cookie name.
static String __SessionCookieSystemProperty
           
static String __SessionDomainProperty
          Session Domain.
static String __SessionPathProperty
          Session Path.
static String __SessionURLProperty
          Session URL parameter name.
static String __SessionURLSystemProperty
           
 
Method Summary
 void access(HttpSession session)
          Called by the SessionHandler when a session is access by a request
 void addEventListener(EventListener listener)
          Add an event listener.
 void clearEventListeners()
           
 void complete(HttpSession session)
          Called by the SessionHandler when a reqeuest is not longer handling a session.
 boolean getHttpOnly()
           
 HttpSession getHttpSession(String id)
           
 int getMaxCookieAge()
           
 int getMaxInactiveInterval()
           
 SessionIdManager getMetaManager()
           
 boolean getSecureCookies()
           
 String getSessionCookie()
           
 Cookie getSessionCookie(HttpSession session, String contextPath, boolean requestIsSecure)
          Get a Cookie for a session.
 String getSessionDomain()
           
 String getSessionPath()
           
 String getSessionURL()
           
 String getSessionURLPrefix()
           
 boolean isValid(HttpSession session)
           
 HttpSession newHttpSession(HttpServletRequest request)
           
 void removeEventListener(EventListener listener)
           
 void setMaxInactiveInterval(int seconds)
           
 void setMaxSessionCookieAge(int maxCookieAge)
           
 void setMetaManager(SessionIdManager meta)
           
 void setSessionCookie(String cookieName)
           
 void setSessionDomain(String domain)
           
 void setSessionHandler(SessionHandler handler)
           
 void setSessionPath(String path)
           
 void setSessionURL(String url)
           
 
Methods inherited from interface org.mortbay.component.LifeCycle
isFailed, isRunning, isStarted, isStarting, isStopping, start, stop
 

Field Detail

__SessionCookieProperty

public static final String __SessionCookieProperty
Session cookie name. Defaults to JSESSIONID, but can be set with the org.mortbay.jetty.servlet.SessionCookie system property.

See Also:
Constant Field Values

__DefaultSessionCookie

public static final String __DefaultSessionCookie
See Also:
Constant Field Values

__SessionCookieSystemProperty

public static final String __SessionCookieSystemProperty

__SessionURLProperty

public static final String __SessionURLProperty
Session URL parameter name. Defaults to jsessionid, but can be set with the org.mortbay.jetty.servlet.SessionURL system property.

See Also:
Constant Field Values

__DefaultSessionURL

public static final String __DefaultSessionURL
See Also:
Constant Field Values

__SessionURLSystemProperty

public static final String __SessionURLSystemProperty

__SessionDomainProperty

public static final String __SessionDomainProperty
Session Domain. If this property is set as a ServletContext InitParam, then it is used as the domain for session cookies. If it is not set, then no domain is specified for the session cookie.

See Also:
Constant Field Values

__DefaultSessionDomain

public static final String __DefaultSessionDomain

__SessionPathProperty

public static final String __SessionPathProperty
Session Path. If this property is set as a ServletContext InitParam, then it is used as the path for the session cookie. If it is not set, then the context path is used as the path for the cookie.

See Also:
Constant Field Values

__MaxAgeProperty

public static final String __MaxAgeProperty
Session Max Age. If this property is set as a ServletContext InitParam, then it is used as the max age for the session cookie. If it is not set, then a max age of -1 is used.

See Also:
Constant Field Values

__DefaultMaxAge

public static final String __DefaultMaxAge
See Also:
Constant Field Values

__MaxAgeSystemProperty

public static final String __MaxAgeSystemProperty
Method Detail

getHttpSession

public HttpSession getHttpSession(String id)

newHttpSession

public HttpSession newHttpSession(HttpServletRequest request)

getSecureCookies

public boolean getSecureCookies()
Returns:
true if session cookies should be secure

getHttpOnly

public boolean getHttpOnly()
Returns:
true if session cookies should be httponly (microsoft extension)

getMaxInactiveInterval

public int getMaxInactiveInterval()

setMaxInactiveInterval

public void setMaxInactiveInterval(int seconds)

setSessionHandler

public void setSessionHandler(SessionHandler handler)

addEventListener

public void addEventListener(EventListener listener)
Add an event listener.

Parameters:
listener - An Event Listener. Individual SessionManagers implemetations may accept arbitrary listener types, but they are expected to at least handle HttpSessionActivationListener, HttpSessionAttributeListener, HttpSessionBindingListener, HttpSessionListener

removeEventListener

public void removeEventListener(EventListener listener)

clearEventListeners

public void clearEventListeners()

getSessionCookie

public Cookie getSessionCookie(HttpSession session,
                               String contextPath,
                               boolean requestIsSecure)
Get a Cookie for a session.

Parameters:
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).
Returns:
If this 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.

getMetaManager

public SessionIdManager getMetaManager()
Returns:
the cross context session meta manager.

setMetaManager

public void setMetaManager(SessionIdManager meta)
Parameters:
meta - the cross context session meta manager.

isValid

public boolean isValid(HttpSession session)

access

public void access(HttpSession session)
Called by the SessionHandler when a session is access by a request


complete

public void complete(HttpSession session)
Called by the SessionHandler when a reqeuest is not longer handling a session. Not this includes new sessions, so there may not be a matching call to access(HttpSession).


setSessionCookie

public void setSessionCookie(String cookieName)

getSessionCookie

public String getSessionCookie()

setSessionURL

public void setSessionURL(String url)

getSessionURL

public String getSessionURL()

getSessionURLPrefix

public String getSessionURLPrefix()

setSessionDomain

public void setSessionDomain(String domain)

getSessionDomain

public String getSessionDomain()

setSessionPath

public void setSessionPath(String path)

getSessionPath

public String getSessionPath()

setMaxSessionCookieAge

public void setMaxSessionCookieAge(int maxCookieAge)

getMaxCookieAge

public int getMaxCookieAge()