类 HttpClientErrorException
- 所有已实现的接口:
Serializable
public class HttpClientErrorException extends HttpStatusCodeException
Exception thrown when an HTTP 4xx is received.- 从以下版本开始:
- 3.0
- 作者:
- Arjen Poutsma
- 另请参阅:
DefaultResponseErrorHandler, 序列化表格
构造器概要
构造器 构造器 说明 HttpClientErrorException(HttpStatus statusCode)Construct a new instance ofHttpClientErrorExceptionbased on anHttpStatus.HttpClientErrorException(HttpStatus statusCode, String statusText)Construct a new instance ofHttpClientErrorExceptionbased on anHttpStatusand status text.HttpClientErrorException(HttpStatus statusCode, String statusText, byte[] responseBody, Charset responseCharset)Construct a new instance ofHttpClientErrorExceptionbased on anHttpStatus, status text, and response body content.HttpClientErrorException(HttpStatus statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody, Charset responseCharset)Construct a new instance ofHttpClientErrorExceptionbased on anHttpStatus, status text, and response body content.
方法概要
从类继承的方法 org.springframework.web.client.HttpStatusCodeException
getStatusCode
从类继承的方法 org.springframework.web.client.RestClientResponseException
getRawStatusCode, getResponseBodyAsByteArray, getResponseBodyAsString, getResponseHeaders, getStatusText
从类继承的方法 org.springframework.core.NestedRuntimeException
contains, getMessage, getMostSpecificCause, getRootCause
构造器详细资料
HttpClientErrorException
public HttpClientErrorException(HttpStatus statusCode)
Construct a new instance ofHttpClientErrorExceptionbased on anHttpStatus.- 参数:
statusCode- the status code
HttpClientErrorException
public HttpClientErrorException(HttpStatus statusCode, String statusText)
Construct a new instance ofHttpClientErrorExceptionbased on anHttpStatusand status text.- 参数:
statusCode- the status codestatusText- the status text
HttpClientErrorException
public HttpClientErrorException(HttpStatus statusCode, String statusText, byte[] responseBody, Charset responseCharset)
Construct a new instance ofHttpClientErrorExceptionbased on anHttpStatus, status text, and response body content.- 参数:
statusCode- the status codestatusText- the status textresponseBody- the response body content (may benull)responseCharset- the response body charset (may benull)
HttpClientErrorException
public HttpClientErrorException(HttpStatus statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody, Charset responseCharset)
Construct a new instance ofHttpClientErrorExceptionbased on anHttpStatus, status text, and response body content.- 参数:
statusCode- the status codestatusText- the status textresponseHeaders- the response headers (may benull)responseBody- the response body content (may benull)responseCharset- the response body charset (may benull)- 从以下版本开始:
- 3.1.2