Class JettyWebSocketServerContainer

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.ee11.websocket.server.JettyWebSocketServerContainer
All Implemented Interfaces:
EventListener, 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.component.LifeCycle.Listener, org.eclipse.jetty.websocket.api.Configurable, org.eclipse.jetty.websocket.api.WebSocketContainer

public class JettyWebSocketServerContainer extends org.eclipse.jetty.util.component.ContainerLifeCycle implements org.eclipse.jetty.websocket.api.WebSocketContainer, org.eclipse.jetty.websocket.api.Configurable, org.eclipse.jetty.util.component.LifeCycle.Listener
  • Nested Class Summary

    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, org.eclipse.jetty.util.component.Dumpable.DumpAppendable

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

    org.eclipse.jetty.util.component.LifeCycle.Listener
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     

    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

    LEGEND
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addMapping(String pathSpec, Class<?> endpointClass)
     
    void
     
    void
    addSessionListener(org.eclipse.jetty.websocket.api.WebSocketSessionListener listener)
     
    void
    dump(Appendable out, String indent)
     
    ensureContainer(jakarta.servlet.ServletContext servletContext)
     
    getContainer(jakarta.servlet.ServletContext servletContext)
     
     
     
    int
     
    long
     
    long
     
    int
     
    long
     
    Collection<org.eclipse.jetty.websocket.api.Session>
     
    int
     
    boolean
     
    void
    notifySessionListeners(Consumer<org.eclipse.jetty.websocket.api.WebSocketSessionListener> consumer)
     
    boolean
    removeSessionListener(org.eclipse.jetty.websocket.api.WebSocketSessionListener listener)
     
    void
    setAutoFragment(boolean autoFragment)
     
    void
     
    void
     
    void
     
    void
    setMaxFrameSize(long maxFrameSize)
     
    void
    setMaxOutgoingFrames(int maxOutgoingFrames)
     
    void
     
    void
     
    boolean
    upgrade(JettyWebSocketCreator creator, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
    An immediate programmatic WebSocket upgrade that does not register a mapping or create a WebSocketUpgradeFilter.

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

    addBean, addBean, addEventListener, addManaged, contains, destroy, doStart, doStop, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, 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.Dumpable

    dumpSelf

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

    isDumpable

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

    lifeCycleFailure, lifeCycleStarted, lifeCycleStarting, lifeCycleStopped, lifeCycleStopping
  • Field Details

    • JETTY_WEBSOCKET_CONTAINER_ATTRIBUTE

      public static final String JETTY_WEBSOCKET_CONTAINER_ATTRIBUTE
  • Method Details

    • getContainer

      public static JettyWebSocketServerContainer getContainer(jakarta.servlet.ServletContext servletContext)
    • ensureContainer

      public static JettyWebSocketServerContainer ensureContainer(jakarta.servlet.ServletContext servletContext)
    • addMapping

      public void addMapping(String pathSpec, JettyWebSocketCreator creator)
    • addMapping

      public void addMapping(String pathSpec, Class<?> endpointClass)
    • upgrade

      public boolean upgrade(JettyWebSocketCreator creator, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException
      An immediate programmatic WebSocket upgrade that does not register a mapping or create a WebSocketUpgradeFilter.

      A return value of true means the connection was Upgraded to WebSocket or an error response is being generated. A return value of false means that it was a bad upgrade request and couldn't be upgraded to WebSocket and the caller is responsible for generating the response.

      Parameters:
      creator - the WebSocketCreator to use.
      request - the HttpServletRequest.
      response - the HttpServletResponse.
      Returns:
      true if the connection could be upgraded or an error was sent.
      Throws:
      IOException - if an I/O error occurs.
    • getExecutor

      public Executor getExecutor()
      Specified by:
      getExecutor in interface org.eclipse.jetty.websocket.api.WebSocketContainer
    • addSessionListener

      public void addSessionListener(org.eclipse.jetty.websocket.api.WebSocketSessionListener listener)
      Specified by:
      addSessionListener in interface org.eclipse.jetty.websocket.api.WebSocketContainer
    • removeSessionListener

      public boolean removeSessionListener(org.eclipse.jetty.websocket.api.WebSocketSessionListener listener)
      Specified by:
      removeSessionListener in interface org.eclipse.jetty.websocket.api.WebSocketContainer
    • notifySessionListeners

      public void notifySessionListeners(Consumer<org.eclipse.jetty.websocket.api.WebSocketSessionListener> consumer)
      Specified by:
      notifySessionListeners in interface org.eclipse.jetty.websocket.api.WebSocketContainer
    • getOpenSessions

      public Collection<org.eclipse.jetty.websocket.api.Session> getOpenSessions()
      Specified by:
      getOpenSessions in interface org.eclipse.jetty.websocket.api.WebSocketContainer
    • getIdleTimeout

      public Duration getIdleTimeout()
      Specified by:
      getIdleTimeout in interface org.eclipse.jetty.websocket.api.Configurable
    • setIdleTimeout

      public void setIdleTimeout(Duration duration)
      Specified by:
      setIdleTimeout in interface org.eclipse.jetty.websocket.api.Configurable
    • getInputBufferSize

      public int getInputBufferSize()
      Specified by:
      getInputBufferSize in interface org.eclipse.jetty.websocket.api.Configurable
    • setInputBufferSize

      public void setInputBufferSize(int size)
      Specified by:
      setInputBufferSize in interface org.eclipse.jetty.websocket.api.Configurable
    • getOutputBufferSize

      public int getOutputBufferSize()
      Specified by:
      getOutputBufferSize in interface org.eclipse.jetty.websocket.api.Configurable
    • setOutputBufferSize

      public void setOutputBufferSize(int size)
      Specified by:
      setOutputBufferSize in interface org.eclipse.jetty.websocket.api.Configurable
    • getMaxBinaryMessageSize

      public long getMaxBinaryMessageSize()
      Specified by:
      getMaxBinaryMessageSize in interface org.eclipse.jetty.websocket.api.Configurable
    • setMaxBinaryMessageSize

      public void setMaxBinaryMessageSize(long size)
      Specified by:
      setMaxBinaryMessageSize in interface org.eclipse.jetty.websocket.api.Configurable
    • getMaxTextMessageSize

      public long getMaxTextMessageSize()
      Specified by:
      getMaxTextMessageSize in interface org.eclipse.jetty.websocket.api.Configurable
    • setMaxTextMessageSize

      public void setMaxTextMessageSize(long size)
      Specified by:
      setMaxTextMessageSize in interface org.eclipse.jetty.websocket.api.Configurable
    • getMaxFrameSize

      public long getMaxFrameSize()
      Specified by:
      getMaxFrameSize in interface org.eclipse.jetty.websocket.api.Configurable
    • setMaxFrameSize

      public void setMaxFrameSize(long maxFrameSize)
      Specified by:
      setMaxFrameSize in interface org.eclipse.jetty.websocket.api.Configurable
    • isAutoFragment

      public boolean isAutoFragment()
      Specified by:
      isAutoFragment in interface org.eclipse.jetty.websocket.api.Configurable
    • setAutoFragment

      public void setAutoFragment(boolean autoFragment)
      Specified by:
      setAutoFragment in interface org.eclipse.jetty.websocket.api.Configurable
    • getMaxOutgoingFrames

      public int getMaxOutgoingFrames()
      Specified by:
      getMaxOutgoingFrames in interface org.eclipse.jetty.websocket.api.Configurable
    • setMaxOutgoingFrames

      public void setMaxOutgoingFrames(int maxOutgoingFrames)
      Specified by:
      setMaxOutgoingFrames in interface org.eclipse.jetty.websocket.api.Configurable
    • dump

      public void dump(Appendable out, String indent) throws IOException
      Specified by:
      dump in interface org.eclipse.jetty.util.component.Dumpable
      Overrides:
      dump in class org.eclipse.jetty.util.component.ContainerLifeCycle
      Throws:
      IOException