org.atmosphere.wasync.transport
Class WebSocketTransport

java.lang.Object
  extended by com.ning.http.client.websocket.WebSocketUpgradeHandler
      extended by org.atmosphere.wasync.transport.WebSocketTransport
All Implemented Interfaces:
com.ning.http.client.AsyncHandler<com.ning.http.client.websocket.WebSocket>, com.ning.http.client.UpgradeHandler<com.ning.http.client.websocket.WebSocket>, Transport

public class WebSocketTransport
extends com.ning.http.client.websocket.WebSocketUpgradeHandler
implements Transport

WebSocket Transport implementation

Author:
Jeanfrancois Arcand

Nested Class Summary
 
Nested classes/interfaces inherited from class com.ning.http.client.websocket.WebSocketUpgradeHandler
com.ning.http.client.websocket.WebSocketUpgradeHandler.Builder
 
Nested classes/interfaces inherited from interface com.ning.http.client.AsyncHandler
com.ning.http.client.AsyncHandler.STATE
 
Constructor Summary
WebSocketTransport(com.ning.http.client.RequestBuilder requestBuilder, Options options, Request request, List<FunctionWrapper> functions)
           
 
Method Summary
 void close()
          Close the underlying transport}
 void connectedFuture(Future f)
          Set the Future, which will unlock the Socket.fire(java.lang.Object) method once the connection has been fully established.
 void error(Throwable t)
          Set a Throwable
 boolean errorHandled()
          Error handled by a Function
 void future(com.ning.http.client.ListenableFuture f)
          Set the ListenableFuture, which can be used to clone the connection.
 Request.TRANSPORT name()
          The transport name
 com.ning.http.client.AsyncHandler.STATE onBodyPartReceived(com.ning.http.client.HttpResponseBodyPart bodyPart)
          
 com.ning.http.client.websocket.WebSocket onCompleted()
          
 void onFailure(Throwable t)
          
 com.ning.http.client.AsyncHandler.STATE onHeadersReceived(com.ning.http.client.HttpResponseHeaders headers)
          
 com.ning.http.client.AsyncHandler.STATE onStatusReceived(com.ning.http.client.HttpResponseStatus responseStatus)
          
 void onSuccess(com.ning.http.client.websocket.WebSocket webSocket)
          
 void onThrowable(Throwable t)
          Called when an unexpected exception ocurred.
 Transport registerF(FunctionWrapper function)
          Register a new FunctionResolver
 Socket.STATUS status()
          Return the current Socket.STATUS
 com.ning.http.client.websocket.WebSocket webSocket()
           
 
Methods inherited from class com.ning.http.client.websocket.WebSocketUpgradeHandler
onClose, resetSuccess, touchSuccess
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebSocketTransport

public WebSocketTransport(com.ning.http.client.RequestBuilder requestBuilder,
                          Options options,
                          Request request,
                          List<FunctionWrapper> functions)
Method Detail

onThrowable

public void onThrowable(Throwable t)
Called when an unexpected exception ocurred.

Specified by:
onThrowable in interface com.ning.http.client.AsyncHandler<com.ning.http.client.websocket.WebSocket>
Specified by:
onThrowable in interface Transport
Overrides:
onThrowable in class com.ning.http.client.websocket.WebSocketUpgradeHandler
Parameters:
t - a Throwable

close

public void close()
Close the underlying transport}

Specified by:
close in interface Transport

status

public Socket.STATUS status()
Return the current Socket.STATUS

Specified by:
status in interface Transport

errorHandled

public boolean errorHandled()
Error handled by a Function

Specified by:
errorHandled in interface Transport

error

public void error(Throwable t)
Set a Throwable

Specified by:
error in interface Transport
Parameters:
t - Throwable

future

public void future(com.ning.http.client.ListenableFuture f)
Set the ListenableFuture, which can be used to clone the connection.

Specified by:
future in interface Transport
Parameters:
f - ListenableFuture

connectedFuture

public void connectedFuture(Future f)
Description copied from interface: Transport
Set the Future, which will unlock the Socket.fire(java.lang.Object) method once the connection has been fully established.

Specified by:
connectedFuture in interface Transport
Parameters:
f - Future

onBodyPartReceived

public com.ning.http.client.AsyncHandler.STATE onBodyPartReceived(com.ning.http.client.HttpResponseBodyPart bodyPart)
                                                           throws Exception

Specified by:
onBodyPartReceived in interface com.ning.http.client.AsyncHandler<com.ning.http.client.websocket.WebSocket>
Overrides:
onBodyPartReceived in class com.ning.http.client.websocket.WebSocketUpgradeHandler
Throws:
Exception

onStatusReceived

public com.ning.http.client.AsyncHandler.STATE onStatusReceived(com.ning.http.client.HttpResponseStatus responseStatus)
                                                         throws Exception

Specified by:
onStatusReceived in interface com.ning.http.client.AsyncHandler<com.ning.http.client.websocket.WebSocket>
Overrides:
onStatusReceived in class com.ning.http.client.websocket.WebSocketUpgradeHandler
Throws:
Exception

onHeadersReceived

public com.ning.http.client.AsyncHandler.STATE onHeadersReceived(com.ning.http.client.HttpResponseHeaders headers)
                                                          throws Exception

Specified by:
onHeadersReceived in interface com.ning.http.client.AsyncHandler<com.ning.http.client.websocket.WebSocket>
Overrides:
onHeadersReceived in class com.ning.http.client.websocket.WebSocketUpgradeHandler
Throws:
Exception

onCompleted

public com.ning.http.client.websocket.WebSocket onCompleted()
                                                     throws Exception

Specified by:
onCompleted in interface com.ning.http.client.AsyncHandler<com.ning.http.client.websocket.WebSocket>
Overrides:
onCompleted in class com.ning.http.client.websocket.WebSocketUpgradeHandler
Throws:
Exception

onSuccess

public void onSuccess(com.ning.http.client.websocket.WebSocket webSocket)

Specified by:
onSuccess in interface com.ning.http.client.UpgradeHandler<com.ning.http.client.websocket.WebSocket>
Overrides:
onSuccess in class com.ning.http.client.websocket.WebSocketUpgradeHandler

name

public Request.TRANSPORT name()
The transport name

Specified by:
name in interface Transport
Returns:
transport name

registerF

public Transport registerF(FunctionWrapper function)
Register a new FunctionResolver

Specified by:
registerF in interface Transport
Parameters:
function - FunctionResolver
Returns:
this;

onFailure

public final void onFailure(Throwable t)

Specified by:
onFailure in interface com.ning.http.client.UpgradeHandler<com.ning.http.client.websocket.WebSocket>
Overrides:
onFailure in class com.ning.http.client.websocket.WebSocketUpgradeHandler

webSocket

public com.ning.http.client.websocket.WebSocket webSocket()


Copyright © 2013. All Rights Reserved.