Class BasicAsyncResponseProducer

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        BasicAsyncResponseProducer​(org.apache.http.HttpResponse response)
      Creates a producer that can be used to transmit the given response message.
      protected BasicAsyncResponseProducer​(org.apache.http.HttpResponse response, HttpAsyncContentProducer producer)
      Creates a producer that can be used to transmit the given response message.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void failed​(java.lang.Exception ex)
      Invoked to signal that the response processing terminated abnormally.
      org.apache.http.HttpResponse generateResponse()
      Invoked to generate a HTTP response message head.
      void produceContent​(ContentEncoder encoder, IOControl ioControl)
      Invoked to write out a chunk of content to the ContentEncoder.
      void responseCompleted​(org.apache.http.protocol.HttpContext context)
      Invoked to signal that the response has been fully written out.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • BasicAsyncResponseProducer

        protected BasicAsyncResponseProducer​(org.apache.http.HttpResponse response,
                                             HttpAsyncContentProducer producer)
        Creates a producer that can be used to transmit the given response message. The given content producer will be used to stream out message content. Please note that the response message is expected to enclose an HttpEntity whose properties are consistent with the behavior of the content producer.
        Parameters:
        response - response message.
        producer - response content producer.
      • BasicAsyncResponseProducer

        public BasicAsyncResponseProducer​(org.apache.http.HttpResponse response)
        Creates a producer that can be used to transmit the given response message. If the response message encloses an HttpEntity it is also expected to implement HttpAsyncContentProducer.
        Parameters:
        response - response message.
    • Method Detail

      • produceContent

        public void produceContent​(ContentEncoder encoder,
                                   IOControl ioControl)
                            throws java.io.IOException
        Description copied from interface: HttpAsyncResponseProducer
        Invoked to write out a chunk of content to the ContentEncoder. The IOControl interface can be used to suspend output event notifications if the producer is temporarily unable to produce more content.

        When all content is finished, the producer MUST call ContentEncoder.complete(). Failure to do so may cause the entity to be incorrectly delimited.

        Please note that the ContentEncoder object is not thread-safe and should only be used within the context of this method call. The IOControl object can be shared and used on other thread to resume output event notifications when more content is made available.

        Specified by:
        produceContent in interface HttpAsyncResponseProducer
        Parameters:
        encoder - content encoder.
        ioControl - I/O control of the underlying connection.
        Throws:
        java.io.IOException - in case of an I/O error
      • responseCompleted

        public void responseCompleted​(org.apache.http.protocol.HttpContext context)
        Description copied from interface: HttpAsyncResponseProducer
        Invoked to signal that the response has been fully written out.
        Specified by:
        responseCompleted in interface HttpAsyncResponseProducer
        Parameters:
        context - HTTP context
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object