Class JettyWebSocketServerContainer

  • All Implemented Interfaces:
    java.util.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.WebSocketContainer, org.eclipse.jetty.websocket.api.WebSocketPolicy

    public class JettyWebSocketServerContainer
    extends org.eclipse.jetty.util.component.ContainerLifeCycle
    implements org.eclipse.jetty.websocket.api.WebSocketContainer, org.eclipse.jetty.websocket.api.WebSocketPolicy, 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
      • 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 java.lang.String JETTY_WEBSOCKET_CONTAINER_ATTRIBUTE  
      • 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
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addMapping​(java.lang.String pathSpec, java.lang.Class<?> endpointClass)  
      void addMapping​(java.lang.String pathSpec, JettyWebSocketCreator creator)  
      void addSessionListener​(org.eclipse.jetty.websocket.api.WebSocketSessionListener listener)  
      void dump​(java.lang.Appendable out, java.lang.String indent)  
      static JettyWebSocketServerContainer ensureContainer​(jakarta.servlet.ServletContext servletContext)  
      org.eclipse.jetty.websocket.api.WebSocketBehavior getBehavior()  
      static JettyWebSocketServerContainer getContainer​(jakarta.servlet.ServletContext servletContext)  
      java.util.concurrent.Executor getExecutor()  
      java.time.Duration getIdleTimeout()  
      int getInputBufferSize()  
      long getMaxBinaryMessageSize()  
      long getMaxFrameSize()  
      long getMaxTextMessageSize()  
      java.util.Collection<org.eclipse.jetty.websocket.api.Session> getOpenSessions()  
      int getOutputBufferSize()  
      boolean isAutoFragment()  
      void notifySessionListeners​(java.util.function.Consumer<org.eclipse.jetty.websocket.api.WebSocketSessionListener> consumer)  
      boolean removeSessionListener​(org.eclipse.jetty.websocket.api.WebSocketSessionListener listener)  
      void setAutoFragment​(boolean autoFragment)  
      void setIdleTimeout​(java.time.Duration duration)  
      void setInputBufferSize​(int size)  
      void setMaxBinaryMessageSize​(long size)  
      void setMaxFrameSize​(long maxFrameSize)  
      void setMaxTextMessageSize​(long size)  
      void setOutputBufferSize​(int size)  
      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, 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 java.lang.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 Detail

      • JETTY_WEBSOCKET_CONTAINER_ATTRIBUTE

        public static final java.lang.String JETTY_WEBSOCKET_CONTAINER_ATTRIBUTE
    • Method Detail

      • addMapping

        public void addMapping​(java.lang.String pathSpec,
                               java.lang.Class<?> endpointClass)
      • upgrade

        public boolean upgrade​(JettyWebSocketCreator creator,
                               jakarta.servlet.http.HttpServletRequest request,
                               jakarta.servlet.http.HttpServletResponse response)
                        throws java.io.IOException
        An immediate programmatic WebSocket upgrade that does not register a mapping or create a WebSocketUpgradeFilter.
        Parameters:
        creator - the WebSocketCreator to use.
        request - the HttpServletRequest.
        response - the HttpServletResponse.
        Returns:
        true if the connection was successfully upgraded to WebSocket.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • getExecutor

        public java.util.concurrent.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​(java.util.function.Consumer<org.eclipse.jetty.websocket.api.WebSocketSessionListener> consumer)
        Specified by:
        notifySessionListeners in interface org.eclipse.jetty.websocket.api.WebSocketContainer
      • getOpenSessions

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

        public org.eclipse.jetty.websocket.api.WebSocketBehavior getBehavior()
        Specified by:
        getBehavior in interface org.eclipse.jetty.websocket.api.WebSocketPolicy
      • getIdleTimeout

        public java.time.Duration getIdleTimeout()
        Specified by:
        getIdleTimeout in interface org.eclipse.jetty.websocket.api.WebSocketPolicy
      • getInputBufferSize

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

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

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

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

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

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

        public void setIdleTimeout​(java.time.Duration duration)
        Specified by:
        setIdleTimeout in interface org.eclipse.jetty.websocket.api.WebSocketPolicy
      • setInputBufferSize

        public void setInputBufferSize​(int size)
        Specified by:
        setInputBufferSize in interface org.eclipse.jetty.websocket.api.WebSocketPolicy
      • setOutputBufferSize

        public void setOutputBufferSize​(int size)
        Specified by:
        setOutputBufferSize in interface org.eclipse.jetty.websocket.api.WebSocketPolicy
      • setMaxBinaryMessageSize

        public void setMaxBinaryMessageSize​(long size)
        Specified by:
        setMaxBinaryMessageSize in interface org.eclipse.jetty.websocket.api.WebSocketPolicy
      • setMaxTextMessageSize

        public void setMaxTextMessageSize​(long size)
        Specified by:
        setMaxTextMessageSize in interface org.eclipse.jetty.websocket.api.WebSocketPolicy
      • setMaxFrameSize

        public void setMaxFrameSize​(long maxFrameSize)
        Specified by:
        setMaxFrameSize in interface org.eclipse.jetty.websocket.api.WebSocketPolicy
      • setAutoFragment

        public void setAutoFragment​(boolean autoFragment)
        Specified by:
        setAutoFragment in interface org.eclipse.jetty.websocket.api.WebSocketPolicy
      • dump

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