Package org.springframework.web.client
Class UnknownContentTypeException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.core.NestedRuntimeException
org.springframework.web.client.RestClientException
org.springframework.web.client.UnknownContentTypeException
- All Implemented Interfaces:
Serializable
Raised when no suitable
HttpMessageConverter
could be
found to extract the response.- Since:
- 5.2.7
- Author:
- Rossen Stoyanchev
- See Also:
-
Constructor Summary
ConstructorDescriptionUnknownContentTypeException
(Type targetType, MediaType contentType, int statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody) Construct a new instance of with the given response data.UnknownContentTypeException
(Type targetType, MediaType contentType, HttpStatusCode statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody) Construct a new instance of with the given response data. -
Method Summary
Modifier and TypeMethodDescriptionReturn the content type of the response, or "application/octet-stream".int
Deprecated.byte[]
Return the response body as a byte array.Return the response body converted to String using the charset from the response "Content-Type" or"UTF-8"
otherwise.Return the HTTP response headers.Return the HTTP status code value.Return the HTTP status text.Return the target type expected for the response.Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getMostSpecificCause, getRootCause
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
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 typecontentType
- the content type of the responsestatusCode
- the raw status code valuestatusText
- the status textresponseHeaders
- the response headers (may benull
)responseBody
- the response body content (may benull
)
-
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 typecontentType
- the content type of the responsestatusCode
- the raw status code valuestatusText
- the status textresponseHeaders
- the response headers (may benull
)responseBody
- the response body content (may benull
)- Since:
- 6.0
-
-
Method Details
-
getTargetType
Return the target type expected for the response. -
getContentType
Return the content type of the response, or "application/octet-stream". -
getStatusCode
Return the HTTP status code value. -
getRawStatusCode
Deprecated.as of 6.0, in favor ofgetStatusCode()
Return the raw HTTP status code value. -
getStatusText
Return the HTTP status text. -
getResponseHeaders
Return the HTTP response headers. -
getResponseBody
public byte[] getResponseBody()Return the response body as a byte array. -
getResponseBodyAsString
Return the response body converted to String using the charset from the response "Content-Type" or"UTF-8"
otherwise.
-
getStatusCode()