Class JettyWebSocketClient
- All Implemented Interfaces:
- Lifecycle,- WebSocketClient
StandardWebSocketClient.
 As of 4.1 this class implements Lifecycle rather than
 SmartLifecycle. Use
 WebSocketConnectionManager instead to auto-start a WebSocket connection.
- Since:
- 4.0
- Author:
- Rossen Stoyanchev, Juergen Hoeller
- 
Field SummaryFields inherited from class org.springframework.web.socket.client.AbstractWebSocketClientlogger
- 
Constructor SummaryConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Default constructor that creates an instance ofWebSocketClient.JettyWebSocketClient(org.eclipse.jetty.websocket.client.WebSocketClient client) Deprecated, for removal: This API element is subject to removal in a future version.Constructor that accepts an existingWebSocketClientinstance.
- 
Method SummaryModifier and TypeMethodDescriptionexecuteInternal(WebSocketHandler wsHandler, HttpHeaders headers, URI uri, List<String> protocols, List<WebSocketExtension> extensions, Map<String, Object> attributes) Deprecated, for removal: This API element is subject to removal in a future version.Perform the actual handshake to establish a connection to the server.Deprecated, for removal: This API element is subject to removal in a future version.Return the configuredAsyncTaskExecutor.protected PrincipalgetUser()Deprecated, for removal: This API element is subject to removal in a future version.Return the user to make available throughWebSocketSession.getPrincipal().booleanDeprecated, for removal: This API element is subject to removal in a future version.Check whether this component is currently running.voidsetTaskExecutor(AsyncTaskExecutor taskExecutor) Deprecated, for removal: This API element is subject to removal in a future version.Set anAsyncTaskExecutorto use when opening connections.voidstart()Deprecated, for removal: This API element is subject to removal in a future version.Start this component.voidstop()Deprecated, for removal: This API element is subject to removal in a future version.Stop this component, typically in a synchronous fashion, such that the component is fully stopped upon return of this method.Methods inherited from class org.springframework.web.socket.client.AbstractWebSocketClientassertUri, doHandshakeInternal, execute, executeMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.socket.client.WebSocketClientdoHandshake, doHandshake
- 
Constructor Details- 
JettyWebSocketClientpublic JettyWebSocketClient()Deprecated, for removal: This API element is subject to removal in a future version.Default constructor that creates an instance ofWebSocketClient.
- 
JettyWebSocketClientpublic JettyWebSocketClient(org.eclipse.jetty.websocket.client.WebSocketClient client) Deprecated, for removal: This API element is subject to removal in a future version.Constructor that accepts an existingWebSocketClientinstance.
 
- 
- 
Method Details- 
setTaskExecutorDeprecated, for removal: This API element is subject to removal in a future version.Set anAsyncTaskExecutorto use when opening connections.If this property is set to null, calls to any of thedoHandshakemethods will block until the connection is established.By default an instance of SimpleAsyncTaskExecutoris used.
- 
getTaskExecutorDeprecated, for removal: This API element is subject to removal in a future version.Return the configuredAsyncTaskExecutor.
- 
startpublic void start()Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:LifecycleStart this component.Should not throw an exception if the component is already running. In the case of a container, this will propagate the start signal to all components that apply. 
- 
stoppublic void stop()Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:LifecycleStop this component, typically in a synchronous fashion, such that the component is fully stopped upon return of this method. Consider implementingSmartLifecycleand itsstop(Runnable)variant when asynchronous stop behavior is necessary.Note that this stop notification is not guaranteed to come before destruction: On regular shutdown, Lifecyclebeans will first receive a stop notification before the general destruction callbacks are being propagated; however, on hot refresh during a context's lifetime or on aborted refresh attempts, a given bean's destroy method will be called without any consideration of stop signals upfront.Should not throw an exception if the component is not running (not started yet). In the case of a container, this will propagate the stop signal to all components that apply. 
- 
isRunningpublic boolean isRunning()Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:LifecycleCheck whether this component is currently running.In the case of a container, this will return trueonly if all components that apply are currently running.
- 
executeInternalpublic CompletableFuture<WebSocketSession> executeInternal(WebSocketHandler wsHandler, HttpHeaders headers, URI uri, List<String> protocols, List<WebSocketExtension> extensions, Map<String, Object> attributes) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:AbstractWebSocketClientPerform the actual handshake to establish a connection to the server.- Specified by:
- executeInternalin class- AbstractWebSocketClient
- Parameters:
- wsHandler- the client-side handler for WebSocket messages
- headers- the HTTP headers to use for the handshake, with unwanted (forbidden) headers filtered out (never- null)
- uri- the target URI for the handshake (never- null)
- protocols- requested sub-protocols, or an empty list
- extensions- requested WebSocket extensions, or an empty list
- attributes- the attributes to associate with the WebSocketSession, i.e. via- WebSocketSession.getAttributes(); currently always an empty map
- Returns:
- the established WebSocket session wrapped in a CompletableFuture.
 
- 
getUserDeprecated, for removal: This API element is subject to removal in a future version.Return the user to make available throughWebSocketSession.getPrincipal(). By default, this method returnsnull
 
- 
StandardWebSocketClient