类 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
- 所有已实现的接口:
Serializable
public class UnknownContentTypeException extends RestClientException
Raised when no suitableHttpMessageConverter
could be found to extract the response.- 从以下版本开始:
- 5.2.7
- 作者:
- Rossen Stoyanchev
- 另请参阅:
- 序列化表格
构造器概要
构造器 构造器 说明 UnknownContentTypeException(Type targetType, MediaType contentType, int statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody)
Construct a new instance of with the given response data.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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.从类继承的方法 org.springframework.core.NestedRuntimeException
contains, getMessage, getMostSpecificCause, getRootCause
构造器详细资料
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.- 参数:
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
)
方法详细资料
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".
getRawStatusCode
public int getRawStatusCode()
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.