Class UnknownContentTypeException

All Implemented Interfaces:
Serializable

public class UnknownContentTypeException extends RestClientException
Raised when no suitable HttpMessageConverter could be found to extract the response.
Since:
5.2.7
Author:
Rossen Stoyanchev
See Also:
  • Constructor Details

    • UnknownContentTypeException

      public UnknownContentTypeException(Type targetType, MediaType contentType, int statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody)
      Construct a new instance of with the given response data.
      Parameters:
      targetType - the expected target type
      contentType - the content type of the response
      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)
    • UnknownContentTypeException

      public UnknownContentTypeException(Type targetType, MediaType contentType, HttpStatusCode statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody)
      Construct a new instance of with the given response data.
      Parameters:
      targetType - the expected target type
      contentType - the content type of the response
      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)
      Since:
      6.0
  • Method Details

    • getTargetType

      public Type getTargetType()
      Return the target type expected for the response.
    • getContentType

      public MediaType getContentType()
      Return the content type of the response, or "application/octet-stream".
    • getStatusCode

      public HttpStatusCode getStatusCode()
      Return the HTTP status code value.
    • getRawStatusCode

      @Deprecated(since="6.0") public int getRawStatusCode()
      Deprecated.
      as of 6.0, in favor of getStatusCode()
      Return the raw HTTP status code value.
    • getStatusText

      public String getStatusText()
      Return the HTTP status text.
    • getResponseHeaders

      @Nullable public HttpHeaders getResponseHeaders()
      Return the HTTP response headers.
    • getResponseBody

      public byte[] getResponseBody()
      Return the response body as a byte array.
    • getResponseBodyAsString

      public String getResponseBodyAsString()
      Return the response body converted to String using the charset from the response "Content-Type" or "UTF-8" otherwise.