org.atmosphere.wasync.transport
Class StreamTransport

java.lang.Object
  extended by org.atmosphere.wasync.transport.StreamTransport
All Implemented Interfaces:
com.ning.http.client.AsyncHandler<String>, Transport
Direct Known Subclasses:
LongPollingTransport, SSETransport

public class StreamTransport
extends Object
implements com.ning.http.client.AsyncHandler<String>, Transport


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.ning.http.client.AsyncHandler
com.ning.http.client.AsyncHandler.STATE
 
Field Summary
protected  String charSet
           
protected  AtomicBoolean closed
           
protected  List<Decoder<? extends Object,?>> decoders
           
protected  AtomicBoolean errorHandled
           
protected  List<FunctionWrapper> functions
           
protected  boolean isBinary
           
protected  Options options
           
protected  Request request
           
protected  com.ning.http.client.RequestBuilder requestBuilder
           
protected  FunctionResolver resolver
           
protected  Socket.STATUS status
           
 
Constructor Summary
StreamTransport(com.ning.http.client.RequestBuilder requestBuilder, Options options, Request request, List<FunctionWrapper> functions)
           
 
Method Summary
 void close()
          Close the underlying transport}
 void error(Throwable t)
           
 boolean errorHandled()
          Error handled by a Function
 Request.TRANSPORT name()
          The transport name
 com.ning.http.client.AsyncHandler.STATE onBodyPartReceived(com.ning.http.client.HttpResponseBodyPart bodyPart)
          
 String onCompleted()
          
 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 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

functions

protected final List<FunctionWrapper> functions

decoders

protected final List<Decoder<? extends Object,?>> decoders

charSet

protected String charSet

resolver

protected final FunctionResolver resolver

options

protected final Options options

requestBuilder

protected final com.ning.http.client.RequestBuilder requestBuilder

request

protected final Request request

closed

protected final AtomicBoolean closed

isBinary

protected final boolean isBinary

status

protected Socket.STATUS status

errorHandled

protected final AtomicBoolean errorHandled
Constructor Detail

StreamTransport

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

registerF

public Transport registerF(FunctionWrapper function)
Register a new FunctionResolver

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

onThrowable

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

Specified by:
onThrowable in interface com.ning.http.client.AsyncHandler<String>
Specified by:
onThrowable in interface Transport
Parameters:
t - a Throwable

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<String>
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<String>
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<String>
Throws:
Exception

onCompleted

public String onCompleted()
                   throws Exception

Specified by:
onCompleted in interface com.ning.http.client.AsyncHandler<String>
Throws:
Exception

name

public Request.TRANSPORT name()
The transport name

Specified by:
name in interface Transport
Returns:
transport name

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)
Specified by:
error in interface Transport


Copyright © 2013. All Rights Reserved.