@ManagedObject(value="JSR356 Client Container") public class ClientContainer extends ContainerLifeCycle implements javax.websocket.WebSocketContainer, WebSocketContainerScope
This should be specific to a JVM if run in a standalone mode. or specific to a WebAppContext if running on the Jetty server.
Modifier and Type | Class and Description |
---|---|
private static class |
ClientContainer.JsrSessionListenerBridge |
AbstractLifeCycle.AbstractLifeCycleListener
Container.InheritedListener, Container.Listener
LifeCycle.Listener
Modifier and Type | Field and Description |
---|---|
private WebSocketClient |
client
The jetty websocket client in use for this container
|
private DecoderFactory |
decoderFactory
Tracking all primitive decoders for the container
|
private EncoderFactory |
encoderFactory
Tracking all primitive encoders for the container
|
private java.util.Map<java.lang.Class<?>,EndpointMetadata> |
endpointClientMetadataCache
Tracking for all declared Client endpoints
|
private boolean |
internalClient |
private static Logger |
LOG |
private WebSocketContainerScope |
scopeDelegate
The delegated Container Scope
|
private JsrSessionTracker |
sessionTracker |
Modifier | Constructor and Description |
---|---|
|
ClientContainer()
This is the entry point for
ContainerProvider.getWebSocketContainer() |
|
ClientContainer(WebSocketClient client)
Build a ClientContainer with a specific WebSocketClient in mind.
|
|
ClientContainer(WebSocketContainerScope scope)
This is the entry point for ServerContainer, via ServletContext.getAttribute(ServerContainer.class.getName())
|
protected |
ClientContainer(WebSocketContainerScope scope,
HttpClient httpClient)
This is the entry point for ServerContainer, via ServletContext.getAttribute(ServerContainer.class.getName())
|
Modifier and Type | Method and Description |
---|---|
void |
addSessionListener(WebSocketSessionListener listener) |
private javax.websocket.Session |
connect(EndpointInstance instance,
java.net.URI path) |
javax.websocket.Session |
connectToServer(java.lang.Class<?> annotatedEndpointClass,
java.net.URI path) |
javax.websocket.Session |
connectToServer(java.lang.Class<? extends javax.websocket.Endpoint> endpointClass,
javax.websocket.ClientEndpointConfig config,
java.net.URI path) |
javax.websocket.Session |
connectToServer(javax.websocket.Endpoint endpoint,
javax.websocket.ClientEndpointConfig config,
java.net.URI path) |
javax.websocket.Session |
connectToServer(java.lang.Object endpoint,
java.net.URI path) |
protected void |
doStart()
Starts the managed lifecycle beans in the order they were added.
|
protected void |
doStop()
Stops the managed lifecycle beans in the reverse order they were added.
|
ByteBufferPool |
getBufferPool()
The configured Container Buffer Pool.
|
WebSocketClient |
getClient() |
EndpointMetadata |
getClientEndpointMetadata(java.lang.Class<?> endpoint,
javax.websocket.EndpointConfig config) |
DecoderFactory |
getDecoderFactory() |
long |
getDefaultAsyncSendTimeout() |
int |
getDefaultMaxBinaryMessageBufferSize() |
long |
getDefaultMaxSessionIdleTimeout() |
int |
getDefaultMaxTextMessageBufferSize() |
EncoderFactory |
getEncoderFactory() |
java.util.concurrent.Executor |
getExecutor()
Executor in use by the container.
|
java.util.Set<javax.websocket.Extension> |
getInstalledExtensions() |
DecoratedObjectFactory |
getObjectFactory()
Object Factory used to create objects.
|
java.util.Set<javax.websocket.Session> |
getOpenSessions()
Used in
Session.getOpenSessions() |
WebSocketPolicy |
getPolicy()
The policy the container is running on.
|
java.util.Collection<WebSocketSessionListener> |
getSessionListeners() |
SslContextFactory |
getSslContextFactory()
The SslContextFactory in use by the container.
|
private EndpointInstance |
newClientEndpointInstance(java.lang.Class<?> endpointClass,
javax.websocket.ClientEndpointConfig config) |
EndpointInstance |
newClientEndpointInstance(java.lang.Object endpoint,
javax.websocket.ClientEndpointConfig config) |
void |
removeSessionListener(WebSocketSessionListener listener) |
void |
setAsyncSendTimeout(long ms) |
void |
setDefaultMaxBinaryMessageBufferSize(int max) |
void |
setDefaultMaxSessionIdleTimeout(long ms) |
void |
setDefaultMaxTextMessageBufferSize(int max) |
addBean, addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isRunning
dumpObjects, dumpSelf
private static final Logger LOG
private final WebSocketContainerScope scopeDelegate
private final DecoderFactory decoderFactory
private final EncoderFactory encoderFactory
private final WebSocketClient client
private final boolean internalClient
private final java.util.Map<java.lang.Class<?>,EndpointMetadata> endpointClientMetadataCache
private final JsrSessionTracker sessionTracker
public ClientContainer()
ContainerProvider.getWebSocketContainer()
public ClientContainer(WebSocketContainerScope scope)
scope
- the scope of the ServerContainerprotected ClientContainer(WebSocketContainerScope scope, HttpClient httpClient)
scope
- the scope of the ServerContainerhttpClient
- the HttpClient instance to usepublic ClientContainer(WebSocketClient client)
client
- the WebSocketClient to use.private javax.websocket.Session connect(EndpointInstance instance, java.net.URI path) throws java.io.IOException
java.io.IOException
public javax.websocket.Session connectToServer(java.lang.Class<? extends javax.websocket.Endpoint> endpointClass, javax.websocket.ClientEndpointConfig config, java.net.URI path) throws javax.websocket.DeploymentException, java.io.IOException
connectToServer
in interface javax.websocket.WebSocketContainer
javax.websocket.DeploymentException
java.io.IOException
public javax.websocket.Session connectToServer(java.lang.Class<?> annotatedEndpointClass, java.net.URI path) throws javax.websocket.DeploymentException, java.io.IOException
connectToServer
in interface javax.websocket.WebSocketContainer
javax.websocket.DeploymentException
java.io.IOException
public javax.websocket.Session connectToServer(javax.websocket.Endpoint endpoint, javax.websocket.ClientEndpointConfig config, java.net.URI path) throws javax.websocket.DeploymentException, java.io.IOException
connectToServer
in interface javax.websocket.WebSocketContainer
javax.websocket.DeploymentException
java.io.IOException
public javax.websocket.Session connectToServer(java.lang.Object endpoint, java.net.URI path) throws javax.websocket.DeploymentException, java.io.IOException
connectToServer
in interface javax.websocket.WebSocketContainer
javax.websocket.DeploymentException
java.io.IOException
protected void doStart() throws java.lang.Exception
ContainerLifeCycle
doStart
in class ContainerLifeCycle
java.lang.Exception
protected void doStop() throws java.lang.Exception
ContainerLifeCycle
doStop
in class ContainerLifeCycle
java.lang.Exception
public ByteBufferPool getBufferPool()
WebSocketContainerScope
getBufferPool
in interface WebSocketContainerScope
public WebSocketClient getClient()
public EndpointMetadata getClientEndpointMetadata(java.lang.Class<?> endpoint, javax.websocket.EndpointConfig config)
public DecoderFactory getDecoderFactory()
public long getDefaultAsyncSendTimeout()
getDefaultAsyncSendTimeout
in interface javax.websocket.WebSocketContainer
public int getDefaultMaxBinaryMessageBufferSize()
getDefaultMaxBinaryMessageBufferSize
in interface javax.websocket.WebSocketContainer
public long getDefaultMaxSessionIdleTimeout()
getDefaultMaxSessionIdleTimeout
in interface javax.websocket.WebSocketContainer
public int getDefaultMaxTextMessageBufferSize()
getDefaultMaxTextMessageBufferSize
in interface javax.websocket.WebSocketContainer
public EncoderFactory getEncoderFactory()
public java.util.concurrent.Executor getExecutor()
WebSocketContainerScope
getExecutor
in interface WebSocketContainerScope
public java.util.Set<javax.websocket.Extension> getInstalledExtensions()
getInstalledExtensions
in interface javax.websocket.WebSocketContainer
public DecoratedObjectFactory getObjectFactory()
WebSocketContainerScope
getObjectFactory
in interface WebSocketContainerScope
public java.util.Set<javax.websocket.Session> getOpenSessions()
Session.getOpenSessions()
public WebSocketPolicy getPolicy()
WebSocketContainerScope
getPolicy
in interface WebSocketContainerScope
public SslContextFactory getSslContextFactory()
WebSocketContainerScope
getSslContextFactory
in interface WebSocketContainerScope
public void addSessionListener(WebSocketSessionListener listener)
addSessionListener
in interface WebSocketContainerScope
public void removeSessionListener(WebSocketSessionListener listener)
removeSessionListener
in interface WebSocketContainerScope
public java.util.Collection<WebSocketSessionListener> getSessionListeners()
getSessionListeners
in interface WebSocketContainerScope
private EndpointInstance newClientEndpointInstance(java.lang.Class<?> endpointClass, javax.websocket.ClientEndpointConfig config)
public EndpointInstance newClientEndpointInstance(java.lang.Object endpoint, javax.websocket.ClientEndpointConfig config)
public void setAsyncSendTimeout(long ms)
setAsyncSendTimeout
in interface javax.websocket.WebSocketContainer
public void setDefaultMaxBinaryMessageBufferSize(int max)
setDefaultMaxBinaryMessageBufferSize
in interface javax.websocket.WebSocketContainer
public void setDefaultMaxSessionIdleTimeout(long ms)
setDefaultMaxSessionIdleTimeout
in interface javax.websocket.WebSocketContainer
public void setDefaultMaxTextMessageBufferSize(int max)
setDefaultMaxTextMessageBufferSize
in interface javax.websocket.WebSocketContainer