Class ClientContainer

    • Constructor Detail

      • ClientContainer

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

        public ClientContainer​(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​(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​(WebSocketContainerScope scope,
                                  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 Detail

      • connectToServer

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

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

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

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

        protected void doStart()
                        throws java.lang.Exception
        Description copied from class: ContainerLifeCycle
        Starts the managed lifecycle beans in the order they were added.
        Overrides:
        doStart in class ContainerLifeCycle
        Throws:
        java.lang.Exception
      • doStop

        protected void doStop()
                       throws java.lang.Exception
        Description copied from class: ContainerLifeCycle
        Stops the managed lifecycle beans in the reverse order they were added.
        Overrides:
        doStop in class ContainerLifeCycle
        Throws:
        java.lang.Exception
      • getClassLoader

        public java.lang.ClassLoader getClassLoader()
        Description copied from interface: WebSocketContainerScope

        The ClassLoader used to load classes for the WebSocketSession.

        By default this will be the ContextClassLoader at the time this method is called. However this will be overridden by the WebSocketClient to use the ContextClassLoader at the time it was created, this is because the client uses its own ThreadPool so the WebSocketSessions may be created when the ContextClassLoader is not set.

        Specified by:
        getClassLoader in interface WebSocketContainerScope
        Returns:
        the classloader.
      • getClientEndpointMetadata

        public EndpointMetadata getClientEndpointMetadata​(java.lang.Class<?> endpoint,
                                                          javax.websocket.EndpointConfig config)
      • 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
      • getInstalledExtensions

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

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

        public EndpointInstance newClientEndpointInstance​(java.lang.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