Top Description Fields Constructors Methods
org.eclipse.jetty.ee10.websocket.jakarta.client

public Class JakartaWebSocketClientContainer

extends JakartaWebSocketContainer
implements WebSocketContainer
Class Inheritance
All Implemented Interfaces
jakarta.websocket.WebSocketContainer
Annotations
@ManagedObject:JSR356 Client Container
Imports
java.io.IOException, java.net.URI, java.util.Map, java.util.concurrent.CompletableFuture, .ConcurrentHashMap, .ExecutionException, .Executor, .Future, .TimeUnit, .TimeoutException, java.util.function.Function, jakarta.websocket.ClientEndpoint, .ClientEndpointConfig, .DeploymentException, .Endpoint, .EndpointConfig, .Extension, .Session, org.eclipse.jetty.client.HttpClient, org.eclipse.jetty.ee10.websocket.jakarta.client.internal.AnnotatedClientEndpointConfig, .BasicClientEndpointConfig, .JakartaClientUpgradeRequest, .JsrUpgradeListener, org.eclipse.jetty.ee10.websocket.jakarta.common.ConfiguredEndpoint, .JakartaWebSocketContainer, .JakartaWebSocketExtensionConfig, .JakartaWebSocketFrameHandler, .JakartaWebSocketFrameHandlerFactory, org.eclipse.jetty.util.annotation.ManagedObject, org.eclipse.jetty.util.component.Container, .ContainerLifeCycle, org.eclipse.jetty.util.thread.ShutdownThread, org.eclipse.jetty.websocket.core.WebSocketComponents, org.eclipse.jetty.websocket.core.client.WebSocketCoreClient, org.eclipse.jetty.websocket.core.exception.InvalidWebSocketException, .UpgradeException, .WebSocketTimeoutException, org.slf4j.Logger, .LoggerFactory

Container for Client use of the jakarta.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.

Field Summary

Modifier and TypeField and Description
protected WebSocketCoreClient
protected Function<WebSocketComponents, WebSocketCoreClient>
private final JakartaWebSocketClientFrameHandlerFactory
private static final Logger
private static final Map<ClassLoader, ContainerLifeCycle>
Inherited from org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketContainer:
componentsdefaultCustomizersessionTracker

Constructor Summary

AccessConstructor and Description
public
public
JakartaWebSocketClientContainer(final HttpClient
the HttpClient instance to use
httpClient
)

Create a jakarta.websocket.WebSocketContainer using the supplied HttpClient for environments where you want to configure SSL/TLS or Proxy behaviors.

public
public

Method Summary

Modifier and TypeMethod and Description
private CompletableFuture<Session>

Returns:

the future for the session, available on success of connect
connect
(JakartaClientUpgradeRequest
the upgrade request information
upgradeRequest
)

Connect to remote websocket endpoint

private Session
connect(ConfiguredEndpoint configuredEndpoint, URI destURI)

public Session
connectToServer(final Class<? extends Endpoint>
the programmatic client endpoint class Endpoint.
endpointClass
,
final ClientEndpointConfig
the configuration used to configure the programmatic endpoint.
providedConfig
,
URI
the complete path to the server endpoint.
path
)

Implements jakarta.websocket.WebSocketContainer.connectToServer.

Connect the supplied programmatic endpoint to its server with the given configuration.

public Session
connectToServer(final Class<?>
the annotated websocket client endpoint.
annotatedEndpointClass
,
final URI
the complete path to the server endpoint.
path
)

Implements jakarta.websocket.WebSocketContainer.connectToServer.

Connect the supplied annotated endpoint to its server.

public Session
connectToServer(final Endpoint
the programmatic client endpoint instance Endpoint.
endpoint
,
final ClientEndpointConfig
the configuration used to configure the programmatic endpoint.
providedConfig
,
final URI
the complete path to the server endpoint.
path
)

Implements jakarta.websocket.WebSocketContainer.connectToServer.

Connect the supplied programmatic client endpoint instance to its server with the given configuration.

public Session
connectToServer(Object
the annotated websocket client endpoint instance.
endpoint
,
URI
the complete path to the server endpoint.
path
)

Implements jakarta.websocket.WebSocketContainer.connectToServer.

Connect the supplied annotated endpoint instance to its server.

public static Throwable
protected void
protected void
protected void
doStart()

Overrides org.eclipse.jetty.util.component.ContainerLifeCycle.doStart.

Starts the managed lifecycle beans in the order they were added.

protected void
doStop()

Overrides org.eclipse.jetty.util.component.ContainerLifeCycle.doStop.

Stops the managed lifecycle beans in the reverse order they were added.

private ClientEndpointConfig
public Object
public Executor
public JakartaWebSocketFrameHandlerFactory
protected HttpClient
protected WebSocketCoreClient
private <T> T
newEndpoint(Class<T> endpointClass)

public static void
Inherited from org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketContainer:
addSessionListenerdumpgetByteBufferPoolgetDefaultAsyncSendTimeoutgetDefaultMaxBinaryMessageBufferSizegetDefaultMaxSessionIdleTimeoutgetDefaultMaxTextMessageBufferSizegetExtensionRegistrygetInstalledExtensionsgetObjectFactorygetOpenSessionsgetWebSocketComponentsnewFrameHandlernotifySessionListenersremoveSessionListenersetAsyncSendTimeoutsetDefaultMaxBinaryMessageBufferSizesetDefaultMaxSessionIdleTimeoutsetDefaultMaxTextMessageBufferSize

Field Detail

coreClientback to summary
protected WebSocketCoreClient coreClient
coreClientFactoryback to summary
protected Function<WebSocketComponents, WebSocketCoreClient> coreClientFactory
frameHandlerFactoryback to summary
private final JakartaWebSocketClientFrameHandlerFactory frameHandlerFactory
LOGback to summary
private static final Logger LOG

Hides org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketContainer.LOG.

SHUTDOWN_MAPback to summary
private static final Map<ClassLoader, ContainerLifeCycle> SHUTDOWN_MAP

Constructor Detail

JakartaWebSocketClientContainerback to summary
public JakartaWebSocketClientContainer()
JakartaWebSocketClientContainerback to summary
public JakartaWebSocketClientContainer(final HttpClient httpClient)

Create a jakarta.websocket.WebSocketContainer using the supplied HttpClient for environments where you want to configure SSL/TLS or Proxy behaviors.

Parameters
httpClient:HttpClient

the HttpClient instance to use

JakartaWebSocketClientContainerback to summary
public JakartaWebSocketClientContainer(WebSocketComponents components)
JakartaWebSocketClientContainerback to summary
public JakartaWebSocketClientContainer(WebSocketComponents components, Function<WebSocketComponents, WebSocketCoreClient> coreClientFactory)

Method Detail

connectback to summary
private CompletableFuture<Session> connect(JakartaClientUpgradeRequest upgradeRequest)

Connect to remote websocket endpoint

Parameters
upgradeRequest:JakartaClientUpgradeRequest

the upgrade request information

Returns:CompletableFuture<Session>

the future for the session, available on success of connect

connectback to summary
private Session connect(ConfiguredEndpoint configuredEndpoint, URI destURI) throws IOException, DeploymentException
connectToServerback to summary
public Session connectToServer(final Class<? extends Endpoint> endpointClass, final ClientEndpointConfig providedConfig, URI path) throws DeploymentException, IOException

Implements jakarta.websocket.WebSocketContainer.connectToServer.

Doc from jakarta.websocket.WebSocketContainer.connectToServer.

Connect the supplied programmatic endpoint to its server with the given configuration. This method blocks until the connection is established, or throws an error if the connection could not be made.

Parameters
endpointClass:Class<? extends Endpoint>

the programmatic client endpoint class Endpoint.

providedConfig:ClientEndpointConfig

the configuration used to configure the programmatic endpoint.

path:URI

the complete path to the server endpoint.

Returns:Session

the Session created if the connection is successful.

Annotations
@Override
Exceptions
DeploymentException:
if the configuration is not valid
IOException:
if there was a network or protocol problem that prevented the client endpoint being connected to its server
connectToServerback to summary
public Session connectToServer(final Class<?> annotatedEndpointClass, final URI path) throws DeploymentException, IOException

Implements jakarta.websocket.WebSocketContainer.connectToServer.

Doc from jakarta.websocket.WebSocketContainer.connectToServer.

Connect the supplied annotated endpoint to its server. The supplied object must be a class decorated with the class level jakarta.websocket.ClientEndpoint annotation. This method blocks until the connection is established, or throws an error if either the connection could not be made or there was a problem with the supplied endpoint class.

Parameters
annotatedEndpointClass:Class<?>

the annotated websocket client endpoint.

path:URI

the complete path to the server endpoint.

Returns:Session

the Session created if the connection is successful.

Annotations
@Override
Exceptions
DeploymentException:
if the class is not a valid annotated endpoint class.
IOException:
if there was a network or protocol problem that prevented the client endpoint being connected to its server.
connectToServerback to summary
public Session connectToServer(final Endpoint endpoint, final ClientEndpointConfig providedConfig, final URI path) throws DeploymentException, IOException

Implements jakarta.websocket.WebSocketContainer.connectToServer.

Doc from jakarta.websocket.WebSocketContainer.connectToServer.

Connect the supplied programmatic client endpoint instance to its server with the given configuration. This method blocks until the connection is established, or throws an error if the connection could not be made. If the developer uses this method to deploy the client endpoint, services like dependency injection that are supported, for example, when the implementation is part of the Java EE platform may not be available. If the client endpoint uses dependency injection, use WebSocketContainer#connectToServer(java.lang.Class, jakarta.websocket.ClientEndpointConfig, java.net.URI) instead.

Parameters
endpoint:Endpoint

the programmatic client endpoint instance Endpoint.

providedConfig:ClientEndpointConfig

the configuration used to configure the programmatic endpoint.

path:URI

the complete path to the server endpoint.

Returns:Session

the Session created if the connection is successful.

Annotations
@Override
Exceptions
DeploymentException:
if the configuration is not valid
IOException:
if there was a network or protocol problem that prevented the client endpoint being connected to its server
connectToServerback to summary
public Session connectToServer(Object endpoint, URI path) throws DeploymentException, IOException

Implements jakarta.websocket.WebSocketContainer.connectToServer.

Doc from jakarta.websocket.WebSocketContainer.connectToServer.

Connect the supplied annotated endpoint instance to its server. The supplied object must be a class decorated with the class level jakarta.websocket.ClientEndpoint annotation. This method blocks until the connection is established, or throws an error if either the connection could not be made or there was a problem with the supplied endpoint class. If the developer uses this method to deploy the client endpoint, services like dependency injection that are supported, for example, when the implementation is part of the Java EE platform may not be available. If the client endpoint uses dependency injection, use WebSocketContainer#connectToServer(java.lang.Class, java.net.URI) instead.

Parameters
endpoint:Object

the annotated websocket client endpoint instance.

path:URI

the complete path to the server endpoint.

Returns:Session

the Session created if the connection is successful.

Annotations
@Override
Exceptions
DeploymentException:
if the annotated endpoint instance is not valid.
IOException:
if there was a network or protocol problem that prevented the client endpoint being connected to its server.
convertCauseback to summary
public static Throwable convertCause(Throwable error)
doClientStartback to summary
protected void doClientStart()
doClientStopback to summary
protected void doClientStop()
doStartback to summary
protected void doStart() throws Exception

Overrides org.eclipse.jetty.util.component.ContainerLifeCycle.doStart.

Doc from org.eclipse.jetty.util.component.ContainerLifeCycle.doStart.

Starts the managed lifecycle beans in the order they were added.

Annotations
@Override
Exceptions
Exception:

Doc from org.eclipse.jetty.util.component.AbstractLifeCycle.doStart.

If there was a problem starting. Will cause a transition to FAILED state

doStopback to summary
protected void doStop() throws Exception

Overrides org.eclipse.jetty.util.component.ContainerLifeCycle.doStop.

Doc from org.eclipse.jetty.util.component.ContainerLifeCycle.doStop.

Stops the managed lifecycle beans in the reverse order they were added.

Annotations
@Override
Exceptions
Exception:

Doc from org.eclipse.jetty.util.component.AbstractLifeCycle.doStop.

If there was a problem stopping. Will cause a transition to FAILED state

getAnnotatedConfigback to summary
private ClientEndpointConfig getAnnotatedConfig(Object endpoint) throws DeploymentException
getContextHandlerback to summary
public Object getContextHandler()
getExecutorback to summary
public Executor getExecutor()

Implements abstract org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketContainer.getExecutor.

Annotations
@Override
getFrameHandlerFactoryback to summary
public JakartaWebSocketFrameHandlerFactory getFrameHandlerFactory()

Implements abstract org.eclipse.jetty.ee10.websocket.jakarta.common.JakartaWebSocketContainer.getFrameHandlerFactory.

Annotations
@Override
getHttpClientback to summary
protected HttpClient getHttpClient()
getWebSocketCoreClientback to summary
protected WebSocketCoreClient getWebSocketCoreClient()
newEndpointback to summary
private <T> T newEndpoint(Class<T> endpointClass) throws DeploymentException
setShutdownContainerback to summary
public static void setShutdownContainer(ContainerLifeCycle container)