public class

WebSocketUpgradeHandler

extends Object
implements AsyncHandler<T> UpgradeHandler<T>
java.lang.Object
   ↳ com.ning.http.client.websocket.WebSocketUpgradeHandler

Class Overview

An AsyncHandler which is able to execute WebSocket upgrade. Use the Builder for configuring WebSocket options.

Summary

Nested Classes
class WebSocketUpgradeHandler.Builder Build a WebSocketUpgradeHandler  
Public Methods
final AsyncHandler.STATE onBodyPartReceived(HttpResponseBodyPart bodyPart)
Invoked as soon as some response body part are received.
final WebSocket onCompleted()
Invoked once the HTTP response processing is finished.
final void onFailure(Throwable t)
If the upgrade fail.
final AsyncHandler.STATE onHeadersReceived(HttpResponseHeaders headers)
Invoked as soon as the HTTP headers has been received.
final AsyncHandler.STATE onStatusReceived(HttpResponseStatus responseStatus)
Invoked as soon as the HTTP status line has been received
final void onSuccess(WebSocket webSocket)
final void onThrowable(Throwable t)
Invoked when an unexpected exception occurs during the processing of the response.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.ning.http.client.AsyncHandler
From interface com.ning.http.client.UpgradeHandler

Public Methods

public final AsyncHandler.STATE onBodyPartReceived (HttpResponseBodyPart bodyPart)

Invoked as soon as some response body part are received. Could be invoked many times.

Parameters
bodyPart response's body part.
Returns
Throws
Exception

public final WebSocket onCompleted ()

Invoked once the HTTP response processing is finished.

Gets always invoked as last callback method.

Returns
  • T Value that will be returned by the associated java.util.concurrent.Future
Throws
Exception

public final void onFailure (Throwable t)

If the upgrade fail.

Parameters
t a Throwable

public final AsyncHandler.STATE onHeadersReceived (HttpResponseHeaders headers)

Invoked as soon as the HTTP headers has been received. Can potentially be invoked more than once if a broken server sent trailing headers.

Parameters
headers the HTTP headers.
Returns
Throws
Exception

public final AsyncHandler.STATE onStatusReceived (HttpResponseStatus responseStatus)

Invoked as soon as the HTTP status line has been received

Parameters
responseStatus the status code and test of the response
Returns
Throws
Exception

public final void onSuccess (WebSocket webSocket)

public final void onThrowable (Throwable t)

Invoked when an unexpected exception occurs during the processing of the response. The exception may have been produced by implementation of onXXXReceived method invocation.

Parameters
t a Throwable