public abstract class TyrusServerContainer
extends org.glassfish.tyrus.core.BaseContainer
implements org.glassfish.tyrus.spi.ServerContainer
| Constructor and Description |
|---|
TyrusServerContainer(jakarta.websocket.server.ServerApplicationConfig serverApplicationConfig)
Create new
TyrusServerContainer using already created ServerApplicationConfig instance. |
TyrusServerContainer(java.util.Set<java.lang.Class<?>> classes)
Create new
TyrusServerContainer. |
| Modifier and Type | Method and Description |
|---|---|
void |
addEndpoint(java.lang.Class<?> endpointClass) |
void |
addEndpoint(jakarta.websocket.server.ServerEndpointConfig serverEndpointConfig) |
java.util.concurrent.Future<jakarta.websocket.Session> |
asyncConnectToServer(java.lang.Class<?> annotatedEndpointClass,
java.net.URI path)
Non-blocking version of
WebSocketContainer.connectToServer(Class, java.net.URI). |
java.util.concurrent.Future<jakarta.websocket.Session> |
asyncConnectToServer(java.lang.Class<? extends jakarta.websocket.Endpoint> endpointClass,
jakarta.websocket.ClientEndpointConfig cec,
java.net.URI path)
Non-blocking version of
WebSocketContainer.connectToServer(Class,
jakarta.websocket.ClientEndpointConfig, java.net.URI). |
java.util.concurrent.Future<jakarta.websocket.Session> |
asyncConnectToServer(jakarta.websocket.Endpoint endpointInstance,
jakarta.websocket.ClientEndpointConfig cec,
java.net.URI path)
Non-blocking version of
WebSocketContainer.connectToServer(jakarta.websocket.Endpoint,
jakarta.websocket.ClientEndpointConfig, java.net.URI). |
java.util.concurrent.Future<jakarta.websocket.Session> |
asyncConnectToServer(java.lang.Object obj,
java.net.URI path)
Non-blocking version of
WebSocketContainer.connectToServer(Object, java.net.URI). |
jakarta.websocket.Session |
connectToServer(java.lang.Class<? extends jakarta.websocket.Endpoint> endpointClass,
jakarta.websocket.ClientEndpointConfig cec,
java.net.URI path) |
jakarta.websocket.Session |
connectToServer(java.lang.Class annotatedEndpointClass,
java.net.URI path) |
jakarta.websocket.Session |
connectToServer(jakarta.websocket.Endpoint endpointInstance,
jakarta.websocket.ClientEndpointConfig cec,
java.net.URI path) |
jakarta.websocket.Session |
connectToServer(java.lang.Object annotatedEndpointInstance,
java.net.URI path) |
void |
doneDeployment()
Container is no longer required to accept
addEndpoint(jakarta.websocket.server.ServerEndpointConfig) and
addEndpoint(Class) calls. |
protected org.glassfish.tyrus.client.ClientManager |
getClientManager()
Can be overridden to provide own
ClientManager implementation or instance. |
long |
getDefaultAsyncSendTimeout() |
int |
getDefaultMaxBinaryMessageBufferSize() |
long |
getDefaultMaxSessionIdleTimeout() |
int |
getDefaultMaxTextMessageBufferSize() |
java.util.Set<jakarta.websocket.Extension> |
getInstalledExtensions() |
int |
getPort()
Get port of the started container.
|
abstract void |
register(java.lang.Class<?> endpointClass) |
abstract void |
register(jakarta.websocket.server.ServerEndpointConfig serverEndpointConfig) |
void |
setAsyncSendTimeout(long timeoutmillis) |
void |
setDefaultMaxBinaryMessageBufferSize(int max) |
void |
setDefaultMaxSessionIdleTimeout(long defaultMaxSessionIdleTimeout) |
void |
setDefaultMaxTextMessageBufferSize(int max) |
void |
start(java.lang.String rootPath,
int port)
Start the container.
|
void |
stop()
Undeploy all endpoints and stop underlying
ServerContainer. |
getExecutorService, getScheduledExecutorService, shutdown, shutdownpublic TyrusServerContainer(java.util.Set<java.lang.Class<?>> classes)
TyrusServerContainer.classes - classes to be included in this application instance. Can contain any combination of annotated
endpoints (see ServerEndpoint) or Endpoint
descendants.public TyrusServerContainer(jakarta.websocket.server.ServerApplicationConfig serverApplicationConfig)
TyrusServerContainer using already created ServerApplicationConfig instance.serverApplicationConfig - provided application config.public void start(java.lang.String rootPath,
int port)
throws java.io.IOException,
jakarta.websocket.DeploymentException
rootPath - context path of the deployed websocket application.java.io.IOException - when any IO related issues emerge during ServerContainer.start(String, int).jakarta.websocket.DeploymentException - when any deployment related error is found; should contain list of all found issues.public void stop()
ServerContainer.
Release all created threadpools / executor services.
public abstract void register(java.lang.Class<?> endpointClass)
throws jakarta.websocket.DeploymentException
jakarta.websocket.DeploymentExceptionpublic abstract void register(jakarta.websocket.server.ServerEndpointConfig serverEndpointConfig)
throws jakarta.websocket.DeploymentException
jakarta.websocket.DeploymentExceptionpublic void addEndpoint(java.lang.Class<?> endpointClass)
throws jakarta.websocket.DeploymentException
addEndpoint in interface jakarta.websocket.server.ServerContainerjakarta.websocket.DeploymentExceptionpublic void addEndpoint(jakarta.websocket.server.ServerEndpointConfig serverEndpointConfig)
throws jakarta.websocket.DeploymentException
addEndpoint in interface jakarta.websocket.server.ServerContainerjakarta.websocket.DeploymentExceptionpublic int getPort()
-1, when the container is not started or the container does
not provide the port.protected org.glassfish.tyrus.client.ClientManager getClientManager()
ClientManager implementation or instance.ClientManager associated with this server container.public jakarta.websocket.Session connectToServer(java.lang.Class annotatedEndpointClass,
java.net.URI path)
throws jakarta.websocket.DeploymentException,
java.io.IOException
connectToServer in interface jakarta.websocket.WebSocketContainerjakarta.websocket.DeploymentExceptionjava.io.IOExceptionpublic jakarta.websocket.Session connectToServer(java.lang.Class<? extends jakarta.websocket.Endpoint> endpointClass,
jakarta.websocket.ClientEndpointConfig cec,
java.net.URI path)
throws jakarta.websocket.DeploymentException,
java.io.IOException
connectToServer in interface jakarta.websocket.WebSocketContainerjakarta.websocket.DeploymentExceptionjava.io.IOExceptionpublic jakarta.websocket.Session connectToServer(java.lang.Object annotatedEndpointInstance,
java.net.URI path)
throws jakarta.websocket.DeploymentException,
java.io.IOException
connectToServer in interface jakarta.websocket.WebSocketContainerjakarta.websocket.DeploymentExceptionjava.io.IOExceptionpublic jakarta.websocket.Session connectToServer(jakarta.websocket.Endpoint endpointInstance,
jakarta.websocket.ClientEndpointConfig cec,
java.net.URI path)
throws jakarta.websocket.DeploymentException,
java.io.IOException
connectToServer in interface jakarta.websocket.WebSocketContainerjakarta.websocket.DeploymentExceptionjava.io.IOExceptionpublic java.util.concurrent.Future<jakarta.websocket.Session> asyncConnectToServer(java.lang.Class<?> annotatedEndpointClass,
java.net.URI path)
throws jakarta.websocket.DeploymentException
WebSocketContainer.connectToServer(Class, java.net.URI).
Only simple checks are performed in the main thread; client container is created in different thread, same applies to connecting etc.
annotatedEndpointClass - the annotated websocket client endpoint.path - the complete path to the server endpoint.jakarta.websocket.DeploymentException - if the class is not a valid annotated endpoint class.public java.util.concurrent.Future<jakarta.websocket.Session> asyncConnectToServer(java.lang.Class<? extends jakarta.websocket.Endpoint> endpointClass,
jakarta.websocket.ClientEndpointConfig cec,
java.net.URI path)
throws jakarta.websocket.DeploymentException
WebSocketContainer.connectToServer(Class,
jakarta.websocket.ClientEndpointConfig, java.net.URI).
Only simple checks are performed in the main thread; client container is created in different thread, same applies to connecting etc.
endpointClass - the programmatic client endpoint class Endpoint.path - the complete path to the server endpoint.cec - the configuration used to configure the programmatic endpoint.jakarta.websocket.DeploymentException - if the configuration is not validWebSocketContainer.connectToServer(Class, jakarta.websocket.ClientEndpointConfig,
java.net.URI)public java.util.concurrent.Future<jakarta.websocket.Session> asyncConnectToServer(jakarta.websocket.Endpoint endpointInstance,
jakarta.websocket.ClientEndpointConfig cec,
java.net.URI path)
throws jakarta.websocket.DeploymentException
WebSocketContainer.connectToServer(jakarta.websocket.Endpoint,
jakarta.websocket.ClientEndpointConfig, java.net.URI).
Only simple checks are performed in the main thread; client container is created in different thread, same applies to connecting etc.
endpointInstance - the programmatic client endpoint instance Endpoint.path - the complete path to the server endpoint.cec - the configuration used to configure the programmatic endpoint.jakarta.websocket.DeploymentException - if the configuration is not validWebSocketContainer.connectToServer(jakarta.websocket.Endpoint,
jakarta.websocket.ClientEndpointConfig, java.net.URI)public java.util.concurrent.Future<jakarta.websocket.Session> asyncConnectToServer(java.lang.Object obj,
java.net.URI path)
throws jakarta.websocket.DeploymentException
WebSocketContainer.connectToServer(Object, java.net.URI).
Only simple checks are performed in the main thread; client container is created in different thread, same applies to connecting etc.
obj - the annotated websocket client endpoint instance.path - the complete path to the server endpoint.jakarta.websocket.DeploymentException - if the annotated endpoint instance is not valid.WebSocketContainer.connectToServer(Object, java.net.URI)public int getDefaultMaxBinaryMessageBufferSize()
getDefaultMaxBinaryMessageBufferSize in interface jakarta.websocket.WebSocketContainerpublic void setDefaultMaxBinaryMessageBufferSize(int max)
setDefaultMaxBinaryMessageBufferSize in interface jakarta.websocket.WebSocketContainerpublic int getDefaultMaxTextMessageBufferSize()
getDefaultMaxTextMessageBufferSize in interface jakarta.websocket.WebSocketContainerpublic void setDefaultMaxTextMessageBufferSize(int max)
setDefaultMaxTextMessageBufferSize in interface jakarta.websocket.WebSocketContainerpublic java.util.Set<jakarta.websocket.Extension> getInstalledExtensions()
getInstalledExtensions in interface jakarta.websocket.WebSocketContainerpublic long getDefaultAsyncSendTimeout()
getDefaultAsyncSendTimeout in interface jakarta.websocket.WebSocketContainerpublic void setAsyncSendTimeout(long timeoutmillis)
setAsyncSendTimeout in interface jakarta.websocket.WebSocketContainerpublic long getDefaultMaxSessionIdleTimeout()
getDefaultMaxSessionIdleTimeout in interface jakarta.websocket.WebSocketContainerpublic void setDefaultMaxSessionIdleTimeout(long defaultMaxSessionIdleTimeout)
setDefaultMaxSessionIdleTimeout in interface jakarta.websocket.WebSocketContainerpublic void doneDeployment()
addEndpoint(jakarta.websocket.server.ServerEndpointConfig) and
addEndpoint(Class) calls.Copyright © 2012–2021 Oracle Corporation. All rights reserved.