Class ClientContainer
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.util.component.ContainerLifeCycle
-
- org.eclipse.jetty.websocket.jsr356.ClientContainer
-
- All Implemented Interfaces:
javax.websocket.WebSocketContainer,Container,Destroyable,Dumpable,Dumpable.DumpableContainer,LifeCycle,WebSocketContainerScope
- Direct Known Subclasses:
ServerContainer
@ManagedObject("JSR356 Client Container") public class ClientContainer extends ContainerLifeCycle implements javax.websocket.WebSocketContainer, WebSocketContainerScope
Container for Client use of the javax.websocket API.This should be specific to a JVM if run in a standalone mode. or specific to a WebAppContext if running on the Jetty server.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.Listener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
-
Constructor Summary
Constructors Modifier Constructor Description ClientContainer()This is the entry point forContainerProvider.getWebSocketContainer()ClientContainer(HttpClient httpClient)Create aWebSocketContainerusing the suppliedHttpClientfor environments where you want to configure SSL/TLS or Proxy behaviors.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())protectedClientContainer(WebSocketContainerScope scope, HttpClient httpClient)This is the entry point for ServerContainer, via ServletContext.getAttribute(ServerContainer.class.getName())
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSessionListener(WebSocketSessionListener listener)javax.websocket.SessionconnectToServer(java.lang.Class<?> annotatedEndpointClass, java.net.URI path)javax.websocket.SessionconnectToServer(java.lang.Class<? extends javax.websocket.Endpoint> endpointClass, javax.websocket.ClientEndpointConfig config, java.net.URI path)javax.websocket.SessionconnectToServer(java.lang.Object endpoint, java.net.URI path)javax.websocket.SessionconnectToServer(javax.websocket.Endpoint endpoint, javax.websocket.ClientEndpointConfig config, java.net.URI path)protected voiddoStart()Starts the managed lifecycle beans in the order they were added.protected voiddoStop()Stops the managed lifecycle beans in the reverse order they were added.ByteBufferPoolgetBufferPool()The configured Container Buffer Pool.java.lang.ClassLoadergetClassLoader()The ClassLoader used to load classes for the WebSocketSession.WebSocketClientgetClient()EndpointMetadatagetClientEndpointMetadata(java.lang.Class<?> endpoint, javax.websocket.EndpointConfig config)DecoderFactorygetDecoderFactory()longgetDefaultAsyncSendTimeout()intgetDefaultMaxBinaryMessageBufferSize()longgetDefaultMaxSessionIdleTimeout()intgetDefaultMaxTextMessageBufferSize()EncoderFactorygetEncoderFactory()java.util.concurrent.ExecutorgetExecutor()Executor in use by the container.java.util.Set<javax.websocket.Extension>getInstalledExtensions()DecoratedObjectFactorygetObjectFactory()Object Factory used to create objects.java.util.Set<javax.websocket.Session>getOpenSessions()Used inSession.getOpenSessions()WebSocketPolicygetPolicy()The policy the container is running on.java.util.Collection<WebSocketSessionListener>getSessionListeners()SslContextFactorygetSslContextFactory()The SslContextFactory in use by the container.EndpointInstancenewClientEndpointInstance(java.lang.Object endpoint, javax.websocket.ClientEndpointConfig config)voidremoveSessionListener(WebSocketSessionListener listener)voidsetAsyncSendTimeout(long ms)voidsetDefaultMaxBinaryMessageBufferSize(int max)voidsetDefaultMaxSessionIdleTimeout(long ms)voidsetDefaultMaxTextMessageBufferSize(int max)-
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
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
-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
Methods inherited from interface org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope
isRunning
-
-
-
-
Constructor Detail
-
ClientContainer
public ClientContainer()
This is the entry point forContainerProvider.getWebSocketContainer()
-
ClientContainer
public ClientContainer(HttpClient httpClient)
Create aWebSocketContainerusing the suppliedHttpClientfor environments where you want to configure SSL/TLS or Proxy behaviors.- Parameters:
httpClient- the HttpClient instance to use
-
ClientContainer
public ClientContainer(WebSocketContainerScope scope)
This is the entry point for ServerContainer, via ServletContext.getAttribute(ServerContainer.class.getName())- Parameters:
scope- the scope of the ServerContainer
-
ClientContainer
protected ClientContainer(WebSocketContainerScope scope, HttpClient httpClient)
This is the entry point for ServerContainer, via ServletContext.getAttribute(ServerContainer.class.getName())- Parameters:
scope- the scope of the ServerContainerhttpClient- the HttpClient instance to use
-
ClientContainer
public ClientContainer(WebSocketClient client)
Build a ClientContainer with a specific WebSocketClient in mind.- Parameters:
client- the WebSocketClient to use.
-
-
Method Detail
-
connectToServer
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- Specified by:
connectToServerin interfacejavax.websocket.WebSocketContainer- Throws:
javax.websocket.DeploymentExceptionjava.io.IOException
-
connectToServer
public javax.websocket.Session connectToServer(java.lang.Class<?> annotatedEndpointClass, java.net.URI path) throws javax.websocket.DeploymentException, java.io.IOException- Specified by:
connectToServerin interfacejavax.websocket.WebSocketContainer- Throws:
javax.websocket.DeploymentExceptionjava.io.IOException
-
connectToServer
public javax.websocket.Session connectToServer(javax.websocket.Endpoint endpoint, javax.websocket.ClientEndpointConfig config, java.net.URI path) throws javax.websocket.DeploymentException, java.io.IOException- Specified by:
connectToServerin interfacejavax.websocket.WebSocketContainer- Throws:
javax.websocket.DeploymentExceptionjava.io.IOException
-
connectToServer
public javax.websocket.Session connectToServer(java.lang.Object endpoint, java.net.URI path) throws javax.websocket.DeploymentException, java.io.IOException- Specified by:
connectToServerin interfacejavax.websocket.WebSocketContainer- Throws:
javax.websocket.DeploymentExceptionjava.io.IOException
-
doStart
protected void doStart() throws java.lang.ExceptionDescription copied from class:ContainerLifeCycleStarts the managed lifecycle beans in the order they were added.- Overrides:
doStartin classContainerLifeCycle- Throws:
java.lang.Exception
-
doStop
protected void doStop() throws java.lang.ExceptionDescription copied from class:ContainerLifeCycleStops the managed lifecycle beans in the reverse order they were added.- Overrides:
doStopin classContainerLifeCycle- Throws:
java.lang.Exception
-
getBufferPool
public ByteBufferPool getBufferPool()
Description copied from interface:WebSocketContainerScopeThe configured Container Buffer Pool.- Specified by:
getBufferPoolin interfaceWebSocketContainerScope- Returns:
- the buffer pool (never null)
-
getClient
public WebSocketClient getClient()
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
Description copied from interface:WebSocketContainerScopeThe ClassLoader used to load classes for the WebSocketSession.
By default this will be the ContextClassLoader at the time this method is called. However this will be overridden by the WebSocketClient to use the ContextClassLoader at the time it was created, this is because the client uses its own
ThreadPoolso the WebSocketSessions may be created when the ContextClassLoader is not set.- Specified by:
getClassLoaderin interfaceWebSocketContainerScope- Returns:
- the classloader.
-
getClientEndpointMetadata
public EndpointMetadata getClientEndpointMetadata(java.lang.Class<?> endpoint, javax.websocket.EndpointConfig config)
-
getDecoderFactory
public DecoderFactory getDecoderFactory()
-
getDefaultAsyncSendTimeout
public long getDefaultAsyncSendTimeout()
- Specified by:
getDefaultAsyncSendTimeoutin interfacejavax.websocket.WebSocketContainer
-
getDefaultMaxBinaryMessageBufferSize
public int getDefaultMaxBinaryMessageBufferSize()
- Specified by:
getDefaultMaxBinaryMessageBufferSizein interfacejavax.websocket.WebSocketContainer
-
getDefaultMaxSessionIdleTimeout
public long getDefaultMaxSessionIdleTimeout()
- Specified by:
getDefaultMaxSessionIdleTimeoutin interfacejavax.websocket.WebSocketContainer
-
getDefaultMaxTextMessageBufferSize
public int getDefaultMaxTextMessageBufferSize()
- Specified by:
getDefaultMaxTextMessageBufferSizein interfacejavax.websocket.WebSocketContainer
-
getEncoderFactory
public EncoderFactory getEncoderFactory()
-
getExecutor
public java.util.concurrent.Executor getExecutor()
Description copied from interface:WebSocketContainerScopeExecutor in use by the container.- Specified by:
getExecutorin interfaceWebSocketContainerScope- Returns:
- the Executor in use by the container.
-
getInstalledExtensions
public java.util.Set<javax.websocket.Extension> getInstalledExtensions()
- Specified by:
getInstalledExtensionsin interfacejavax.websocket.WebSocketContainer
-
getObjectFactory
public DecoratedObjectFactory getObjectFactory()
Description copied from interface:WebSocketContainerScopeObject Factory used to create objects.- Specified by:
getObjectFactoryin interfaceWebSocketContainerScope- Returns:
- Object Factory used to create instances of objects.
-
getOpenSessions
public java.util.Set<javax.websocket.Session> getOpenSessions()
Used inSession.getOpenSessions()- Returns:
- the set of open sessions
-
getPolicy
public WebSocketPolicy getPolicy()
Description copied from interface:WebSocketContainerScopeThe policy the container is running on.- Specified by:
getPolicyin interfaceWebSocketContainerScope- Returns:
- the websocket policy
-
getSslContextFactory
public SslContextFactory getSslContextFactory()
Description copied from interface:WebSocketContainerScopeThe SslContextFactory in use by the container.- Specified by:
getSslContextFactoryin interfaceWebSocketContainerScope- Returns:
- the SslContextFactory in use by the container (can be null if no SSL context is defined)
-
addSessionListener
public void addSessionListener(WebSocketSessionListener listener)
- Specified by:
addSessionListenerin interfaceWebSocketContainerScope
-
removeSessionListener
public void removeSessionListener(WebSocketSessionListener listener)
- Specified by:
removeSessionListenerin interfaceWebSocketContainerScope
-
getSessionListeners
public java.util.Collection<WebSocketSessionListener> getSessionListeners()
- Specified by:
getSessionListenersin interfaceWebSocketContainerScope
-
newClientEndpointInstance
public EndpointInstance newClientEndpointInstance(java.lang.Object endpoint, javax.websocket.ClientEndpointConfig config)
-
setAsyncSendTimeout
public void setAsyncSendTimeout(long ms)
- Specified by:
setAsyncSendTimeoutin interfacejavax.websocket.WebSocketContainer
-
setDefaultMaxBinaryMessageBufferSize
public void setDefaultMaxBinaryMessageBufferSize(int max)
- Specified by:
setDefaultMaxBinaryMessageBufferSizein interfacejavax.websocket.WebSocketContainer
-
setDefaultMaxSessionIdleTimeout
public void setDefaultMaxSessionIdleTimeout(long ms)
- Specified by:
setDefaultMaxSessionIdleTimeoutin interfacejavax.websocket.WebSocketContainer
-
setDefaultMaxTextMessageBufferSize
public void setDefaultMaxTextMessageBufferSize(int max)
- Specified by:
setDefaultMaxTextMessageBufferSizein interfacejavax.websocket.WebSocketContainer
-
-