public abstract class TyrusServerContainer extends BaseContainer implements ServerContainer
BaseContainer.ShutDownCondition
Constructor and Description |
---|
TyrusServerContainer(javax.websocket.server.ServerApplicationConfig serverApplicationConfig)
Create new
TyrusServerContainer using already created ServerApplicationConfig instance. |
TyrusServerContainer(Set<Class<?>> classes)
Create new
TyrusServerContainer . |
Modifier and Type | Method and Description |
---|---|
void |
addEndpoint(Class<?> endpointClass) |
void |
addEndpoint(javax.websocket.server.ServerEndpointConfig serverEndpointConfig) |
Future<javax.websocket.Session> |
asyncConnectToServer(Class<?> annotatedEndpointClass,
URI path)
Non-blocking version of
WebSocketContainer.connectToServer(Class, java.net.URI) . |
Future<javax.websocket.Session> |
asyncConnectToServer(Class<? extends javax.websocket.Endpoint> endpointClass,
javax.websocket.ClientEndpointConfig cec,
URI path)
Non-blocking version of
WebSocketContainer.connectToServer(Class,
javax.websocket.ClientEndpointConfig, java.net.URI) . |
Future<javax.websocket.Session> |
asyncConnectToServer(javax.websocket.Endpoint endpointInstance,
javax.websocket.ClientEndpointConfig cec,
URI path)
Non-blocking version of
WebSocketContainer.connectToServer(javax.websocket.Endpoint,
javax.websocket.ClientEndpointConfig, java.net.URI) . |
Future<javax.websocket.Session> |
asyncConnectToServer(Object obj,
URI path)
Non-blocking version of
WebSocketContainer.connectToServer(Object, java.net.URI) . |
javax.websocket.Session |
connectToServer(Class<? extends javax.websocket.Endpoint> endpointClass,
javax.websocket.ClientEndpointConfig cec,
URI path) |
javax.websocket.Session |
connectToServer(Class annotatedEndpointClass,
URI path) |
javax.websocket.Session |
connectToServer(javax.websocket.Endpoint endpointInstance,
javax.websocket.ClientEndpointConfig cec,
URI path) |
javax.websocket.Session |
connectToServer(Object annotatedEndpointInstance,
URI path) |
void |
doneDeployment()
Container is no longer required to accept
addEndpoint(javax.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() |
Set<javax.websocket.Extension> |
getInstalledExtensions() |
abstract void |
register(Class<?> endpointClass) |
abstract void |
register(javax.websocket.server.ServerEndpointConfig serverEndpointConfig) |
void |
setAsyncSendTimeout(long timeoutmillis) |
void |
setDefaultMaxBinaryMessageBufferSize(int max) |
void |
setDefaultMaxSessionIdleTimeout(long defaultMaxSessionIdleTimeout) |
void |
setDefaultMaxTextMessageBufferSize(int max) |
void |
start(String rootPath,
int port)
Start container.
|
void |
stop()
Undeploy all endpoints and stop underlying
ServerContainer . |
getExecutorService, getScheduledExecutorService, shutdown, shutdown
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getWebSocketEngine
public TyrusServerContainer(Set<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(javax.websocket.server.ServerApplicationConfig serverApplicationConfig)
TyrusServerContainer
using already created ServerApplicationConfig
instance.serverApplicationConfig
- provided application config.public void start(String rootPath, int port) throws IOException, javax.websocket.DeploymentException
rootPath
- context rootport
- TCP portIOException
- when any IO related issues emerge during ServerContainer.start(String, int)
.javax.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(Class<?> endpointClass) throws javax.websocket.DeploymentException
javax.websocket.DeploymentException
public abstract void register(javax.websocket.server.ServerEndpointConfig serverEndpointConfig) throws javax.websocket.DeploymentException
javax.websocket.DeploymentException
public void addEndpoint(Class<?> endpointClass) throws javax.websocket.DeploymentException
addEndpoint
in interface javax.websocket.server.ServerContainer
javax.websocket.DeploymentException
public void addEndpoint(javax.websocket.server.ServerEndpointConfig serverEndpointConfig) throws javax.websocket.DeploymentException
addEndpoint
in interface javax.websocket.server.ServerContainer
javax.websocket.DeploymentException
protected ClientManager getClientManager()
ClientManager
implementation or instance.ClientManager
associated with this server container.public javax.websocket.Session connectToServer(Class annotatedEndpointClass, URI path) throws javax.websocket.DeploymentException, IOException
connectToServer
in interface javax.websocket.WebSocketContainer
javax.websocket.DeploymentException
IOException
public javax.websocket.Session connectToServer(Class<? extends javax.websocket.Endpoint> endpointClass, javax.websocket.ClientEndpointConfig cec, URI path) throws javax.websocket.DeploymentException, IOException
connectToServer
in interface javax.websocket.WebSocketContainer
javax.websocket.DeploymentException
IOException
public javax.websocket.Session connectToServer(Object annotatedEndpointInstance, URI path) throws javax.websocket.DeploymentException, IOException
connectToServer
in interface javax.websocket.WebSocketContainer
javax.websocket.DeploymentException
IOException
public javax.websocket.Session connectToServer(javax.websocket.Endpoint endpointInstance, javax.websocket.ClientEndpointConfig cec, URI path) throws javax.websocket.DeploymentException, IOException
connectToServer
in interface javax.websocket.WebSocketContainer
javax.websocket.DeploymentException
IOException
public Future<javax.websocket.Session> asyncConnectToServer(Class<?> annotatedEndpointClass, URI path) throws javax.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.javax.websocket.DeploymentException
- if the class is not a valid annotated endpoint class.public Future<javax.websocket.Session> asyncConnectToServer(Class<? extends javax.websocket.Endpoint> endpointClass, javax.websocket.ClientEndpointConfig cec, URI path) throws javax.websocket.DeploymentException
WebSocketContainer.connectToServer(Class,
javax.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.javax.websocket.DeploymentException
- if the configuration is not validWebSocketContainer.connectToServer(Class, javax.websocket.ClientEndpointConfig,
java.net.URI)
public Future<javax.websocket.Session> asyncConnectToServer(javax.websocket.Endpoint endpointInstance, javax.websocket.ClientEndpointConfig cec, URI path) throws javax.websocket.DeploymentException
WebSocketContainer.connectToServer(javax.websocket.Endpoint,
javax.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.javax.websocket.DeploymentException
- if the configuration is not validWebSocketContainer.connectToServer(javax.websocket.Endpoint,
javax.websocket.ClientEndpointConfig, java.net.URI)
public Future<javax.websocket.Session> asyncConnectToServer(Object obj, URI path) throws javax.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.javax.websocket.DeploymentException
- if the annotated endpoint instance is not valid.WebSocketContainer.connectToServer(Object, java.net.URI)
public int getDefaultMaxBinaryMessageBufferSize()
getDefaultMaxBinaryMessageBufferSize
in interface javax.websocket.WebSocketContainer
public void setDefaultMaxBinaryMessageBufferSize(int max)
setDefaultMaxBinaryMessageBufferSize
in interface javax.websocket.WebSocketContainer
public int getDefaultMaxTextMessageBufferSize()
getDefaultMaxTextMessageBufferSize
in interface javax.websocket.WebSocketContainer
public void setDefaultMaxTextMessageBufferSize(int max)
setDefaultMaxTextMessageBufferSize
in interface javax.websocket.WebSocketContainer
public Set<javax.websocket.Extension> getInstalledExtensions()
getInstalledExtensions
in interface javax.websocket.WebSocketContainer
public long getDefaultAsyncSendTimeout()
getDefaultAsyncSendTimeout
in interface javax.websocket.WebSocketContainer
public void setAsyncSendTimeout(long timeoutmillis)
setAsyncSendTimeout
in interface javax.websocket.WebSocketContainer
public long getDefaultMaxSessionIdleTimeout()
getDefaultMaxSessionIdleTimeout
in interface javax.websocket.WebSocketContainer
public void setDefaultMaxSessionIdleTimeout(long defaultMaxSessionIdleTimeout)
setDefaultMaxSessionIdleTimeout
in interface javax.websocket.WebSocketContainer
public void doneDeployment()
addEndpoint(javax.websocket.server.ServerEndpointConfig)
and
addEndpoint(Class)
calls.Copyright © 2012-2015, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.