public class WsWebSocketContainer extends java.lang.Object implements WebSocketContainer, BackgroundProcess
| Modifier and Type | Field and Description |
|---|---|
static long |
IO_TIMEOUT_MS_DEFAULT |
static java.lang.String |
IO_TIMEOUT_MS_PROPERTY
Property name to set to configure the timeout (in milliseconds) when
establishing a WebSocket connection to server.
|
static java.lang.String |
SSL_CONTEXT_PROPERTY
Property name to set to configure used SSLContext.
|
static java.lang.String |
SSL_PROTOCOLS_PROPERTY
Property name to set to configure the value that is passed to
SSLEngine.setEnabledProtocols(String[]). |
static java.lang.String |
SSL_TRUSTSTORE_PROPERTY |
static java.lang.String |
SSL_TRUSTSTORE_PWD_DEFAULT |
static java.lang.String |
SSL_TRUSTSTORE_PWD_PROPERTY |
| Constructor and Description |
|---|
WsWebSocketContainer() |
| Modifier and Type | Method and Description |
|---|---|
void |
backgroundProcess() |
Session |
connectToServer(java.lang.Class<?> annotatedEndpointClass,
java.net.URI path) |
Session |
connectToServer(java.lang.Class<? extends Endpoint> clazz,
ClientEndpointConfig clientEndpointConfiguration,
java.net.URI path)
Creates a new connection to the WebSocket.
|
Session |
connectToServer(Endpoint endpoint,
ClientEndpointConfig clientEndpointConfiguration,
java.net.URI path)
Creates a new connection to the WebSocket.
|
Session |
connectToServer(java.lang.Object pojo,
java.net.URI path) |
void |
destroy()
Cleans up the resources still in use by WebSocket sessions created from
this container.
|
long |
getDefaultAsyncSendTimeout()
Get the default timeout for sending a message asynchronously.
|
int |
getDefaultMaxBinaryMessageBufferSize()
Get the default maximum buffer size for binary messages.
|
long |
getDefaultMaxSessionIdleTimeout()
Get the current default session idle timeout.
|
int |
getDefaultMaxTextMessageBufferSize()
Get the default maximum buffer size for text messages.
|
java.util.Set<Extension> |
getInstalledExtensions()
Get the installed extensions.
|
int |
getProcessPeriod()
The default value is 10 which means session expirations are processed
every 10 seconds.
|
protected void |
registerSession(java.lang.Object key,
WsSession wsSession) |
void |
setAsyncSendTimeout(long timeout)
Set the default timeout for sending a message asynchronously.
|
void |
setDefaultMaxBinaryMessageBufferSize(int max)
Set the default maximum buffer size for binary messages.
|
void |
setDefaultMaxSessionIdleTimeout(long timeout)
Set the default session idle timeout.
|
void |
setDefaultMaxTextMessageBufferSize(int max)
Set the default maximum buffer size for text messages.
|
protected void |
setInstanceManager(InstanceManager instanceManager) |
void |
setProcessPeriod(int period) |
protected void |
unregisterSession(java.lang.Object key,
WsSession wsSession) |
public static final java.lang.String SSL_PROTOCOLS_PROPERTY
SSLEngine.setEnabledProtocols(String[]). The value should be a
comma separated string.public static final java.lang.String SSL_TRUSTSTORE_PROPERTY
public static final java.lang.String SSL_TRUSTSTORE_PWD_PROPERTY
public static final java.lang.String SSL_TRUSTSTORE_PWD_DEFAULT
public static final java.lang.String SSL_CONTEXT_PROPERTY
public static final java.lang.String IO_TIMEOUT_MS_PROPERTY
IO_TIMEOUT_MS_DEFAULT.public static final long IO_TIMEOUT_MS_DEFAULT
protected void setInstanceManager(InstanceManager instanceManager)
public Session connectToServer(java.lang.Object pojo, java.net.URI path) throws DeploymentException
connectToServer in interface WebSocketContainerDeploymentExceptionpublic Session connectToServer(java.lang.Class<?> annotatedEndpointClass, java.net.URI path) throws DeploymentException
connectToServer in interface WebSocketContainerDeploymentExceptionpublic Session connectToServer(java.lang.Class<? extends Endpoint> clazz, ClientEndpointConfig clientEndpointConfiguration, java.net.URI path) throws DeploymentException
javax.websocket.WebSocketContainerconnectToServer in interface WebSocketContainerclazz - An instance of this class will be created to handle responses
from the serverclientEndpointConfiguration - Used to configure the new connectionpath - The full URL of the WebSocket endpoint to connect toDeploymentException - If the connection can not be establishedpublic Session connectToServer(Endpoint endpoint, ClientEndpointConfig clientEndpointConfiguration, java.net.URI path) throws DeploymentException
javax.websocket.WebSocketContainerconnectToServer in interface WebSocketContainerendpoint - The endpoint instance that will handle responses from the
serverclientEndpointConfiguration - Used to configure the new connectionpath - The full URL of the WebSocket endpoint to connect toDeploymentException - If the connection can not be establishedprotected void registerSession(java.lang.Object key,
WsSession wsSession)
protected void unregisterSession(java.lang.Object key,
WsSession wsSession)
public long getDefaultMaxSessionIdleTimeout()
javax.websocket.WebSocketContainergetDefaultMaxSessionIdleTimeout in interface WebSocketContainerpublic void setDefaultMaxSessionIdleTimeout(long timeout)
javax.websocket.WebSocketContainersetDefaultMaxSessionIdleTimeout in interface WebSocketContainertimeout - The new default session idle timeout in milliseconds. Zero
or negative values indicate an infinite timeout.public int getDefaultMaxBinaryMessageBufferSize()
javax.websocket.WebSocketContainergetDefaultMaxBinaryMessageBufferSize in interface WebSocketContainerpublic void setDefaultMaxBinaryMessageBufferSize(int max)
javax.websocket.WebSocketContainersetDefaultMaxBinaryMessageBufferSize in interface WebSocketContainermax - The new default maximum buffer size in bytespublic int getDefaultMaxTextMessageBufferSize()
javax.websocket.WebSocketContainergetDefaultMaxTextMessageBufferSize in interface WebSocketContainerpublic void setDefaultMaxTextMessageBufferSize(int max)
javax.websocket.WebSocketContainersetDefaultMaxTextMessageBufferSize in interface WebSocketContainermax - The new default maximum buffer size in characterspublic java.util.Set<Extension> getInstalledExtensions()
getInstalledExtensions in interface WebSocketContainerpublic long getDefaultAsyncSendTimeout()
getDefaultAsyncSendTimeout in interface WebSocketContainerpublic void setAsyncSendTimeout(long timeout)
setAsyncSendTimeout in interface WebSocketContainertimeout - The new default timeout in milliseconds. A non-positive
value means an infinite timeout.public void destroy()
Futures associated with blocking read/writes.public void backgroundProcess()
backgroundProcess in interface BackgroundProcesspublic void setProcessPeriod(int period)
setProcessPeriod in interface BackgroundProcesspublic int getProcessPeriod()
getProcessPeriod in interface BackgroundProcessCopyright © 2000-2019 Apache Software Foundation. All Rights Reserved.