Interface RestResponseObserver

  • All Known Subinterfaces:
    RestCaller, RestCallerBuilder
    All Known Implementing Classes:
    RestCallerBuilderImpl
    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 RestResponseObserver
    The RestResponseObserver 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 HttpStatusCodeAccessor.getHttpStatusCode().
    • Method Detail

      • onResponse

        void onResponse​(RestResponseEvent aResponse)
                 throws org.refcodes.net.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 HttpStatusCodeAccessor.getHttpStatusCode() to retrieve the respone's HTTP Status-Code.
        Throws:
        org.refcodes.net.HttpResponseException - thrown by a HTTP-Response handling system in case of some unexpected response.