Interface Response.Listener

    • Method Summary

      All Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      default void onBeforeContent​(Response response, java.util.function.LongConsumer demand)
      Callback method invoked before response content events.
      default void onBegin​(Response response)
      Callback method invoked when the response line containing HTTP version, HTTP status code and reason has been received and parsed.
      default void onComplete​(Result result)
      Callback method invoked when the request and the response have been processed, either successfully or not.
      default void onContent​(Response response, java.nio.ByteBuffer content)
      Callback method invoked when the response content has been received, parsed and there is demand.
      default void onContent​(Response response, java.nio.ByteBuffer content, org.eclipse.jetty.util.Callback callback)
      Callback method invoked when the response content has been received, parsed and there is demand.
      default void onContent​(Response response, java.util.function.LongConsumer demand, java.nio.ByteBuffer content, org.eclipse.jetty.util.Callback callback)
      Callback method invoked when the response content has been received.
      default void onFailure​(Response response, java.lang.Throwable failure)
      Callback method invoked when the response has failed in the process of being received
      default boolean onHeader​(Response response, HttpField field)
      Callback method invoked when a response header has been received and parsed, returning whether the header should be processed or not.
      default void onHeaders​(Response response)
      Callback method invoked when all the response headers have been received and parsed.
      default void onSuccess​(Response response)
      Callback method invoked when the whole response has been successfully received.
    • Method Detail

      • onBegin

        default void onBegin​(Response response)
        Description copied from interface: Response.BeginListener
        Callback method invoked when the response line containing HTTP version, HTTP status code and reason has been received and parsed.

        This method is the best approximation to detect when the first bytes of the response arrived to the client.

        Specified by:
        onBegin in interface Response.BeginListener
        Parameters:
        response - the response containing the response line data
      • onHeader

        default boolean onHeader​(Response response,
                                 HttpField field)
        Description copied from interface: Response.HeaderListener
        Callback method invoked when a response header has been received and parsed, returning whether the header should be processed or not.
        Specified by:
        onHeader in interface Response.HeaderListener
        Parameters:
        response - the response containing the response line data and the headers so far
        field - the header received
        Returns:
        true to process the header, false to skip processing of the header
      • onHeaders

        default void onHeaders​(Response response)
        Description copied from interface: Response.HeadersListener
        Callback method invoked when all the response headers have been received and parsed.
        Specified by:
        onHeaders in interface Response.HeadersListener
        Parameters:
        response - the response containing the response line data and the headers
      • onContent

        default void onContent​(Response response,
                               java.nio.ByteBuffer content)
        Description copied from interface: Response.ContentListener
        Callback method invoked when the response content has been received, parsed and there is demand. This method may be invoked multiple times, and the content buffer must be consumed (or copied) before returning from this method.
        Specified by:
        onContent in interface Response.ContentListener
        Parameters:
        response - the response containing the response line data and the headers
        content - the content bytes received
      • onContent

        default void onContent​(Response response,
                               java.nio.ByteBuffer content,
                               org.eclipse.jetty.util.Callback callback)
        Description copied from interface: Response.AsyncContentListener
        Callback method invoked when the response content has been received, parsed and there is demand. The callback object should be succeeded to signal that the content buffer has been consumed and to demand more content.
        Specified by:
        onContent in interface Response.AsyncContentListener
        Parameters:
        response - the response containing the response line data and the headers
        content - the content bytes received
        callback - the callback to call when the content is consumed and to demand more content
      • onContent

        default void onContent​(Response response,
                               java.util.function.LongConsumer demand,
                               java.nio.ByteBuffer content,
                               org.eclipse.jetty.util.Callback callback)
        Description copied from interface: Response.DemandedContentListener
        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).
        Specified by:
        onContent in interface Response.DemandedContentListener
        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
      • onSuccess

        default void onSuccess​(Response response)
        Description copied from interface: Response.SuccessListener
        Callback method invoked when the whole response has been successfully received.
        Specified by:
        onSuccess in interface Response.SuccessListener
        Parameters:
        response - the response containing the response line data and the headers
      • onFailure

        default void onFailure​(Response response,
                               java.lang.Throwable failure)
        Description copied from interface: Response.FailureListener
        Callback method invoked when the response has failed in the process of being received
        Specified by:
        onFailure in interface Response.FailureListener
        Parameters:
        response - the response containing data up to the point the failure happened
        failure - the failure happened