Class SessionHandler

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.session.AbstractSessionManager
org.eclipse.jetty.ee10.servlet.SessionHandler
All Implemented Interfaces:
org.eclipse.jetty.server.Handler, org.eclipse.jetty.server.Handler.Container, org.eclipse.jetty.server.Handler.Singleton, org.eclipse.jetty.server.Request.Handler, org.eclipse.jetty.session.SessionConfig, org.eclipse.jetty.session.SessionConfig.Mutable, org.eclipse.jetty.session.SessionManager, org.eclipse.jetty.util.component.Container, org.eclipse.jetty.util.component.Destroyable, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.LifeCycle, org.eclipse.jetty.util.thread.Invocable

public class SessionHandler extends org.eclipse.jetty.session.AbstractSessionManager implements org.eclipse.jetty.server.Handler.Singleton
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    final class 
    CookieConfig Implementation of the jakarta.servlet.SessionCookieConfig.
    static class 
     

    Nested classes/interfaces inherited from class org.eclipse.jetty.session.AbstractSessionManager

    org.eclipse.jetty.session.AbstractSessionManager.RequestedSession

    Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopException

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container

    org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.Listener

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable

    org.eclipse.jetty.util.component.Dumpable.DumpableContainer

    Nested classes/interfaces inherited from interface org.eclipse.jetty.server.Handler

    org.eclipse.jetty.server.Handler.Abstract, org.eclipse.jetty.server.Handler.AbstractContainer, org.eclipse.jetty.server.Handler.Collection, org.eclipse.jetty.server.Handler.Container, org.eclipse.jetty.server.Handler.Sequence, org.eclipse.jetty.server.Handler.Singleton, org.eclipse.jetty.server.Handler.Wrapper

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable

    org.eclipse.jetty.util.thread.Invocable.Callable, org.eclipse.jetty.util.thread.Invocable.InvocationType, org.eclipse.jetty.util.thread.Invocable.ReadyTask, org.eclipse.jetty.util.thread.Invocable.Task

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

    org.eclipse.jetty.util.component.LifeCycle.Listener

    Nested classes/interfaces inherited from interface org.eclipse.jetty.server.Request.Handler

    org.eclipse.jetty.server.Request.Handler.AbortException

    Nested classes/interfaces inherited from interface org.eclipse.jetty.session.SessionConfig

    org.eclipse.jetty.session.SessionConfig.Mutable
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final EnumSet<jakarta.servlet.SessionTrackingMode>
     

    Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    FAILED, STARTED, STARTING, STOPPED, STOPPING

    Fields inherited from interface org.eclipse.jetty.util.component.Dumpable

    KEY

    Fields inherited from interface org.eclipse.jetty.util.thread.Invocable

    __nonBlocking, NOOP

    Fields inherited from interface org.eclipse.jetty.session.SessionConfig

    __CheckRemoteSessionEncodingProperty, __DefaultSessionCookie, __DefaultSessionDomain, __DefaultSessionIdPathParameterName, __MaxAgeProperty, __SessionCookieProperty, __SessionDomainProperty, __SessionIdPathParameterNameProperty, __SessionPathProperty
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Adds an event listener for session-related events.
    protected void
    callBoundBindingListener(org.eclipse.jetty.server.Session session, String name, Object value)
     
    protected void
    callUnboundBindingListener(org.eclipse.jetty.server.Session session, String name, Object value)
     
    protected void
    Set up cookie configuration based on init params
    void
     
    Set<jakarta.servlet.SessionTrackingMode>
     
    Set<jakarta.servlet.SessionTrackingMode>
     
    org.eclipse.jetty.server.Handler
     
    org.eclipse.jetty.util.thread.Invocable.InvocationType
     
    org.eclipse.jetty.session.ManagedSession
    getManagedSession(org.eclipse.jetty.server.Request request)
     
    org.eclipse.jetty.http.HttpCookie.SameSite
     
    org.eclipse.jetty.server.Server
     
    jakarta.servlet.SessionCookieConfig
     
    boolean
    handle(org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response, org.eclipse.jetty.util.Callback callback)
     
    org.eclipse.jetty.server.Session.API
    newSessionAPIWrapper(org.eclipse.jetty.session.ManagedSession session)
     
    void
    onSessionActivation(org.eclipse.jetty.server.Session session)
     
    void
    onSessionAttributeUpdate(org.eclipse.jetty.server.Session session, String name, Object old, Object value)
     
    void
    onSessionCreated(org.eclipse.jetty.server.Session session)
    Call the session lifecycle listeners in the order they were added.
    void
    onSessionDestroyed(org.eclipse.jetty.server.Session session)
    Call the session lifecycle listeners in the reverse order they were added.
    void
    onSessionIdChanged(org.eclipse.jetty.server.Session session, String oldId)
     
    void
    onSessionPassivation(org.eclipse.jetty.server.Session session)
     
    boolean
     
    void
    setHandler(org.eclipse.jetty.server.Handler handler)
     
    void
    setSameSite(org.eclipse.jetty.http.HttpCookie.SameSite sameSite)
    Set Session cookie sameSite mode.
    void
    setServer(org.eclipse.jetty.server.Server server)
     
    void
    setSessionTrackingModes(Set<jakarta.servlet.SessionTrackingMode> sessionTrackingModes)
     

    Methods inherited from class org.eclipse.jetty.session.AbstractSessionManager

    access, addSessionStreamWrapper, calculateInactivityTimeout, commit, complete, doStop, encodeURI, getContext, getManagedSession, getMaxCookieAge, getMaxInactiveInterval, getRefreshCookieAge, getSessionCache, getSessionComment, getSessionContext, getSessionCookie, getSessionCookie, getSessionCookieAttribute, getSessionCookieAttributes, getSessionDomain, getSessionIdManager, getSessionIdPathParameterName, getSessionIdPathParameterNamePrefix, getSessionPath, getSessionsCreated, getSessionTimeMean, getSessionTimeStdDev, getSessionTimeTotal, invalidate, isCheckingRemoteSessionIdEncoding, isHttpOnly, isIdInUse, isPartitioned, isSecureCookies, isSecureRequestOnly, isUsingCookies, isUsingUriParameters, isUsingURLs, newSession, newSessionInactivityTimer, recordSessionTime, renewSessionId, resolveRequestedSessionId, scavenge, sessionTimerExpired, setCheckingRemoteSessionIdEncoding, setHttpOnly, setMaxCookieAge, setMaxInactiveInterval, setPartitioned, setRefreshCookieAge, setSecureCookies, setSecureRequestOnly, setSessionCache, setSessionComment, setSessionCookie, setSessionCookieAttribute, setSessionDomain, setSessionIdManager, setSessionIdPathParameterName, setSessionPath, setUsingCookies, setUsingUriParameters, setUsingURLs

    Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle

    addBean, addBean, addManaged, contains, destroy, dump, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeans

    Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stop, toString

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.eclipse.jetty.util.component.Container

    getCachedBeans, getEventListeners

    Methods inherited from interface org.eclipse.jetty.util.component.Destroyable

    destroy

    Methods inherited from interface org.eclipse.jetty.util.component.Dumpable

    dumpSelf

    Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer

    isDumpable

    Methods inherited from interface org.eclipse.jetty.server.Handler.Container

    getContainer, getDescendant, getDescendants, getDescendants

    Methods inherited from interface org.eclipse.jetty.server.Handler.Singleton

    getHandlers, getTail, insertHandler, setHandler

    Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle

    isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, start, stop
  • Field Details

    • DEFAULT_SESSION_TRACKING_MODES

      public static final EnumSet<jakarta.servlet.SessionTrackingMode> DEFAULT_SESSION_TRACKING_MODES
  • Constructor Details

    • SessionHandler

      public SessionHandler()
  • Method Details

    • setServer

      public void setServer(org.eclipse.jetty.server.Server server)
      Specified by:
      setServer in interface org.eclipse.jetty.server.Handler
    • getInvocationType

      public org.eclipse.jetty.util.thread.Invocable.InvocationType getInvocationType()
      Specified by:
      getInvocationType in interface org.eclipse.jetty.util.thread.Invocable
      Specified by:
      getInvocationType in interface org.eclipse.jetty.server.Request.Handler
    • getHandler

      public org.eclipse.jetty.server.Handler getHandler()
      Specified by:
      getHandler in interface org.eclipse.jetty.server.Handler.Singleton
    • setHandler

      public void setHandler(org.eclipse.jetty.server.Handler handler)
      Specified by:
      setHandler in interface org.eclipse.jetty.server.Handler.Singleton
    • getServer

      public org.eclipse.jetty.server.Server getServer()
      Specified by:
      getServer in interface org.eclipse.jetty.server.Handler
      Specified by:
      getServer in class org.eclipse.jetty.session.AbstractSessionManager
    • getManagedSession

      public org.eclipse.jetty.session.ManagedSession getManagedSession(org.eclipse.jetty.server.Request request)
      Specified by:
      getManagedSession in interface org.eclipse.jetty.session.SessionManager
    • addEventListener

      public boolean addEventListener(EventListener listener)
      Adds an event listener for session-related events.
      Specified by:
      addEventListener in interface org.eclipse.jetty.util.component.Container
      Specified by:
      addEventListener in interface org.eclipse.jetty.util.component.LifeCycle
      Overrides:
      addEventListener in class org.eclipse.jetty.util.component.ContainerLifeCycle
      Parameters:
      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.
      Returns:
      true if the listener was added
      See Also:
    • removeEventListener

      public boolean removeEventListener(EventListener listener)
      Specified by:
      removeEventListener in interface org.eclipse.jetty.util.component.Container
      Specified by:
      removeEventListener in interface org.eclipse.jetty.util.component.LifeCycle
      Overrides:
      removeEventListener in class org.eclipse.jetty.util.component.ContainerLifeCycle
    • doStart

      public void doStart() throws Exception
      Overrides:
      doStart in class org.eclipse.jetty.session.AbstractSessionManager
      Throws:
      Exception
    • configureCookies

      protected void configureCookies()
      Set up cookie configuration based on init params
    • newSessionAPIWrapper

      public org.eclipse.jetty.server.Session.API newSessionAPIWrapper(org.eclipse.jetty.session.ManagedSession session)
      Specified by:
      newSessionAPIWrapper in interface org.eclipse.jetty.session.SessionManager
    • onSessionAttributeUpdate

      public void onSessionAttributeUpdate(org.eclipse.jetty.server.Session session, String name, Object old, Object value)
      Specified by:
      onSessionAttributeUpdate in interface org.eclipse.jetty.session.SessionManager
    • onSessionCreated

      public void onSessionCreated(org.eclipse.jetty.server.Session session)
      Call the session lifecycle listeners in the order they were added.
      Specified by:
      onSessionCreated in interface org.eclipse.jetty.session.SessionManager
      Overrides:
      onSessionCreated in class org.eclipse.jetty.session.AbstractSessionManager
      Parameters:
      session - the session on which to call the lifecycle listeners
    • onSessionDestroyed

      public void onSessionDestroyed(org.eclipse.jetty.server.Session session)
      Call the session lifecycle listeners in the reverse order they were added.
      Specified by:
      onSessionDestroyed in interface org.eclipse.jetty.session.SessionManager
      Overrides:
      onSessionDestroyed in class org.eclipse.jetty.session.AbstractSessionManager
      Parameters:
      session - the session on which to call the lifecycle listeners
    • onSessionIdChanged

      public void onSessionIdChanged(org.eclipse.jetty.server.Session session, String oldId)
      Specified by:
      onSessionIdChanged in interface org.eclipse.jetty.session.SessionManager
      Overrides:
      onSessionIdChanged in class org.eclipse.jetty.session.AbstractSessionManager
    • callUnboundBindingListener

      protected void callUnboundBindingListener(org.eclipse.jetty.server.Session session, String name, Object value)
    • callBoundBindingListener

      protected void callBoundBindingListener(org.eclipse.jetty.server.Session session, String name, Object value)
    • onSessionActivation

      public void onSessionActivation(org.eclipse.jetty.server.Session session)
      Specified by:
      onSessionActivation in interface org.eclipse.jetty.session.SessionManager
    • onSessionPassivation

      public void onSessionPassivation(org.eclipse.jetty.server.Session session)
      Specified by:
      onSessionPassivation in interface org.eclipse.jetty.session.SessionManager
    • getSessionCookieConfig

      public jakarta.servlet.SessionCookieConfig getSessionCookieConfig()
    • getDefaultSessionTrackingModes

      public Set<jakarta.servlet.SessionTrackingMode> getDefaultSessionTrackingModes()
    • getEffectiveSessionTrackingModes

      public Set<jakarta.servlet.SessionTrackingMode> getEffectiveSessionTrackingModes()
    • getSameSite

      public org.eclipse.jetty.http.HttpCookie.SameSite getSameSite()
      Specified by:
      getSameSite in interface org.eclipse.jetty.session.SessionConfig
      Overrides:
      getSameSite in class org.eclipse.jetty.session.AbstractSessionManager
    • setSameSite

      public void setSameSite(org.eclipse.jetty.http.HttpCookie.SameSite sameSite)
      Set Session cookie sameSite mode. In ee10 this is set as a generic session cookie attribute.
      Specified by:
      setSameSite in interface org.eclipse.jetty.session.SessionConfig.Mutable
      Overrides:
      setSameSite in class org.eclipse.jetty.session.AbstractSessionManager
      Parameters:
      sameSite - The sameSite setting for Session cookies (or null for no sameSite setting)
    • setSessionTrackingModes

      public void setSessionTrackingModes(Set<jakarta.servlet.SessionTrackingMode> sessionTrackingModes)
    • handle

      public boolean handle(org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response, org.eclipse.jetty.util.Callback callback) throws Exception
      Specified by:
      handle in interface org.eclipse.jetty.server.Request.Handler
      Throws:
      Exception