Interface Response.ContentListener

All Superinterfaces:
EventListener, Response.AsyncContentListener, Response.ContentSourceListener, Response.ResponseListener
All Known Subinterfaces:
Response.Listener
All Known Implementing Classes:
AsyncMiddleManServlet.ProxyResponseListener, BufferingResponseListener, CompletableResponseListener, ContinueProtocolHandler.ContinueListener, FutureResponseListener, InputStreamResponseListener, ProxyHandler.ProxyResponseListener, ProxyServlet.ProxyResponseListener, RedirectProtocolHandler
Enclosing interface:
Response

public static interface Response.ContentListener extends Response.AsyncContentListener
Synchronous listener for the response content events.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onContent(Response response, ByteBuffer content)
    Callback method invoked when the response content has been received, parsed and there is demand.
    default void
    onContent(Response response, Content.Chunk chunk, Runnable demander)
    Callback method invoked when the response content has been received, parsed and there is demand.

    Methods inherited from interface org.eclipse.jetty.client.Response.AsyncContentListener

    onContentSource
  • Method Details

    • onContent

      void onContent(Response response, ByteBuffer content) throws Exception
      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. This method is also always invoked when content arrives as demand is automatically registered on return.
      Parameters:
      response - the response containing the response line data and the headers
      content - the content bytes received
      Throws:
      Exception - an uncaught exception will abort the response and eventually reclaim the ByteBuffer, if applicable
    • onContent

      default void onContent(Response response, Content.Chunk chunk, Runnable demander) throws Exception
      Description copied from interface: Response.AsyncContentListener
      Callback method invoked when the response content has been received, parsed and there is demand. The chunk must be consumed, copied, or retained before returning from this method as it is then automatically released. The demander must be run before this method may be invoked again.
      Specified by:
      onContent in interface Response.AsyncContentListener
      Parameters:
      response - the response containing the response line data and the headers
      chunk - the chunk received
      demander - the runnable to be run to demand the next chunk
      Throws:
      Exception - an uncaught exception will abort the response, release the chunk and fail the content source from which the chunk was read from