Class ClientContainer

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.websocket.jsr356.ClientContainer
All Implemented Interfaces:
javax.websocket.WebSocketContainer, 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.websocket.common.scopes.WebSocketContainerScope

@ManagedObject("JSR356 Client Container") public class ClientContainer extends org.eclipse.jetty.util.component.ContainerLifeCycle implements javax.websocket.WebSocketContainer, org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope
Container for Client use of the javax.websocket API.

This should be specific to a JVM if run in a standalone mode. or specific to a WebAppContext if running on the Jetty server.

  • Nested Class Summary

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

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

    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 inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING

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

    KEY
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    This is the entry point for ContainerProvider.getWebSocketContainer()
     
    ClientContainer(org.eclipse.jetty.client.HttpClient httpClient)
    Create a WebSocketContainer using the supplied HttpClient for environments where you want to configure SSL/TLS or Proxy behaviors.
     
    Build a ClientContainer with a specific WebSocketClient in mind.
     
    ClientContainer(org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope scope)
    This is the entry point for ServerContainer, via ServletContext.getAttribute(ServerContainer.class.getName())
    protected
    ClientContainer(org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope scope, org.eclipse.jetty.client.HttpClient httpClient)
    This is the entry point for ServerContainer, via ServletContext.getAttribute(ServerContainer.class.getName())
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addSessionListener(org.eclipse.jetty.websocket.common.WebSocketSessionListener listener)
     
    javax.websocket.Session
    connectToServer(Class<?> annotatedEndpointClass, URI path)
     
    javax.websocket.Session
    connectToServer(Class<? extends javax.websocket.Endpoint> endpointClass, javax.websocket.ClientEndpointConfig config, URI path)
     
    javax.websocket.Session
    connectToServer(Object endpoint, URI path)
     
    javax.websocket.Session
    connectToServer(javax.websocket.Endpoint endpoint, javax.websocket.ClientEndpointConfig config, URI path)
     
    protected void
     
    protected void
     
    org.eclipse.jetty.io.ByteBufferPool
     
     
     
    getClientEndpointMetadata(Class<?> endpoint, javax.websocket.EndpointConfig config)
     
     
    long
     
    int
     
    long
     
    int
     
     
     
    Set<javax.websocket.Extension>
     
    org.eclipse.jetty.util.DecoratedObjectFactory
     
    Set<javax.websocket.Session>
    Used in Session.getOpenSessions()
    org.eclipse.jetty.websocket.api.WebSocketPolicy
     
    Collection<org.eclipse.jetty.websocket.common.WebSocketSessionListener>
     
    org.eclipse.jetty.util.ssl.SslContextFactory
     
    newClientEndpointInstance(Object endpoint, javax.websocket.ClientEndpointConfig config)
     
    void
    removeSessionListener(org.eclipse.jetty.websocket.common.WebSocketSessionListener listener)
     
    void
     
    void
     
    void
     
    void
     

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

    addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans

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

    addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, 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.Dumpable

    dumpSelf

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

    isDumpable

    Methods inherited from interface org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope

    isRunning
  • Constructor Details

    • ClientContainer

      public ClientContainer()
      This is the entry point for ContainerProvider.getWebSocketContainer()
    • ClientContainer

      public ClientContainer(org.eclipse.jetty.client.HttpClient httpClient)
      Create a WebSocketContainer using the supplied HttpClient for environments where you want to configure SSL/TLS or Proxy behaviors.
      Parameters:
      httpClient - the HttpClient instance to use
    • ClientContainer

      public ClientContainer(org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope scope)
      This is the entry point for ServerContainer, via ServletContext.getAttribute(ServerContainer.class.getName())
      Parameters:
      scope - the scope of the ServerContainer
    • ClientContainer

      protected ClientContainer(org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope scope, org.eclipse.jetty.client.HttpClient httpClient)
      This is the entry point for ServerContainer, via ServletContext.getAttribute(ServerContainer.class.getName())
      Parameters:
      scope - the scope of the ServerContainer
      httpClient - the HttpClient instance to use
    • ClientContainer

      public ClientContainer(WebSocketClient client)
      Build a ClientContainer with a specific WebSocketClient in mind.
      Parameters:
      client - the WebSocketClient to use.
  • Method Details

    • connectToServer

      public javax.websocket.Session connectToServer(Class<? extends javax.websocket.Endpoint> endpointClass, javax.websocket.ClientEndpointConfig config, URI path) throws javax.websocket.DeploymentException, IOException
      Specified by:
      connectToServer in interface javax.websocket.WebSocketContainer
      Throws:
      javax.websocket.DeploymentException
      IOException
    • connectToServer

      public javax.websocket.Session connectToServer(Class<?> annotatedEndpointClass, URI path) throws javax.websocket.DeploymentException, IOException
      Specified by:
      connectToServer in interface javax.websocket.WebSocketContainer
      Throws:
      javax.websocket.DeploymentException
      IOException
    • connectToServer

      public javax.websocket.Session connectToServer(javax.websocket.Endpoint endpoint, javax.websocket.ClientEndpointConfig config, URI path) throws javax.websocket.DeploymentException, IOException
      Specified by:
      connectToServer in interface javax.websocket.WebSocketContainer
      Throws:
      javax.websocket.DeploymentException
      IOException
    • connectToServer

      public javax.websocket.Session connectToServer(Object endpoint, URI path) throws javax.websocket.DeploymentException, IOException
      Specified by:
      connectToServer in interface javax.websocket.WebSocketContainer
      Throws:
      javax.websocket.DeploymentException
      IOException
    • doStart

      protected void doStart() throws Exception
      Overrides:
      doStart in class org.eclipse.jetty.util.component.ContainerLifeCycle
      Throws:
      Exception
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class org.eclipse.jetty.util.component.ContainerLifeCycle
      Throws:
      Exception
    • getBufferPool

      public org.eclipse.jetty.io.ByteBufferPool getBufferPool()
      Specified by:
      getBufferPool in interface org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope
    • getClient

      public WebSocketClient getClient()
    • getClassLoader

      public ClassLoader getClassLoader()
      Specified by:
      getClassLoader in interface org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope
    • getClientEndpointMetadata

      public EndpointMetadata getClientEndpointMetadata(Class<?> endpoint, javax.websocket.EndpointConfig config)
    • getDecoderFactory

      public DecoderFactory getDecoderFactory()
    • getDefaultAsyncSendTimeout

      public long getDefaultAsyncSendTimeout()
      Specified by:
      getDefaultAsyncSendTimeout in interface javax.websocket.WebSocketContainer
    • getDefaultMaxBinaryMessageBufferSize

      public int getDefaultMaxBinaryMessageBufferSize()
      Specified by:
      getDefaultMaxBinaryMessageBufferSize in interface javax.websocket.WebSocketContainer
    • getDefaultMaxSessionIdleTimeout

      public long getDefaultMaxSessionIdleTimeout()
      Specified by:
      getDefaultMaxSessionIdleTimeout in interface javax.websocket.WebSocketContainer
    • getDefaultMaxTextMessageBufferSize

      public int getDefaultMaxTextMessageBufferSize()
      Specified by:
      getDefaultMaxTextMessageBufferSize in interface javax.websocket.WebSocketContainer
    • getEncoderFactory

      public EncoderFactory getEncoderFactory()
    • getExecutor

      public Executor getExecutor()
      Specified by:
      getExecutor in interface org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope
    • getInstalledExtensions

      public Set<javax.websocket.Extension> getInstalledExtensions()
      Specified by:
      getInstalledExtensions in interface javax.websocket.WebSocketContainer
    • getObjectFactory

      public org.eclipse.jetty.util.DecoratedObjectFactory getObjectFactory()
      Specified by:
      getObjectFactory in interface org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope
    • getOpenSessions

      public Set<javax.websocket.Session> getOpenSessions()
      Used in Session.getOpenSessions()
      Returns:
      the set of open sessions
    • getPolicy

      public org.eclipse.jetty.websocket.api.WebSocketPolicy getPolicy()
      Specified by:
      getPolicy in interface org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope
    • getSslContextFactory

      public org.eclipse.jetty.util.ssl.SslContextFactory getSslContextFactory()
      Specified by:
      getSslContextFactory in interface org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope
    • addSessionListener

      public void addSessionListener(org.eclipse.jetty.websocket.common.WebSocketSessionListener listener)
      Specified by:
      addSessionListener in interface org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope
    • removeSessionListener

      public void removeSessionListener(org.eclipse.jetty.websocket.common.WebSocketSessionListener listener)
      Specified by:
      removeSessionListener in interface org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope
    • getSessionListeners

      public Collection<org.eclipse.jetty.websocket.common.WebSocketSessionListener> getSessionListeners()
      Specified by:
      getSessionListeners in interface org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope
    • newClientEndpointInstance

      public EndpointInstance newClientEndpointInstance(Object endpoint, javax.websocket.ClientEndpointConfig config)
    • setAsyncSendTimeout

      public void setAsyncSendTimeout(long ms)
      Specified by:
      setAsyncSendTimeout in interface javax.websocket.WebSocketContainer
    • setDefaultMaxBinaryMessageBufferSize

      public void setDefaultMaxBinaryMessageBufferSize(int max)
      Specified by:
      setDefaultMaxBinaryMessageBufferSize in interface javax.websocket.WebSocketContainer
    • setDefaultMaxSessionIdleTimeout

      public void setDefaultMaxSessionIdleTimeout(long ms)
      Specified by:
      setDefaultMaxSessionIdleTimeout in interface javax.websocket.WebSocketContainer
    • setDefaultMaxTextMessageBufferSize

      public void setDefaultMaxTextMessageBufferSize(int max)
      Specified by:
      setDefaultMaxTextMessageBufferSize in interface javax.websocket.WebSocketContainer