Class RestClientResponseException

    • Constructor Detail

      • RestClientResponseException

        public RestClientResponseException​(String message,
                                           int statusCode,
                                           String statusText,
                                           @Nullable
                                           HttpHeaders responseHeaders,
                                           @Nullable
                                           byte[] responseBody,
                                           @Nullable
                                           Charset responseCharset)
        Construct a new instance of with the given response data.
        Parameters:
        statusCode - the raw status code value
        statusText - the status text
        responseHeaders - the response headers (may be null)
        responseBody - the response body content (may be null)
        responseCharset - the response body charset (may be null)
    • Method Detail

      • getRawStatusCode

        public int getRawStatusCode()
        Return the raw HTTP status code value.
      • getResponseBodyAsString

        public String getResponseBodyAsString()
        Return the response body converted to String. The charset used is that of the response "Content-Type" or otherwise "UTF-8".
      • getResponseBodyAsString

        public String getResponseBodyAsString​(Charset fallbackCharset)
        Return the response body converted to String. The charset used is that of the response "Content-Type" or otherwise the one given.
        Parameters:
        fallbackCharset - the charset to use on if the response doesn't specify.
        Since:
        5.1.11