org.springframework.web.client

Interface ResponseErrorHandler

    • Method Detail

      • hasError

        boolean hasError(ClientHttpResponse response)
                  throws java.io.IOException
        Indicate whether the given response has any errors.

        Implementations will typically inspect the HttpStatus of the response.

        Parameters:
        response - the response to inspect
        Returns:
        true if the response has an error; false otherwise
        Throws:
        java.io.IOException - in case of I/O errors
      • handleError

        void handleError(ClientHttpResponse response)
                  throws java.io.IOException
        Handle the error in the given response.

        This method is only called when hasError(ClientHttpResponse) has returned true.

        Parameters:
        response - the response with the error
        Throws:
        java.io.IOException - in case of I/O errors
      • handleError

        default void handleError(java.net.URI url,
                                 HttpMethod method,
                                 ClientHttpResponse response)
                          throws java.io.IOException
        Alternative to handleError(ClientHttpResponse) with extra information providing access to the request URL and HTTP method.
        Parameters:
        url - the request URL
        method - the HTTP method
        response - the response with the error
        Throws:
        java.io.IOException - in case of I/O errors
        Since:
        5.0