Interface Response.DemandedContentListener

    • Method Detail

      • onBeforeContent

        default void onBeforeContent​(Response response,
                                     java.util.function.LongConsumer demand)
        Callback method invoked before response content events. The demand object should be used to demand content, otherwise the demand remains at zero (no demand) and onContent(Response, LongConsumer, ByteBuffer, Callback) will not be invoked even if content has been received and parsed.
        Parameters:
        response - the response containing the response line data and the headers
        demand - the object that allows to demand content buffers
      • onContent

        void onContent​(Response response,
                       java.util.function.LongConsumer demand,
                       java.nio.ByteBuffer content,
                       Callback callback)
        Callback method invoked when the response content has been received. The callback object should be succeeded to signal that the content buffer has been consumed. The demand object should be used to demand more content, similarly to ReactiveStreams's Subscription#request(long).
        Parameters:
        response - the response containing the response line data and the headers
        demand - the object that allows to demand content buffers
        content - the content bytes received
        callback - the callback to call when the content is consumed