public class WebSocketUpgradeHandler extends Object implements UpgradeHandler<WebSocket>, AsyncHandler<WebSocket>
AsyncHandler
which is able to execute WebSocket upgrade. Use the Builder for configuring WebSocket options.Modifier and Type | Class and Description |
---|---|
static class |
WebSocketUpgradeHandler.Builder
Build a
WebSocketUpgradeHandler |
AsyncHandler.STATE
Modifier | Constructor and Description |
---|---|
protected |
WebSocketUpgradeHandler() |
protected |
WebSocketUpgradeHandler(List<WebSocketListener> listeners) |
Modifier and Type | Method and Description |
---|---|
AsyncHandler.STATE |
onBodyPartReceived(HttpResponseBodyPart bodyPart)
Invoked as soon as some response body part are received.
|
void |
onClose(WebSocket webSocket,
int status,
String reasonPhrase) |
WebSocket |
onCompleted()
Invoked once the HTTP response processing is finished.
|
void |
onFailure(Throwable t)
If the upgrade fail.
|
AsyncHandler.STATE |
onHeadersReceived(HttpResponseHeaders headers)
Invoked as soon as the HTTP headers has been received.
|
AsyncHandler.STATE |
onStatusReceived(HttpResponseStatus responseStatus)
Invoked as soon as the HTTP status line has been received
|
void |
onSuccess(WebSocket webSocket)
If the HTTP Upgrade succeed (response's status code equals 101), the
AsyncHttpProvider will invoke that
method |
void |
onThrowable(Throwable t)
Invoked when an unexpected exception occurs during the processing of the response.
|
boolean |
touchSuccess() |
protected WebSocketUpgradeHandler()
protected WebSocketUpgradeHandler(List<WebSocketListener> listeners)
public void onThrowable(Throwable t)
AsyncHandler
onThrowable
in interface AsyncHandler<WebSocket>
t
- a Throwable
public boolean touchSuccess()
public AsyncHandler.STATE onBodyPartReceived(HttpResponseBodyPart bodyPart) throws Exception
AsyncHandler
onBodyPartReceived
in interface AsyncHandler<WebSocket>
bodyPart
- response's body part.AsyncHandler.STATE
telling to CONTINUE or ABORT the current processing.Exception
- if something wrong happenspublic AsyncHandler.STATE onStatusReceived(HttpResponseStatus responseStatus) throws Exception
AsyncHandler
onStatusReceived
in interface AsyncHandler<WebSocket>
responseStatus
- the status code and test of the responseAsyncHandler.STATE
telling to CONTINUE or ABORT the current processing.Exception
- if something wrong happenspublic AsyncHandler.STATE onHeadersReceived(HttpResponseHeaders headers) throws Exception
AsyncHandler
onHeadersReceived
in interface AsyncHandler<WebSocket>
headers
- the HTTP headers.AsyncHandler.STATE
telling to CONTINUE or ABORT the current processing.Exception
- if something wrong happenspublic WebSocket onCompleted() throws Exception
AsyncHandler
onCompleted
in interface AsyncHandler<WebSocket>
Future
Exception
- if something wrong happenspublic void onSuccess(WebSocket webSocket)
UpgradeHandler
AsyncHttpProvider
will invoke that
methodonSuccess
in interface UpgradeHandler<WebSocket>
webSocket
- an Upgradable entitypublic void onFailure(Throwable t)
UpgradeHandler
onFailure
in interface UpgradeHandler<WebSocket>
t
- a Throwable
Copyright © 2015. All Rights Reserved.