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
Interface SessionManager

All Superinterfaces:
  LifeCycle

All Known Implementing Classes:
  AbstractSessionManager, HashSessionManager, TerracottaSessionManager

    public interface SessionManager

extends LifeCycle

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

Author:
  Greg Wilkins

Nested Class Summary

Nested classes/interfaces inherited from interface org.mortbay.component.LifeCycle
`LifeCycle.Listener`

Field Summary
`static java.lang.String` | `__DefaultSessionCookie`
`static java.lang.String` | `__DefaultSessionDomain`
`static java.lang.String` | `__DefaultSessionURL`
`static java.lang.String` | `__MaxAgeProperty` Session Max Age.
`static java.lang.String` | `__SessionCookieProperty` Session cookie name.
`static java.lang.String` | `__SessionDomainProperty` Session Domain.
`static java.lang.String` | `__SessionPathProperty` Session Path.
`static java.lang.String` | `__SessionURLProperty` Session URL parameter name.

Method Summary
`javax.servlet.http.Cookie` | `access(javax.servlet.http.HttpSession session, boolean secure)` Called by the `SessionHandler` when a session is access by a request
`void` | `addEventListener(java.util.EventListener listener)` Add an event listener.
`void` | `clearEventListeners()`
`void` | `complete(javax.servlet.http.HttpSession session)` Called by the `SessionHandler` when a reqeuest is not longer handling a session.
`java.lang.String` | `getClusterId(javax.servlet.http.HttpSession session)` Get the session cluster id
`boolean` | `getHttpOnly()`
`javax.servlet.http.HttpSession` | `getHttpSession(java.lang.String id)`
`SessionIdManager` | `getIdManager()`
`int` | `getMaxCookieAge()`
`int` | `getMaxInactiveInterval()`
`SessionIdManager` | `getMetaManager()` Deprecated. use `getIdManager()`
`java.lang.String` | `getNodeId(javax.servlet.http.HttpSession session)` Get the session node id
`boolean` | `getSecureCookies()`
`java.lang.String` | `getSessionCookie()`
`javax.servlet.http.Cookie` | `getSessionCookie(javax.servlet.http.HttpSession session, java.lang.String contextPath, boolean requestIsSecure)` Get a Cookie for a session.
`java.lang.String` | `getSessionDomain()`
`java.lang.String` | `getSessionPath()`
`java.lang.String` | `getSessionURL()`
`java.lang.String` | `getSessionURLPrefix()`
`boolean` | `isUsingCookies()`
`boolean` | `isValid(javax.servlet.http.HttpSession session)`
`javax.servlet.http.HttpSession` | `newHttpSession(javax.servlet.http.HttpServletRequest request)`
`void` | `removeEventListener(java.util.EventListener listener)`
`void` | `setIdManager(SessionIdManager meta)`
`void` | `setMaxCookieAge(int maxCookieAgeInSeconds)`
`void` | `setMaxInactiveInterval(int seconds)`
`void` | `setSessionCookie(java.lang.String cookieName)`
`void` | `setSessionDomain(java.lang.String domain)`
`void` | `setSessionHandler(SessionHandler handler)`
`void` | `setSessionPath(java.lang.String path)`
`void` | `setSessionURL(java.lang.String url)`

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

Field Detail

### __SessionCookieProperty

    static final java.lang.String __SessionCookieProperty

  Session cookie name. Defaults to JSESSIONID, but can be set with the org.mortbay.jetty.servlet.SessionCookie context init parameter.

  See Also:
    Constant Field Values

### __DefaultSessionCookie

    static final java.lang.String __DefaultSessionCookie

See Also:
  Constant Field Values

### __SessionURLProperty

    static final java.lang.String __SessionURLProperty

  Session URL parameter name. Defaults to jsessionid, but can be set with the org.mortbay.jetty.servlet.SessionURL context init parameter. If set to null or "none" no URL rewriting will be done.

  See Also:
    Constant Field Values

### __DefaultSessionURL

    static final java.lang.String __DefaultSessionURL

See Also:
  Constant Field Values

### __SessionDomainProperty

    static final java.lang.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

    static final java.lang.String __DefaultSessionDomain

### __SessionPathProperty

    static final java.lang.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

    static final java.lang.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

Method Detail

### getHttpSession

    javax.servlet.http.HttpSession getHttpSession(java.lang.String id)

### newHttpSession

    javax.servlet.http.HttpSession newHttpSession(javax.servlet.http.HttpServletRequest request)

### getSecureCookies

    boolean getSecureCookies()

  Returns:
    true if session cookies should be secure

### getHttpOnly

    boolean getHttpOnly()

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

### getMaxInactiveInterval

    int getMaxInactiveInterval()

### setMaxInactiveInterval

    void setMaxInactiveInterval(int seconds)

### setSessionHandler

    void setSessionHandler(SessionHandler handler)

### addEventListener

    void addEventListener(java.util.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

    void removeEventListener(java.util.EventListener listener)

### clearEventListeners

    void clearEventListeners()

### getSessionCookie

    javax.servlet.http.Cookie getSessionCookie(javax.servlet.http.HttpSession session,
                                               java.lang.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`.

### getIdManager

    SessionIdManager getIdManager()

  Returns:
    the cross context session meta manager.

### getMetaManager

    SessionIdManager getMetaManager()

  Deprecated. use `getIdManager()`

  Returns:
    the cross context session id manager.

### setIdManager

    void setIdManager(SessionIdManager meta)

  Parameters:
    `meta` - the cross context session meta manager.

### isValid

    boolean isValid(javax.servlet.http.HttpSession session)

### getNodeId

    java.lang.String getNodeId(javax.servlet.http.HttpSession session)

  Get the session node id

  Parameters:
    `session` -
  Returns:
    The unique id of the session within the cluster, extended with an optional node id.

### getClusterId

    java.lang.String getClusterId(javax.servlet.http.HttpSession session)

  Get the session cluster id

  Parameters:
    `session` -
  Returns:
    The unique id of the session within the cluster (without a node id extension)

### access

    javax.servlet.http.Cookie access(javax.servlet.http.HttpSession session,
                                     boolean secure)

  Called by the `SessionHandler` when a session is access by a request

  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.

### complete

    void complete(javax.servlet.http.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

    void setSessionCookie(java.lang.String cookieName)

### getSessionCookie

    java.lang.String getSessionCookie()

### setSessionURL

    void setSessionURL(java.lang.String url)

### getSessionURL

    java.lang.String getSessionURL()

### getSessionURLPrefix

    java.lang.String getSessionURLPrefix()

### setSessionDomain

    void setSessionDomain(java.lang.String domain)

### getSessionDomain

    java.lang.String getSessionDomain()

### setSessionPath

    void setSessionPath(java.lang.String path)

### getSessionPath

    java.lang.String getSessionPath()

### setMaxCookieAge

    void setMaxCookieAge(int maxCookieAgeInSeconds)

### getMaxCookieAge

    int getMaxCookieAge()

### isUsingCookies

    boolean isUsingCookies()

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 © 1995-2010 Mort Bay Consulting. All Rights Reserved.