Interface RestResponseConsumer

All Known Implementing Classes:
RestResponseHandler, RestResponseResult
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface RestResponseConsumer
The RestResponseConsumer can be coded using the lambda syntax and processes a response from a server. The RestResponseEvent describes the context of the response e.g. retrieve the server's response via HttpClientResponse.getResponse(Class) or the response's HTTP Status-Code via AbstractHttpResponse.getHttpStatusCode().
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    The invoker provides a response context being a RestResponseEvent describing the response being processed upon by your lambda's code.
  • Method Details

    • onResponse

      void onResponse(RestResponseEvent aResponse) throws org.refcodes.web.HttpResponseException
      The invoker provides a response context being a RestResponseEvent describing the response being processed upon by your lambda's code. The method works synchronously and waits (blocks the caller's thread) till it finishes execution.
      Parameters:
      aResponse - The response of type RestResponseEvent describing the response context. Use HttpClientResponse.getResponse(Class) to retrieve the server's response body or AbstractHttpResponse.getHttpStatusCode() to retrieve the respone's HTTP Status-Code.
      Throws:
      org.refcodes.web.HttpResponseException - thrown by a HTTP-Response handling system in case of some unexpected response.