Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mortbay.jetty.servlet
Class AbstractSessionManager

    java.lang.Object
      org.mortbay.component.AbstractLifeCycle
          org.mortbay.jetty.servlet.AbstractSessionManager

All Implemented Interfaces:
  LifeCycle, SessionManager

Direct Known Subclasses:
  HashSessionManager

    public abstract class AbstractSessionManager

extends AbstractLifeCycle
implements SessionManager

An Abstract implementation of SessionManager. The partial implementation of SessionManager interface provides the majority of the handling required to implement a SessionManager. Concrete implementations of SessionManager based on AbstractSessionManager need only implement the newSession method to return a specialized version of the Session inner class that provides an attribute Map.

If the property org.mortbay.jetty.servlet.AbstractSessionManager.23Notifications is set to true, the 2.3 servlet spec notification style will be used.

Author:
  Greg Wilkins (gregw)

Nested Class Summary
`static class` | `AbstractSessionManager.NullSessionContext` Null returning implementation of HttpSessionContext
`class` | `AbstractSessionManager.Session` Implements `HttpSession` from the `javax.servlet` package.

Field Summary
`static int` | `__distantFuture`
`protected ContextHandler.SContext` | `_context`
`protected int` | `_dftMaxIdleSecs`
`protected boolean` | `_httpOnly`
`protected ClassLoader` | `_loader`
`protected int` | `_maxCookieAge`
`protected int` | `_maxSessions`
`protected int` | `_minSessions`
`protected int` | `_refreshCookieAge`
`protected boolean` | `_secureCookies`
`protected Object` | `_sessionAttributeListeners`
`protected String` | `_sessionCookie`
`protected String` | `_sessionDomain`
`protected SessionHandler` | `_sessionHandler`
`protected SessionIdManager` | `_sessionIdManager`
`protected Object` | `_sessionListeners`
`protected String` | `_sessionPath`
`protected String` | `_sessionURL`
`protected String` | `_sessionURLPrefix`

Fields inherited from interface org.mortbay.jetty.SessionManager
`__DefaultSessionCookie, __DefaultSessionDomain, __DefaultSessionURL, __MaxAgeProperty, __SessionCookieProperty, __SessionDomainProperty, __SessionPathProperty, __SessionURLProperty`

Constructor Summary
`AbstractSessionManager()`

Method Summary
`Cookie` | `access(HttpSession session, boolean secure)` Called by the `SessionHandler` when a session is access by a request
`void` | `addEventListener(EventListener listener)` Add an event listener.
`protected abstract void` | `addSession(AbstractSessionManager.Session session)`
`protected void` | `addSession(AbstractSessionManager.Session session, boolean created)` Add the session Registers the session with this manager and registers the session ID with the sessionIDManager;
`void` | `clearEventListeners()`
`void` | `complete(HttpSession session)` Called by the `SessionHandler` when a reqeuest is not longer handling a session.
`void` | `doStart()`
`void` | `doStop()`
`boolean` | `getHttpOnly()`
`HttpSession` | `getHttpSession(String id)`
`SessionIdManager` | `getIdManager()`
`int` | `getMaxCookieAge()`
`int` | `getMaxInactiveInterval()`
`int` | `getMaxSessions()`
`SessionIdManager` | `getMetaManager()` Deprecated. use `getIdManager()`
`int` | `getMinSessions()`
`int` | `getRefreshCookieAge()`
`boolean` | `getSecureCookies()`
`protected abstract AbstractSessionManager.Session` | `getSession(String idInCluster)` Get a known existingsession
`String` | `getSessionCookie()`
`Cookie` | `getSessionCookie(HttpSession session, String contextPath, boolean requestIsSecure)` Get a Cookie for a session.
`String` | `getSessionDomain()`
`SessionHandler` | `getSessionHandler()`
`abstract Map` | `getSessionMap()`
`String` | `getSessionPath()`
`abstract int` | `getSessions()`
`String` | `getSessionURL()`
`String` | `getSessionURLPrefix()`
`protected abstract void` | `invalidateSessions()`
`boolean` | `isUsingCookies()`
`boolean` | `isValid(HttpSession session)`
`HttpSession` | `newHttpSession(HttpServletRequest request)` Create a new HttpSession for a request
`protected abstract AbstractSessionManager.Session` | `newSession(HttpServletRequest request)` Create a new session instance
`protected void` | `newSessionMap()`
`void` | `removeEventListener(EventListener listener)`
`protected void` | `removeSession(AbstractSessionManager.Session session, boolean invalidate)` Remove session from manager
`protected abstract void` | `removeSession(String idInCluster)`
`void` | `resetStats()`
`void` | `setHttpOnly(boolean httpOnly)`
`void` | `setIdManager(SessionIdManager metaManager)`
`void` | `setMaxCookieAge(int maxCookieAgeInSeconds)`
`void` | `setMaxInactiveInterval(int seconds)`
`void` | `setMetaManager(SessionIdManager metaManager)` Deprecated. use `setIdManager(SessionIdManager)`
`void` | `setRefreshCookieAge(int ageInSeconds)`
`void` | `setSecureCookies(boolean secureCookies)`
`void` | `setSessionCookie(String cookieName)`
`void` | `setSessionDomain(String domain)`
`void` | `setSessionHandler(SessionHandler sessionHandler)`
`void` | `setSessionPath(String path)`
`void` | `setSessionURL(String url)`
`void` | `setUsingCookies(boolean usingCookies)`

Methods inherited from class org.mortbay.component.AbstractLifeCycle
`isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, start, stop`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.mortbay.component.LifeCycle
`isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, start, stop`

Field Detail

### __distantFuture

    public static final int __distantFuture

See Also:
  Constant Field Values

### _dftMaxIdleSecs

    protected int _dftMaxIdleSecs

### _sessionHandler

    protected SessionHandler _sessionHandler

### _httpOnly

    protected boolean _httpOnly

### _maxSessions

    protected int _maxSessions

### _minSessions

    protected int _minSessions

### _sessionIdManager

    protected SessionIdManager _sessionIdManager

### _secureCookies

    protected boolean _secureCookies

### _sessionAttributeListeners

    protected Object _sessionAttributeListeners

### _sessionListeners

    protected Object _sessionListeners

### _loader

    protected ClassLoader _loader

### _context

    protected ContextHandler.SContext _context

### _sessionCookie

    protected String _sessionCookie

### _sessionURL

    protected String _sessionURL

### _sessionURLPrefix

    protected String _sessionURLPrefix

### _sessionDomain

    protected String _sessionDomain

### _sessionPath

    protected String _sessionPath

### _maxCookieAge

    protected int _maxCookieAge

### _refreshCookieAge

    protected int _refreshCookieAge

Constructor Detail

### AbstractSessionManager

    public AbstractSessionManager()

Method Detail

### access

    public Cookie access(HttpSession session,
                         boolean secure)

  Description copied from interface: `SessionManager`
  Called by the `SessionHandler` when a session is access by a request

  Specified by:
    `access` in interface `SessionManager`
  Returns:
    Cookie If non null, this cookie should be set on the response to either migrate the session or to refresh a cookie that may expire.

### addEventListener

    public void addEventListener(EventListener listener)

  Description copied from interface: `SessionManager`
  Add an event listener.

  Specified by:
    `addEventListener` in interface `SessionManager`
  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

### clearEventListeners

    public void clearEventListeners()

  Specified by:
    `clearEventListeners` in interface `SessionManager`

### complete

    public void complete(HttpSession session)

  Description copied from interface: `SessionManager`
  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)`.

  Specified by:
    `complete` in interface `SessionManager`

### doStart

    public void doStart()
                 throws Exception

  Overrides:
    `doStart` in class `AbstractLifeCycle`
  Throws:
    `Exception`

### doStop

    public void doStop()
                throws Exception

  Overrides:
    `doStop` in class `AbstractLifeCycle`
  Throws:
    `Exception`

### getHttpOnly

    public boolean getHttpOnly()

  Specified by:
    `getHttpOnly` in interface `SessionManager`
  Returns:
    Returns the httpOnly.

### getHttpSession

    public HttpSession getHttpSession(String id)

  Specified by:
    `getHttpSession` in interface `SessionManager`

### getIdManager

    public SessionIdManager getIdManager()

  Returns:
    Returns the metaManager used for cross context session management

### getMaxCookieAge

    public int getMaxCookieAge()

  Specified by:
    `getMaxCookieAge` in interface `SessionManager`

### getMaxInactiveInterval

    public int getMaxInactiveInterval()

  Specified by:
    `getMaxInactiveInterval` in interface `SessionManager`
  Returns:
    seconds

### getMaxSessions

    public int getMaxSessions()

### getMetaManager

    public SessionIdManager getMetaManager()

  Deprecated. use `getIdManager()`

  Specified by:
    `getMetaManager` in interface `SessionManager`
  Returns:
    the cross context session meta manager.

### getMinSessions

    public int getMinSessions()

### getRefreshCookieAge

    public int getRefreshCookieAge()

### getSecureCookies

    public boolean getSecureCookies()

  Specified by:
    `getSecureCookies` in interface `SessionManager`
  Returns:
    Returns the secureCookies.

### getSessionCookie

    public String getSessionCookie()

  Specified by:
    `getSessionCookie` in interface `SessionManager`

### getSessionCookie

    public Cookie getSessionCookie(HttpSession session,
                                   String contextPath,
                                   boolean requestIsSecure)

  Description copied from interface: `SessionManager`
  Get a Cookie for a session.

  Specified by:
    `getSessionCookie` in interface `SessionManager`
  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`.

### getSessionDomain

    public String getSessionDomain()

  Specified by:
    `getSessionDomain` in interface `SessionManager`

### getSessionHandler

    public SessionHandler getSessionHandler()

  Returns:
    Returns the sessionHandler.

### getSessionMap

    public abstract Map getSessionMap()

### getSessionPath

    public String getSessionPath()

  Specified by:
    `getSessionPath` in interface `SessionManager`

### getSessions

    public abstract int getSessions()

### getSessionURL

    public String getSessionURL()

  Specified by:
    `getSessionURL` in interface `SessionManager`

### getSessionURLPrefix

    public String getSessionURLPrefix()

  Specified by:
    `getSessionURLPrefix` in interface `SessionManager`

### isUsingCookies

    public boolean isUsingCookies()

  Returns:
    Returns the usingCookies.

### isValid

    public boolean isValid(HttpSession session)

  Specified by:
    `isValid` in interface `SessionManager`

### newHttpSession

    public HttpSession newHttpSession(HttpServletRequest request)

  Create a new HttpSession for a request

  Specified by:
    `newHttpSession` in interface `SessionManager`

### removeEventListener

    public void removeEventListener(EventListener listener)

  Specified by:
    `removeEventListener` in interface `SessionManager`

### resetStats

    public void resetStats()

### setHttpOnly

    public void setHttpOnly(boolean httpOnly)

  Parameters:
    `httpOnly` - The httpOnly to set.

### setIdManager

    public void setIdManager(SessionIdManager metaManager)

  Specified by:
    `setIdManager` in interface `SessionManager`
  Parameters:
    `metaManager` - The metaManager used for cross context session management.

### setMaxCookieAge

    public void setMaxCookieAge(int maxCookieAgeInSeconds)

  Specified by:
    `setMaxCookieAge` in interface `SessionManager`

### setMaxInactiveInterval

    public void setMaxInactiveInterval(int seconds)

  Specified by:
    `setMaxInactiveInterval` in interface `SessionManager`
  Parameters:
    `seconds` -

### setMetaManager

    public void setMetaManager(SessionIdManager metaManager)

  Deprecated. use `setIdManager(SessionIdManager)`

### setRefreshCookieAge

    public void setRefreshCookieAge(int ageInSeconds)

### setSecureCookies

    public void setSecureCookies(boolean secureCookies)

  Parameters:
    `secureCookies` - The secureCookies to set.

### setSessionCookie

    public void setSessionCookie(String cookieName)

  Specified by:
    `setSessionCookie` in interface `SessionManager`

### setSessionDomain

    public void setSessionDomain(String domain)

  Specified by:
    `setSessionDomain` in interface `SessionManager`

### setSessionHandler

    public void setSessionHandler(SessionHandler sessionHandler)

  Specified by:
    `setSessionHandler` in interface `SessionManager`
  Parameters:
    `sessionHandler` - The sessionHandler to set.

### setSessionPath

    public void setSessionPath(String path)

  Specified by:
    `setSessionPath` in interface `SessionManager`

### setSessionURL

    public void setSessionURL(String url)

  Specified by:
    `setSessionURL` in interface `SessionManager`

### setUsingCookies

    public void setUsingCookies(boolean usingCookies)

  Parameters:
    `usingCookies` - The usingCookies to set.

### addSession

    protected abstract void addSession(AbstractSessionManager.Session session)

### addSession

    protected void addSession(AbstractSessionManager.Session session,
                              boolean created)

  Add the session Registers the session with this manager and registers the session ID with the sessionIDManager;

### getSession

    protected abstract AbstractSessionManager.Session getSession(String idInCluster)

  Get a known existingsession

  Parameters:
    `idInCluster` - The session ID in the cluster, stripped of any worker name.
  Returns:
    A Session or null if none exists.

### invalidateSessions

    protected abstract void invalidateSessions()

### newSession

    protected abstract AbstractSessionManager.Session newSession(HttpServletRequest request)

  Create a new session instance

  Parameters:
    `request` -
  Returns:

### newSessionMap

    protected final void newSessionMap()

### removeSession

    protected void removeSession(AbstractSessionManager.Session session,
                                 boolean invalidate)

  Remove session from manager

  Parameters:
    `session` - The session to remove
    `invalidate` - True if `HttpSessionListener.sessionDestroyed(HttpSessionEvent)` and `SessionIdManager.invalidateAll(String)` should be called.

### removeSession

    protected abstract void removeSession(String idInCluster)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2007 Mort Bay Consulting. All Rights Reserved.