org.atmosphere.wasync.transport
Class StreamTransport<T>

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

public class StreamTransport<T>
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  Future f
           
protected  List<FunctionWrapper> functions
           
 
Constructor Summary
StreamTransport(Options options, List<Decoder<? extends Object,?>> decoders, List<FunctionWrapper> functions, FunctionResolver resolver)
           
 
Method Summary
 boolean canHandle(Request request)
          Return true if the transport can handle the request.
 void close()
          Close the underlying transport}
 Transport future(Future f)
          The current Socket's Future
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

f

protected Future f

functions

protected final List<FunctionWrapper> functions

charSet

protected String charSet
Constructor Detail

StreamTransport

public StreamTransport(Options options,
                       List<Decoder<? extends Object,?>> decoders,
                       List<FunctionWrapper> functions,
                       FunctionResolver resolver)
Method Detail

future

public Transport future(Future f)
Description copied from interface: Transport
The current Socket's Future

Specified by:
future in interface Transport
Returns:
this

registerF

public Transport registerF(FunctionWrapper function)
Description copied from interface: Transport
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()
Description copied from interface: Transport
The transport name

Specified by:
name in interface Transport
Returns:
transport name

close

public void close()
Description copied from interface: Transport
Close the underlying transport}

Specified by:
close in interface Transport

canHandle

public boolean canHandle(Request request)
Description copied from interface: Transport
Return true if the transport can handle the request.

Specified by:
canHandle in interface Transport
Parameters:
request - Request
Returns:
true if the transport can handle the request.


Copyright © 2012. All Rights Reserved.