public class JettyWebSocketClient extends AbstractWebSocketClient implements org.springframework.context.SmartLifecycle
logger| Constructor and Description |
|---|
JettyWebSocketClient()
Default constructor that creates an instance of
<code>WebSocketClient</code> with default settings.
|
JettyWebSocketClient(org.eclipse.jetty.websocket.client.WebSocketClient client)
Constructor that accepts a pre-configured <code>WebSocketClient</code>.
|
| Modifier and Type | Method and Description |
|---|---|
WebSocketSession |
doHandshake(WebSocketHandler webSocketHandler,
String uriTemplate,
Object... uriVars) |
WebSocketSession |
doHandshakeInternal(WebSocketHandler wsHandler,
org.springframework.http.HttpHeaders headers,
URI uri,
List<String> protocols,
Map<String,Object> handshakeAttributes)
Perform the actual handshake to establish a connection to the server.
|
int |
getPhase() |
protected Principal |
getUser() |
boolean |
isAutoStartup() |
boolean |
isRunning() |
void |
setAutoStartup(boolean autoStartup) |
void |
setPhase(int phase) |
void |
start() |
void |
stop() |
void |
stop(Runnable callback) |
doHandshakepublic JettyWebSocketClient()
public JettyWebSocketClient(org.eclipse.jetty.websocket.client.WebSocketClient client)
public void setAutoStartup(boolean autoStartup)
public boolean isAutoStartup()
isAutoStartup in interface org.springframework.context.SmartLifecyclepublic void setPhase(int phase)
public int getPhase()
getPhase in interface org.springframework.context.Phasedpublic boolean isRunning()
isRunning in interface org.springframework.context.Lifecyclepublic void start()
start in interface org.springframework.context.Lifecyclepublic void stop()
stop in interface org.springframework.context.Lifecyclepublic void stop(Runnable callback)
stop in interface org.springframework.context.SmartLifecyclepublic WebSocketSession doHandshake(WebSocketHandler webSocketHandler, String uriTemplate, Object... uriVars) throws WebSocketConnectFailureException
doHandshake in interface WebSocketClientdoHandshake in class AbstractWebSocketClientWebSocketConnectFailureExceptionpublic WebSocketSession doHandshakeInternal(WebSocketHandler wsHandler, org.springframework.http.HttpHeaders headers, URI uri, List<String> protocols, Map<String,Object> handshakeAttributes) throws WebSocketConnectFailureException
AbstractWebSocketClientdoHandshakeInternal in class AbstractWebSocketClientwsHandler - the client-side handler for WebSocket messagesheaders - HTTP headers to use for the handshake, with unwanted (forbidden)
headers filtered out, never nulluri - the target URI for the handshake, never nullprotocols - requested sub-protocols, or an empty listhandshakeAttributes - attributes to make available via
WebSocketSession.getHandshakeAttributes(); currently always an empty map.WebSocketConnectFailureExceptionprotected Principal getUser()
WebSocketSession.getPrincipal();
by default this method returns null