public class ServerWebSocketContainer extends Object implements javax.websocket.server.ServerContainer, Closeable
ServerContainer
implementation which allows to deploy endpoints for a server.Modifier and Type | Class and Description |
---|---|
static interface | ServerWebSocketContainer.PauseListener |
Modifier and Type | Field and Description |
---|---|
static int | DEFAULT_WEB_SOCKET_TIMEOUT_SECONDS |
static String | TIMEOUT |
Constructor and Description |
---|
ServerWebSocketContainer(ClassIntrospecter classIntrospecter, ClassLoader classLoader, org.xnio.XnioWorker xnioWorker, ByteBufferPool bufferPool, ThreadSetupAction threadSetupAction, boolean dispatchToWorker) |
ServerWebSocketContainer(ClassIntrospecter classIntrospecter, ClassLoader classLoader, org.xnio.XnioWorker xnioWorker, ByteBufferPool bufferPool, ThreadSetupAction threadSetupAction, boolean dispatchToWorker, InetSocketAddress clientBindAddress, WebSocketReconnectHandler reconnectHandler) |
ServerWebSocketContainer(ClassIntrospecter classIntrospecter, org.xnio.XnioWorker xnioWorker, ByteBufferPool bufferPool, ThreadSetupAction threadSetupAction, boolean dispatchToWorker, boolean clientMode) |
Modifier and Type | Method and Description |
---|---|
void | addEndpoint(Class<?> endpoint) |
void | addEndpoint(javax.websocket.server.ServerEndpointConfig endpoint) |
void | close() |
javax.websocket.Session | connectToServer(Class<?> aClass, URI uri) |
javax.websocket.Session | connectToServer(Class<?> aClass, WebSocketClient.ConnectionBuilder connectionBuilder) |
javax.websocket.Session | connectToServer(Class<? extends javax.websocket.Endpoint> endpointClass, javax.websocket.ClientEndpointConfig cec, URI path) |
javax.websocket.Session | connectToServer(javax.websocket.Endpoint endpointInstance, javax.websocket.ClientEndpointConfig config, URI path) |
javax.websocket.Session | connectToServer(javax.websocket.Endpoint endpointInstance, javax.websocket.ClientEndpointConfig config, WebSocketClient.ConnectionBuilder connectionBuilder) |
javax.websocket.Session | connectToServer(Object annotatedEndpointInstance, URI path) |
javax.websocket.Session | connectToServer(Object annotatedEndpointInstance, WebSocketClient.ConnectionBuilder connectionBuilder) |
void | deploymentComplete() |
ByteBufferPool | getBufferPool() |
List<ConfiguredServerEndpoint> | getConfiguredServerEndpoints() |
ServletContextImpl | getContextToAddFilter() |
long | getDefaultAsyncSendTimeout() |
int | getDefaultMaxBinaryMessageBufferSize() |
long | getDefaultMaxSessionIdleTimeout() |
int | getDefaultMaxTextMessageBufferSize() |
Set<javax.websocket.Extension> | getInstalledExtensions() |
WebSocketReconnectHandler | getWebSocketReconnectHandler() |
org.xnio.XnioWorker | getXnioWorker() |
void | invokeEndpointMethod(Executor executor, Runnable invocation) Runs a web socket invocation, setting up the threads and dispatching a thread pool |
void | invokeEndpointMethod(Runnable invocation) Directly invokes an endpoint method, without dispatching to an executor |
boolean | isClosed() |
boolean | isDispatchToWorker() |
void | pause(ServerWebSocketContainer.PauseListener listener) Pauses the container |
void | resume() resumes a paused container |
void | setAsyncSendTimeout(long defaultAsyncSendTimeout) |
void | setContextToAddFilter(ServletContextImpl contextToAddFilter) |
void | setDefaultMaxBinaryMessageBufferSize(int defaultMaxBinaryMessageBufferSize) |
void | setDefaultMaxSessionIdleTimeout(long timeout) |
void | setDefaultMaxTextMessageBufferSize(int defaultMaxTextMessageBufferSize) |
public static final String TIMEOUT
public static final int DEFAULT_WEB_SOCKET_TIMEOUT_SECONDS
public ServerWebSocketContainer(ClassIntrospecter classIntrospecter, org.xnio.XnioWorker xnioWorker, ByteBufferPool bufferPool, ThreadSetupAction threadSetupAction, boolean dispatchToWorker, boolean clientMode)
public ServerWebSocketContainer(ClassIntrospecter classIntrospecter, ClassLoader classLoader, org.xnio.XnioWorker xnioWorker, ByteBufferPool bufferPool, ThreadSetupAction threadSetupAction, boolean dispatchToWorker)
public ServerWebSocketContainer(ClassIntrospecter classIntrospecter, ClassLoader classLoader, org.xnio.XnioWorker xnioWorker, ByteBufferPool bufferPool, ThreadSetupAction threadSetupAction, boolean dispatchToWorker, InetSocketAddress clientBindAddress, WebSocketReconnectHandler reconnectHandler)
public long getDefaultAsyncSendTimeout()
getDefaultAsyncSendTimeout
in interface javax.websocket.WebSocketContainer
public void setAsyncSendTimeout(long defaultAsyncSendTimeout)
setAsyncSendTimeout
in interface javax.websocket.WebSocketContainer
public javax.websocket.Session connectToServer(Object annotatedEndpointInstance, WebSocketClient.ConnectionBuilder connectionBuilder) throws javax.websocket.DeploymentException, IOException
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(Class<?> aClass, WebSocketClient.ConnectionBuilder connectionBuilder) throws javax.websocket.DeploymentException, IOException
javax.websocket.DeploymentException
IOException
public javax.websocket.Session connectToServer(Class<?> aClass, URI uri) 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 config, 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 config, WebSocketClient.ConnectionBuilder connectionBuilder) throws javax.websocket.DeploymentException, IOException
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 long getDefaultMaxSessionIdleTimeout()
getDefaultMaxSessionIdleTimeout
in interface javax.websocket.WebSocketContainer
public void setDefaultMaxSessionIdleTimeout(long timeout)
setDefaultMaxSessionIdleTimeout
in interface javax.websocket.WebSocketContainer
public int getDefaultMaxBinaryMessageBufferSize()
getDefaultMaxBinaryMessageBufferSize
in interface javax.websocket.WebSocketContainer
public void setDefaultMaxBinaryMessageBufferSize(int defaultMaxBinaryMessageBufferSize)
setDefaultMaxBinaryMessageBufferSize
in interface javax.websocket.WebSocketContainer
public int getDefaultMaxTextMessageBufferSize()
getDefaultMaxTextMessageBufferSize
in interface javax.websocket.WebSocketContainer
public void setDefaultMaxTextMessageBufferSize(int defaultMaxTextMessageBufferSize)
setDefaultMaxTextMessageBufferSize
in interface javax.websocket.WebSocketContainer
public Set<javax.websocket.Extension> getInstalledExtensions()
getInstalledExtensions
in interface javax.websocket.WebSocketContainer
public void invokeEndpointMethod(Executor executor, Runnable invocation)
Unfortunately we need to dispatch to a thread pool, because there is a good chance that the endpoint will use blocking IO methods. We suspend recieves while this is in progress, to make sure that we do not have multiple methods invoked at once.
invocation
- The task to runpublic void invokeEndpointMethod(Runnable invocation)
invocation
- The invocationpublic void addEndpoint(Class<?> endpoint) throws javax.websocket.DeploymentException
addEndpoint
in interface javax.websocket.server.ServerContainer
javax.websocket.DeploymentException
public void addEndpoint(javax.websocket.server.ServerEndpointConfig endpoint) throws javax.websocket.DeploymentException
addEndpoint
in interface javax.websocket.server.ServerContainer
javax.websocket.DeploymentException
public void deploymentComplete()
public List<ConfiguredServerEndpoint> getConfiguredServerEndpoints()
public ServletContextImpl getContextToAddFilter()
public void setContextToAddFilter(ServletContextImpl contextToAddFilter)
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public ByteBufferPool getBufferPool()
public org.xnio.XnioWorker getXnioWorker()
public void pause(ServerWebSocketContainer.PauseListener listener)
listener
- public void resume()
public WebSocketReconnectHandler getWebSocketReconnectHandler()
public boolean isClosed()
public boolean isDispatchToWorker()
Copyright © 2015 JBoss by Red Hat. All rights reserved.