public class UnknownContentTypeException extends RestClientException
HttpMessageConverter
could be
found to extract the response.Constructor and Description |
---|
UnknownContentTypeException(Type targetType,
MediaType contentType,
int statusCode,
String statusText,
HttpHeaders responseHeaders,
byte[] responseBody)
Construct a new instance of with the given response data.
|
Modifier and Type | Method and Description |
---|---|
MediaType |
getContentType()
Return the content type of the response, or "application/octet-stream".
|
int |
getRawStatusCode()
Return the raw HTTP status code value.
|
byte[] |
getResponseBody()
Return the response body as a byte array.
|
String |
getResponseBodyAsString()
Return the response body converted to String using the charset from the
response "Content-Type" or
"UTF-8" otherwise. |
HttpHeaders |
getResponseHeaders()
Return the HTTP response headers.
|
String |
getStatusText()
Return the HTTP status text.
|
Type |
getTargetType()
Return the target type expected for the response.
|
contains, getMessage, getMostSpecificCause, getRootCause
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public UnknownContentTypeException(Type targetType, MediaType contentType, int statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody)
targetType
- the expected target typecontentType
- the content type of the responsestatusCode
- the raw status code valuestatusText
- the status textresponseHeaders
- the response headers (may be null
)responseBody
- the response body content (may be null
)public Type getTargetType()
public MediaType getContentType()
public int getRawStatusCode()
public String getStatusText()
@Nullable public HttpHeaders getResponseHeaders()
public byte[] getResponseBody()
public String getResponseBodyAsString()
"UTF-8"
otherwise.