Class WebSocketClient
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.util.component.ContainerLifeCycle
-
- org.eclipse.jetty.websocket.client.WebSocketClient
-
- All Implemented Interfaces:
Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
,WebSocketContainerScope
@Deprecated(since="2021-05-27") public class WebSocketClient extends ContainerLifeCycle implements WebSocketContainerScope
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.WebSocketClient provides a means of establishing connections to remote websocket endpoints.
-
-
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 Constructor Description WebSocketClient()
Deprecated.Instantiate a WebSocketClient with defaults.WebSocketClient(Executor executor)
Deprecated.useWebSocketClient(HttpClient)
insteadWebSocketClient(HttpClient httpClient)
Deprecated.Instantiate a WebSocketClient using provided HttpClient.WebSocketClient(HttpClient httpClient, DecoratedObjectFactory decoratedObjectFactory)
Deprecated.Instantiate a WebSocketClient using HttpClient for defaultsWebSocketClient(ByteBufferPool bufferPool)
Deprecated.useWebSocketClient(HttpClient)
insteadWebSocketClient(SslContextFactory sslContextFactory)
Deprecated.useWebSocketClient(HttpClient)
insteadWebSocketClient(SslContextFactory sslContextFactory, Executor executor)
Deprecated.useWebSocketClient(HttpClient)
insteadWebSocketClient(SslContextFactory sslContextFactory, Executor executor, ByteBufferPool bufferPool)
Deprecated.useWebSocketClient(HttpClient)
insteadWebSocketClient(WebSocketContainerScope scope)
Deprecated.useWebSocketClient(HttpClient)
insteadWebSocketClient(WebSocketContainerScope scope, SslContextFactory sslContextFactory)
Deprecated.useWebSocketClient(HttpClient)
insteadWebSocketClient(WebSocketContainerScope scope, EventDriverFactory eventDriverFactory, SessionFactory sessionFactory)
Deprecated.WebSocketClient(WebSocketContainerScope scope, EventDriverFactory eventDriverFactory, SessionFactory sessionFactory, HttpClient httpClient)
Deprecated.Create WebSocketClient based on pre-existing Container Scope, to allow sharing of internal features like Executor, ByteBufferPool, SSLContextFactory, etc.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addSessionListener(WebSocketSessionListener listener)
Deprecated.Future<Session>
connect(Object websocket, URI toUri)
Deprecated.Future<Session>
connect(Object websocket, URI toUri, ClientUpgradeRequest request)
Deprecated.Connect to remote websocket endpointFuture<Session>
connect(Object websocket, URI toUri, ClientUpgradeRequest request, UpgradeListener upgradeListener)
Deprecated.Connect to remote websocket endpointboolean
equals(Object o)
Deprecated.long
getAsyncWriteTimeout()
Deprecated.SocketAddress
getBindAddress()
Deprecated.ByteBufferPool
getBufferPool()
Deprecated.The configured Container Buffer Pool.ClassLoader
getClassLoader()
Deprecated.The ClassLoader used to load classes for the WebSocketSession.ConnectionManager
getConnectionManager()
Deprecated.long
getConnectTimeout()
Deprecated.CookieStore
getCookieStore()
Deprecated.EventDriverFactory
getEventDriverFactory()
Deprecated.Executor
getExecutor()
Deprecated.Executor in use by the container.ExtensionFactory
getExtensionFactory()
Deprecated.HttpClient
getHttpClient()
Deprecated.Get the internalHttpClient
.Masker
getMasker()
Deprecated.not used, no replacementint
getMaxBinaryMessageBufferSize()
Deprecated.Get the maximum size for buffering of a binary message.long
getMaxBinaryMessageSize()
Deprecated.Get the maximum size for a binary message.long
getMaxIdleTimeout()
Deprecated.Get the max idle timeout for new connections.int
getMaxTextMessageBufferSize()
Deprecated.Get the maximum size for buffering of a text message.long
getMaxTextMessageSize()
Deprecated.Get the maximum size for a text message.DecoratedObjectFactory
getObjectFactory()
Deprecated.Object Factory used to create objects.Set<WebSocketSession>
getOpenSessions()
Deprecated.WebSocketPolicy
getPolicy()
Deprecated.The policy the container is running on.Scheduler
getScheduler()
Deprecated.SessionFactory
getSessionFactory()
Deprecated.Collection<WebSocketSessionListener>
getSessionListeners()
Deprecated.SslContextFactory
getSslContextFactory()
Deprecated.Get the in useSslContextFactory
int
hashCode()
Deprecated.boolean
isDispatchIO()
Deprecated.boolean
isStopAtShutdown()
Deprecated.void
removeSessionListener(WebSocketSessionListener listener)
Deprecated.void
setAsyncWriteTimeout(long ms)
Deprecated.void
setBindAdddress(SocketAddress bindAddress)
Deprecated.(this is a bad bad bad typo, it has 3 { @ code " d " } characters in a row) useHttpClient.setBindAddress(SocketAddress)
to the internalWebSocketClient(HttpClient)
void
setBindAddress(SocketAddress bindAddress)
Deprecated.Sets the Bind Address on the internalHttpClient
.void
setBufferPool(ByteBufferPool bufferPool)
Deprecated.Set's the Bind Address on the internalHttpClient
.void
setConnectTimeout(long ms)
Deprecated.Set the timeout for connecting to the remote server on the internalHttpClient
void
setCookieStore(CookieStore cookieStore)
Deprecated.Set theCookieStore
to use on the internalHttpClient
void
setDaemon(boolean daemon)
Deprecated.not used, configure threading inHttpClient
insteadvoid
setDispatchIO(boolean dispatchIO)
Deprecated.no longer used, this has no replacementvoid
setEventDriverFactory(EventDriverFactory eventDriverFactory)
Deprecated.void
setExecutor(Executor executor)
Deprecated.Sets the Executor in use on the internalHttpClient
void
setMasker(Masker masker)
Deprecated.not used, no replacementvoid
setMaxBinaryMessageBufferSize(int max)
Deprecated.void
setMaxIdleTimeout(long ms)
Deprecated.Set the max idle timeout for new connections.void
setMaxTextMessageBufferSize(int max)
Deprecated.void
setSessionFactory(SessionFactory sessionFactory)
Deprecated.void
setStopAtShutdown(boolean stop)
Deprecated.Set JVM shutdown behavior.String
toString()
Deprecated.-
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, 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
-
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
-
WebSocketClient
public WebSocketClient()
Deprecated.Instantiate a WebSocketClient with defaults.
-
WebSocketClient
public WebSocketClient(HttpClient httpClient)
Deprecated.Instantiate a WebSocketClient using provided HttpClient.- Parameters:
httpClient
- the HttpClient to use for WebSocketClient.
-
WebSocketClient
public WebSocketClient(HttpClient httpClient, DecoratedObjectFactory decoratedObjectFactory)
Deprecated.Instantiate a WebSocketClient using HttpClient for defaults- Parameters:
httpClient
- the HttpClient that underlying WebSocket client usesdecoratedObjectFactory
- the DecoratedObjectFactory for all client instantiated classes
-
WebSocketClient
@Deprecated public WebSocketClient(SslContextFactory sslContextFactory)
Deprecated.useWebSocketClient(HttpClient)
insteadCreate a new WebSocketClient- Parameters:
sslContextFactory
- ssl context factory to use on the internalHttpClient
-
WebSocketClient
@Deprecated public WebSocketClient(Executor executor)
Deprecated.useWebSocketClient(HttpClient)
insteadCreate a new WebSocketClient- Parameters:
executor
- the executor to use on the internalHttpClient
-
WebSocketClient
@Deprecated public WebSocketClient(ByteBufferPool bufferPool)
Deprecated.useWebSocketClient(HttpClient)
insteadCreate a new WebSocketClient- Parameters:
bufferPool
- byte buffer pool to use on the internalHttpClient
-
WebSocketClient
@Deprecated public WebSocketClient(SslContextFactory sslContextFactory, Executor executor)
Deprecated.useWebSocketClient(HttpClient)
insteadCreate a new WebSocketClient- Parameters:
sslContextFactory
- ssl context factory to use on the internalHttpClient
executor
- the executor to use on the internalHttpClient
-
WebSocketClient
@Deprecated public WebSocketClient(WebSocketContainerScope scope)
Deprecated.useWebSocketClient(HttpClient)
insteadCreate WebSocketClient other Container Scope, to allow sharing of internal features like Executor, ByteBufferPool, SSLContextFactory, etc.- Parameters:
scope
- the Container Scope
-
WebSocketClient
@Deprecated public WebSocketClient(WebSocketContainerScope scope, SslContextFactory sslContextFactory)
Deprecated.useWebSocketClient(HttpClient)
insteadCreate WebSocketClient other Container Scope, to allow sharing of internal features like Executor, ByteBufferPool, SSLContextFactory, etc.- Parameters:
scope
- the Container ScopesslContextFactory
- SSL ContextFactory to use in preference to one fromWebSocketContainerScope.getSslContextFactory()
-
WebSocketClient
@Deprecated public WebSocketClient(SslContextFactory sslContextFactory, Executor executor, ByteBufferPool bufferPool)
Deprecated.useWebSocketClient(HttpClient)
insteadCreate WebSocketClient using sharing instances of SSLContextFactory Executor, and ByteBufferPool- Parameters:
sslContextFactory
- shared SSL ContextFactoryexecutor
- shared ExecutorbufferPool
- shared ByteBufferPool
-
WebSocketClient
@Deprecated public WebSocketClient(WebSocketContainerScope scope, EventDriverFactory eventDriverFactory, SessionFactory sessionFactory)
Deprecated.Create WebSocketClient based on pre-existing Container Scope, to allow sharing of internal features like Executor, ByteBufferPool, SSLContextFactory, etc.- Parameters:
scope
- the Container ScopeeventDriverFactory
- the EventDriver Factory to usesessionFactory
- the SessionFactory to use
-
WebSocketClient
public WebSocketClient(WebSocketContainerScope scope, EventDriverFactory eventDriverFactory, SessionFactory sessionFactory, HttpClient httpClient)
Deprecated.Create WebSocketClient based on pre-existing Container Scope, to allow sharing of internal features like Executor, ByteBufferPool, SSLContextFactory, etc.- Parameters:
scope
- the Container ScopeeventDriverFactory
- the EventDriver Factory to usesessionFactory
- the SessionFactory to usehttpClient
- the httpClient to use
-
-
Method Detail
-
connect
public Future<Session> connect(Object websocket, URI toUri) throws IOException
Deprecated.- Throws:
IOException
-
connect
public Future<Session> connect(Object websocket, URI toUri, ClientUpgradeRequest request) throws IOException
Deprecated.Connect to remote websocket endpoint- Parameters:
websocket
- the websocket objecttoUri
- the websocket uri to connect torequest
- the upgrade request information- Returns:
- the future for the session, available on success of connect
- Throws:
IOException
- if unable to connect
-
connect
public Future<Session> connect(Object websocket, URI toUri, ClientUpgradeRequest request, UpgradeListener upgradeListener) throws IOException
Deprecated.Connect to remote websocket endpoint- Parameters:
websocket
- the websocket objecttoUri
- the websocket uri to connect torequest
- the upgrade request informationupgradeListener
- the upgrade listener- Returns:
- the future for the session, available on success of connect
- Throws:
IOException
- if unable to connect
-
getClassLoader
public ClassLoader getClassLoader()
Deprecated.Description copied from interface:WebSocketContainerScope
The 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
ThreadPool
so the WebSocketSessions may be created when the ContextClassLoader is not set.- Specified by:
getClassLoader
in interfaceWebSocketContainerScope
- Returns:
- the classloader.
-
setEventDriverFactory
public void setEventDriverFactory(EventDriverFactory eventDriverFactory)
Deprecated.
-
setSessionFactory
public void setSessionFactory(SessionFactory sessionFactory)
Deprecated.
-
isDispatchIO
@Deprecated public boolean isDispatchIO()
Deprecated.
-
getAsyncWriteTimeout
@Deprecated public long getAsyncWriteTimeout()
Deprecated.Return the number of milliseconds for a timeout of an attempted write operation.- Returns:
- number of milliseconds for timeout of an attempted write operation
-
getBindAddress
public SocketAddress getBindAddress()
Deprecated.
-
getBufferPool
public ByteBufferPool getBufferPool()
Deprecated.Description copied from interface:WebSocketContainerScope
The configured Container Buffer Pool.- Specified by:
getBufferPool
in interfaceWebSocketContainerScope
- Returns:
- the buffer pool (never null)
-
getConnectionManager
@Deprecated public ConnectionManager getConnectionManager()
Deprecated.
-
getConnectTimeout
public long getConnectTimeout()
Deprecated.
-
getCookieStore
public CookieStore getCookieStore()
Deprecated.
-
getEventDriverFactory
public EventDriverFactory getEventDriverFactory()
Deprecated.
-
getExecutor
public Executor getExecutor()
Deprecated.Description copied from interface:WebSocketContainerScope
Executor in use by the container.- Specified by:
getExecutor
in interfaceWebSocketContainerScope
- Returns:
- the Executor in use by the container.
-
getExtensionFactory
public ExtensionFactory getExtensionFactory()
Deprecated.
-
getMasker
@Deprecated public Masker getMasker()
Deprecated.not used, no replacement- Returns:
- a
RandomMasker
instance
-
getMaxBinaryMessageBufferSize
public int getMaxBinaryMessageBufferSize()
Deprecated.Get the maximum size for buffering of a binary message.- Returns:
- the maximum size of a binary message buffer.
-
getMaxBinaryMessageSize
public long getMaxBinaryMessageSize()
Deprecated.Get the maximum size for a binary message.- Returns:
- the maximum size of a binary message.
-
getMaxIdleTimeout
public long getMaxIdleTimeout()
Deprecated.Get the max idle timeout for new connections.- Returns:
- the max idle timeout in milliseconds for new connections.
-
getMaxTextMessageBufferSize
public int getMaxTextMessageBufferSize()
Deprecated.Get the maximum size for buffering of a text message.- Returns:
- the maximum size of a text message buffer.
-
getMaxTextMessageSize
public long getMaxTextMessageSize()
Deprecated.Get the maximum size for a text message.- Returns:
- the maximum size of a text message.
-
getObjectFactory
public DecoratedObjectFactory getObjectFactory()
Deprecated.Description copied from interface:WebSocketContainerScope
Object Factory used to create objects.- Specified by:
getObjectFactory
in interfaceWebSocketContainerScope
- Returns:
- Object Factory used to create instances of objects.
-
getOpenSessions
public Set<WebSocketSession> getOpenSessions()
Deprecated.
-
getPolicy
public WebSocketPolicy getPolicy()
Deprecated.Description copied from interface:WebSocketContainerScope
The policy the container is running on.- Specified by:
getPolicy
in interfaceWebSocketContainerScope
- Returns:
- the websocket policy
-
getScheduler
public Scheduler getScheduler()
Deprecated.
-
getSessionFactory
public SessionFactory getSessionFactory()
Deprecated.
-
getSslContextFactory
public SslContextFactory getSslContextFactory()
Deprecated.Get the in useSslContextFactory
- Specified by:
getSslContextFactory
in interfaceWebSocketContainerScope
- Returns:
- the
SslContextFactory
that manages TLS encryption on the internalHttpClient
- See Also:
WebSocketClient(SslContextFactory)
-
addSessionListener
public void addSessionListener(WebSocketSessionListener listener)
Deprecated.- Specified by:
addSessionListener
in interfaceWebSocketContainerScope
-
removeSessionListener
public void removeSessionListener(WebSocketSessionListener listener)
Deprecated.- Specified by:
removeSessionListener
in interfaceWebSocketContainerScope
-
getSessionListeners
public Collection<WebSocketSessionListener> getSessionListeners()
Deprecated.- Specified by:
getSessionListeners
in interfaceWebSocketContainerScope
-
setAsyncWriteTimeout
public void setAsyncWriteTimeout(long ms)
Deprecated.
-
setBindAdddress
@Deprecated public void setBindAdddress(SocketAddress bindAddress)
Deprecated.(this is a bad bad bad typo, it has 3 { @ code " d " } characters in a row) useHttpClient.setBindAddress(SocketAddress)
to the internalWebSocketClient(HttpClient)
- Parameters:
bindAddress
- the address to bind to the internalHttpClient
-
setBindAddress
public void setBindAddress(SocketAddress bindAddress)
Deprecated.Sets the Bind Address on the internalHttpClient
.- Parameters:
bindAddress
- the local bind address for the internalHttpClient
-
setBufferPool
public void setBufferPool(ByteBufferPool bufferPool)
Deprecated.Set's the Bind Address on the internalHttpClient
.- Parameters:
bufferPool
- The buffer pool
-
setConnectTimeout
public void setConnectTimeout(long ms)
Deprecated.Set the timeout for connecting to the remote server on the internalHttpClient
- Parameters:
ms
- the timeout in milliseconds
-
setCookieStore
public void setCookieStore(CookieStore cookieStore)
Deprecated.Set theCookieStore
to use on the internalHttpClient
- Parameters:
cookieStore
- The cookie store
-
setDaemon
@Deprecated public void setDaemon(boolean daemon)
Deprecated.not used, configure threading inHttpClient
instead- Parameters:
daemon
- do nothing
-
setDispatchIO
@Deprecated public void setDispatchIO(boolean dispatchIO)
Deprecated.no longer used, this has no replacement- Parameters:
dispatchIO
- true to have IO operations be dispatched to Executor
-
setExecutor
public void setExecutor(Executor executor)
Deprecated.Sets the Executor in use on the internalHttpClient
- Parameters:
executor
- The executor to use
-
setMasker
@Deprecated public void setMasker(Masker masker)
Deprecated.not used, no replacement- Parameters:
masker
- does nothing
-
setMaxBinaryMessageBufferSize
public void setMaxBinaryMessageBufferSize(int max)
Deprecated.
-
setMaxIdleTimeout
public void setMaxIdleTimeout(long ms)
Deprecated.Set the max idle timeout for new connections.Existing connections will not have their max idle timeout adjusted.
- Parameters:
ms
- the timeout in milliseconds
-
setMaxTextMessageBufferSize
public void setMaxTextMessageBufferSize(int max)
Deprecated.
-
getHttpClient
public HttpClient getHttpClient()
Deprecated.Get the internalHttpClient
.Note: this can result in a
LinkageError
if used within a WebApp that runs on a server that also hasHttpClient
on the server classpath.- Returns:
- the internal
HttpClient
-
setStopAtShutdown
public void setStopAtShutdown(boolean stop)
Deprecated.Set JVM shutdown behavior.- Parameters:
stop
- If true, this client instance will be explicitly stopped when the JVM is shutdown. Otherwise the application is responsible for maintaining the WebSocketClient lifecycle.- See Also:
Runtime.addShutdownHook(Thread)
,ShutdownThread
-
isStopAtShutdown
public boolean isStopAtShutdown()
Deprecated.
-
toString
public String toString()
Deprecated.- Overrides:
toString
in classAbstractLifeCycle
-
-