public abstract class TyrusServerContainer extends BaseContainer implements ServerContainer
BaseContainer.ShutDownCondition| Constructor and Description |
|---|
TyrusServerContainer(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(ServerEndpointConfig serverEndpointConfig) |
java.util.concurrent.Future<Session> |
asyncConnectToServer(java.lang.Class<?> annotatedEndpointClass,
java.net.URI path)
Non-blocking version of
WebSocketContainer.connectToServer(Class, java.net.URI). |
java.util.concurrent.Future<Session> |
asyncConnectToServer(java.lang.Class<? extends Endpoint> endpointClass,
ClientEndpointConfig cec,
java.net.URI path)
Non-blocking version of
WebSocketContainer.connectToServer(Class,
jakarta.websocket.ClientEndpointConfig, java.net.URI). |
java.util.concurrent.Future<Session> |
asyncConnectToServer(Endpoint endpointInstance,
ClientEndpointConfig cec,
java.net.URI path)
|
java.util.concurrent.Future<Session> |
asyncConnectToServer(java.lang.Object obj,
java.net.URI path)
Non-blocking version of
WebSocketContainer.connectToServer(Object, java.net.URI). |
Session |
connectToServer(java.lang.Class<? extends Endpoint> endpointClass,
ClientEndpointConfig cec,
java.net.URI path) |
Session |
connectToServer(java.lang.Class annotatedEndpointClass,
java.net.URI path) |
Session |
connectToServer(Endpoint endpointInstance,
ClientEndpointConfig cec,
java.net.URI path) |
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 ClientManager |
getClientManager()
Can be overridden to provide own
ClientManager implementation or instance. |
long |
getDefaultAsyncSendTimeout() |
int |
getDefaultMaxBinaryMessageBufferSize() |
long |
getDefaultMaxSessionIdleTimeout() |
int |
getDefaultMaxTextMessageBufferSize() |
java.util.Set<Extension> |
getInstalledExtensions() |
int |
getPort()
Get port of the started container.
|
abstract void |
register(java.lang.Class<?> endpointClass) |
abstract void |
register(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. |
void |
upgradeHttpToWebSocket(java.lang.Object httpServletRequest,
java.lang.Object httpServletResponse,
ServerEndpointConfig sec,
java.util.Map<java.lang.String,java.lang.String> pathParameters) |
getExecutorService, getProperties, getScheduledExecutorService, shutdown, shutdownclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetWebSocketEnginepublic 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(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,
DeploymentException
rootPath - context path of the deployed websocket application.java.io.IOException - when any IO related issues emerge during ServerContainer.start(String, int).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 DeploymentException
DeploymentExceptionpublic abstract void register(ServerEndpointConfig serverEndpointConfig) throws DeploymentException
DeploymentExceptionpublic void addEndpoint(java.lang.Class<?> endpointClass)
throws DeploymentException
addEndpoint in interface ServerContainerDeploymentExceptionpublic void addEndpoint(ServerEndpointConfig serverEndpointConfig) throws DeploymentException
addEndpoint in interface ServerContainerDeploymentExceptionpublic int getPort()
-1, when the container is not started or the container does
not provide the port.protected ClientManager getClientManager()
ClientManager implementation or instance.ClientManager associated with this server container.public Session connectToServer(java.lang.Class annotatedEndpointClass, java.net.URI path) throws DeploymentException, java.io.IOException
connectToServer in interface WebSocketContainerDeploymentExceptionjava.io.IOExceptionpublic Session connectToServer(java.lang.Class<? extends Endpoint> endpointClass, ClientEndpointConfig cec, java.net.URI path) throws DeploymentException, java.io.IOException
connectToServer in interface WebSocketContainerDeploymentExceptionjava.io.IOExceptionpublic Session connectToServer(java.lang.Object annotatedEndpointInstance, java.net.URI path) throws DeploymentException, java.io.IOException
connectToServer in interface WebSocketContainerDeploymentExceptionjava.io.IOExceptionpublic Session connectToServer(Endpoint endpointInstance, ClientEndpointConfig cec, java.net.URI path) throws DeploymentException, java.io.IOException
connectToServer in interface WebSocketContainerDeploymentExceptionjava.io.IOExceptionpublic java.util.concurrent.Future<Session> asyncConnectToServer(java.lang.Class<?> annotatedEndpointClass, java.net.URI path) throws 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.DeploymentException - if the class is not a valid annotated endpoint class.public java.util.concurrent.Future<Session> asyncConnectToServer(java.lang.Class<? extends Endpoint> endpointClass, ClientEndpointConfig cec, java.net.URI path) throws 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.DeploymentException - if the configuration is not validWebSocketContainer.connectToServer(Class, jakarta.websocket.ClientEndpointConfig,
java.net.URI)public java.util.concurrent.Future<Session> asyncConnectToServer(Endpoint endpointInstance, ClientEndpointConfig cec, java.net.URI path) throws 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.DeploymentException - if the configuration is not validWebSocketContainer.connectToServer(jakarta.websocket.Endpoint,
jakarta.websocket.ClientEndpointConfig, java.net.URI)public java.util.concurrent.Future<Session> asyncConnectToServer(java.lang.Object obj, java.net.URI path) throws 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.DeploymentException - if the annotated endpoint instance is not valid.WebSocketContainer.connectToServer(Object, java.net.URI)public int getDefaultMaxBinaryMessageBufferSize()
getDefaultMaxBinaryMessageBufferSize in interface WebSocketContainerpublic void setDefaultMaxBinaryMessageBufferSize(int max)
setDefaultMaxBinaryMessageBufferSize in interface WebSocketContainerpublic int getDefaultMaxTextMessageBufferSize()
getDefaultMaxTextMessageBufferSize in interface WebSocketContainerpublic void setDefaultMaxTextMessageBufferSize(int max)
setDefaultMaxTextMessageBufferSize in interface WebSocketContainerpublic java.util.Set<Extension> getInstalledExtensions()
getInstalledExtensions in interface WebSocketContainerpublic long getDefaultAsyncSendTimeout()
getDefaultAsyncSendTimeout in interface WebSocketContainerpublic void setAsyncSendTimeout(long timeoutmillis)
setAsyncSendTimeout in interface WebSocketContainerpublic long getDefaultMaxSessionIdleTimeout()
getDefaultMaxSessionIdleTimeout in interface WebSocketContainerpublic void setDefaultMaxSessionIdleTimeout(long defaultMaxSessionIdleTimeout)
setDefaultMaxSessionIdleTimeout in interface WebSocketContainerpublic void doneDeployment()
addEndpoint(jakarta.websocket.server.ServerEndpointConfig) and
addEndpoint(Class) calls.public void upgradeHttpToWebSocket(java.lang.Object httpServletRequest,
java.lang.Object httpServletResponse,
ServerEndpointConfig sec,
java.util.Map<java.lang.String,java.lang.String> pathParameters)
throws java.io.IOException,
DeploymentException
java.io.IOExceptionDeploymentExceptionCopyright © 2012–2020 Oracle Corporation. All rights reserved.