Class AsyncResponseConsumer

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, org.apache.http.concurrent.Cancellable, org.apache.http.nio.protocol.HttpAsyncResponseConsumer<Response>

    public class AsyncResponseConsumer
    extends org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<Response>
    On top of the abstract class, this class handles the parsing of a response from the web service.
    Author:
    Ween Jiann Lee
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected BaseResponse buildResult​(org.apache.http.protocol.HttpContext context)  
      protected org.apache.http.entity.ContentType getContentType​(org.apache.http.HttpEntity entity)  
      protected void onContentReceived​(org.apache.http.nio.ContentDecoder decoder, org.apache.http.nio.IOControl ioctrl)  
      protected void onEntityEnclosed​(org.apache.http.HttpEntity entity, org.apache.http.entity.ContentType contentType)  
      protected void onResponseReceived​(org.apache.http.HttpResponse httpResponse)  
      protected void releaseResources()  
      • Methods inherited from class org.apache.http.nio.protocol.AbstractAsyncResponseConsumer

        cancel, close, consumeContent, failed, getException, getResult, isDone, onClose, responseCompleted, responseReceived
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getContentType

        protected final org.apache.http.entity.ContentType getContentType​(org.apache.http.HttpEntity entity)
        Overrides:
        getContentType in class org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<Response>
      • onResponseReceived

        protected final void onResponseReceived​(org.apache.http.HttpResponse httpResponse)
        Specified by:
        onResponseReceived in class org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<Response>
      • onContentReceived

        protected final void onContentReceived​(org.apache.http.nio.ContentDecoder decoder,
                                               org.apache.http.nio.IOControl ioctrl)
                                        throws java.io.IOException
        Specified by:
        onContentReceived in class org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<Response>
        Throws:
        java.io.IOException
      • onEntityEnclosed

        protected final void onEntityEnclosed​(org.apache.http.HttpEntity entity,
                                              org.apache.http.entity.ContentType contentType)
                                       throws java.io.IOException
        Specified by:
        onEntityEnclosed in class org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<Response>
        Throws:
        java.io.IOException
      • buildResult

        protected final BaseResponse buildResult​(org.apache.http.protocol.HttpContext context)
                                          throws java.lang.Exception
        Specified by:
        buildResult in class org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<Response>
        Throws:
        java.lang.Exception
      • releaseResources

        protected final void releaseResources()
        Specified by:
        releaseResources in class org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<Response>