public abstract class TyrusServerContainer extends BaseContainer implements ServerContainer
BaseContainer.ShutDownCondition| Constructor and Description | 
|---|
| TyrusServerContainer(ServerApplicationConfig serverApplicationConfig)Create new  TyrusServerContainerusing already createdServerApplicationConfiginstance. | 
| TyrusServerContainer(java.util.Set<java.lang.Class<?>> classes)Create new  TyrusServerContainer. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addEndpoint(java.lang.Class<?> endpointClass)Deploys the given annotated endpoint into this ServerContainer during the initialization phase of deploying the
 application. | 
| 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)Connect the supplied programmatic endpoint to its server with the given configuration. | 
| Session | connectToServer(java.lang.Class annotatedEndpointClass,
               java.net.URI path)Connect the supplied annotated endpoint to its server. | 
| Session | connectToServer(Endpoint endpointInstance,
               ClientEndpointConfig cec,
               java.net.URI path)Connect the supplied programmatic client endpoint instance to its server with the given configuration. | 
| Session | connectToServer(java.lang.Object annotatedEndpointInstance,
               java.net.URI path)Connect the supplied annotated endpoint instance to its server. | 
| void | doneDeployment()Container is no longer required to accept  addEndpoint(jakarta.websocket.server.ServerEndpointConfig)andaddEndpoint(Class)calls. | 
| protected ClientManager | getClientManager()Can be overridden to provide own  ClientManagerimplementation or instance. | 
| long | getDefaultAsyncSendTimeout()Return the number of milliseconds the implementation will timeout attempting to send a websocket message for all
 RemoteEndpoints associated with this container. | 
| int | getDefaultMaxBinaryMessageBufferSize()Returns the default maximum size of incoming binary message that this container will buffer. | 
| long | getDefaultMaxSessionIdleTimeout()Return the default time in milliseconds after which any web socket sessions in this container will be closed if
 it has been inactive. | 
| int | getDefaultMaxTextMessageBufferSize()Returns the default maximum size of incoming text message that this container will buffer. | 
| java.util.Set<Extension> | getInstalledExtensions()Return the set of Extensions installed in the container. | 
| int | getPort()Get port of the started container. | 
| abstract void | register(java.lang.Class<?> endpointClass) | 
| abstract void | register(ServerEndpointConfig serverEndpointConfig) | 
| void | setAsyncSendTimeout(long timeoutmillis)Sets the number of milliseconds the implementation will timeout attempting to send a websocket message for all
 RemoteEndpoints associated with this container. | 
| void | setDefaultMaxBinaryMessageBufferSize(int max)Sets the default maximum size of incoming binary message that this container will buffer. | 
| void | setDefaultMaxSessionIdleTimeout(long defaultMaxSessionIdleTimeout)Sets the default time in milliseconds after which any web socket sessions in this container will be closed if it
 has been inactive. | 
| void | setDefaultMaxTextMessageBufferSize(int max)Sets the maximum size of incoming text message that this container will buffer. | 
| 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.port - TCP portjava.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
ServerContaineraddEndpoint in interface ServerContainerendpointClass - the class of the annotated endpointDeploymentException - if the annotated endpoint was badly formed.public void addEndpoint(ServerEndpointConfig serverEndpointConfig) throws DeploymentException
addEndpoint in interface ServerContainerserverEndpointConfig - the configuration instance representing the logical endpoint that will be registered.DeploymentException - if the endpoint was badly formed.public 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
WebSocketContainerClientEndpoint 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.connectToServer in interface WebSocketContainerannotatedEndpointClass - the annotated websocket client endpoint.path - the complete path to the server endpoint.DeploymentException - if the class is not a valid annotated endpoint class.java.io.IOException - if there was a network or protocol problem that prevented the client endpoint being
                               connected to its server.public Session connectToServer(java.lang.Class<? extends Endpoint> endpointClass, ClientEndpointConfig cec, java.net.URI path) throws DeploymentException, java.io.IOException
WebSocketContainerconnectToServer in interface WebSocketContainerendpointClass - the programmatic client endpoint class Endpoint.cec - the configuration used to configure the programmatic endpoint.path - the complete path to the server endpoint.DeploymentException - if the configuration is not validjava.io.IOException - if there was a network or protocol problem that prevented the client endpoint being
                               connected to its serverpublic Session connectToServer(java.lang.Object annotatedEndpointInstance, java.net.URI path) throws DeploymentException, java.io.IOException
WebSocketContainerClientEndpoint 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.connectToServer in interface WebSocketContainerannotatedEndpointInstance - the annotated websocket client endpoint instance.path - the complete path to the server endpoint.DeploymentException - if the annotated endpoint instance is not valid.java.io.IOException - if there was a network or protocol problem that prevented the client endpoint being
                               connected to its server.public Session connectToServer(Endpoint endpointInstance, ClientEndpointConfig cec, java.net.URI path) throws DeploymentException, java.io.IOException
WebSocketContainerWebSocketContainer.connectToServer(java.lang.Class, jakarta.websocket.ClientEndpointConfig, java.net.URI)
 instead.connectToServer in interface WebSocketContainerendpointInstance - the programmatic client endpoint instance Endpoint.cec - the configuration used to configure the programmatic endpoint.path - the complete path to the server endpoint.DeploymentException - if the configuration is not validjava.io.IOException - if there was a network or protocol problem that prevented the client endpoint being
                               connected to its serverpublic 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()
WebSocketContainerSession.setMaxBinaryMessageBufferSize(int)getDefaultMaxBinaryMessageBufferSize in interface WebSocketContainerpublic void setDefaultMaxBinaryMessageBufferSize(int max)
WebSocketContainersetDefaultMaxBinaryMessageBufferSize in interface WebSocketContainermax - the maximum size of binary message in number of bytes.public int getDefaultMaxTextMessageBufferSize()
WebSocketContainerSession.setMaxTextMessageBufferSize(int)getDefaultMaxTextMessageBufferSize in interface WebSocketContainerpublic void setDefaultMaxTextMessageBufferSize(int max)
WebSocketContainersetDefaultMaxTextMessageBufferSize in interface WebSocketContainermax - the maximum size of text message in number of bytes.public java.util.Set<Extension> getInstalledExtensions()
WebSocketContainergetInstalledExtensions in interface WebSocketContainerpublic long getDefaultAsyncSendTimeout()
WebSocketContainergetDefaultAsyncSendTimeout in interface WebSocketContainerpublic void setAsyncSendTimeout(long timeoutmillis)
WebSocketContainersetAsyncSendTimeout in interface WebSocketContainertimeoutmillis - the timeout in milliseconds or a non-positive number for no timeoutpublic long getDefaultMaxSessionIdleTimeout()
WebSocketContainerSession.setMaxIdleTimeout(long)getDefaultMaxSessionIdleTimeout in interface WebSocketContainerpublic void setDefaultMaxSessionIdleTimeout(long defaultMaxSessionIdleTimeout)
WebSocketContainerSession.setMaxIdleTimeout(long)setDefaultMaxSessionIdleTimeout in interface WebSocketContainerdefaultMaxSessionIdleTimeout - the maximum time in milliseconds.public 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.