类 WebClientResponseException
- java.lang.Object
- java.lang.Throwable
- java.lang.Exception
- java.lang.RuntimeException
- org.springframework.core.NestedRuntimeException
- org.springframework.web.reactive.function.client.WebClientException
- org.springframework.web.reactive.function.client.WebClientResponseException
- 所有已实现的接口:
Serializable
- 直接已知子类:
UnknownHttpStatusCodeException
,WebClientResponseException.BadGateway
,WebClientResponseException.BadRequest
,WebClientResponseException.Conflict
,WebClientResponseException.Forbidden
,WebClientResponseException.GatewayTimeout
,WebClientResponseException.Gone
,WebClientResponseException.InternalServerError
,WebClientResponseException.MethodNotAllowed
,WebClientResponseException.NotAcceptable
,WebClientResponseException.NotFound
,WebClientResponseException.NotImplemented
,WebClientResponseException.ServiceUnavailable
,WebClientResponseException.TooManyRequests
,WebClientResponseException.Unauthorized
,WebClientResponseException.UnprocessableEntity
,WebClientResponseException.UnsupportedMediaType
public class WebClientResponseException extends WebClientException
Exceptions that contain actual HTTP response data.- 从以下版本开始:
- 5.0
- 作者:
- Arjen Poutsma
- 另请参阅:
- 序列化表格
嵌套类概要
构造器概要
构造器 构造器 说明 WebClientResponseException(int statusCode, String statusText, HttpHeaders headers, byte[] body, Charset charset)
Constructor with response data only, and a default message.WebClientResponseException(int status, String reasonPhrase, HttpHeaders headers, byte[] body, Charset charset, HttpRequest request)
Constructor with response data only, and a default message.WebClientResponseException(String message, int statusCode, String statusText, HttpHeaders headers, byte[] responseBody, Charset charset)
Constructor with a prepared message.WebClientResponseException(String message, int statusCode, String statusText, HttpHeaders headers, byte[] responseBody, Charset charset, HttpRequest request)
Constructor with a prepared message.
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 static WebClientResponseException
create(int statusCode, String statusText, HttpHeaders headers, byte[] body, Charset charset)
CreateWebClientResponseException
or an HTTP status specific subclass.static WebClientResponseException
create(int statusCode, String statusText, HttpHeaders headers, byte[] body, Charset charset, HttpRequest request)
CreateWebClientResponseException
or an HTTP status specific subclass.HttpHeaders
getHeaders()
Return the HTTP response headers.int
getRawStatusCode()
Return the raw HTTP status code value.HttpRequest
getRequest()
Return the corresponding request.byte[]
getResponseBodyAsByteArray()
Return the response body as a byte array.String
getResponseBodyAsString()
Return the response body as a string.HttpStatus
getStatusCode()
Return the HTTP status code value.String
getStatusText()
Return the HTTP status text.从类继承的方法 org.springframework.core.NestedRuntimeException
contains, getMessage, getMostSpecificCause, getRootCause
构造器详细资料
WebClientResponseException
public WebClientResponseException(int statusCode, String statusText, @Nullable HttpHeaders headers, @Nullable byte[] body, @Nullable Charset charset)
Constructor with response data only, and a default message.- 从以下版本开始:
- 5.1
WebClientResponseException
public WebClientResponseException(int status, String reasonPhrase, @Nullable HttpHeaders headers, @Nullable byte[] body, @Nullable Charset charset, @Nullable HttpRequest request)
Constructor with response data only, and a default message.- 从以下版本开始:
- 5.1.4
WebClientResponseException
public WebClientResponseException(String message, int statusCode, String statusText, @Nullable HttpHeaders headers, @Nullable byte[] responseBody, @Nullable Charset charset)
Constructor with a prepared message.
WebClientResponseException
public WebClientResponseException(String message, int statusCode, String statusText, @Nullable HttpHeaders headers, @Nullable byte[] responseBody, @Nullable Charset charset, @Nullable HttpRequest request)
Constructor with a prepared message.- 从以下版本开始:
- 5.1.4
方法详细资料
getStatusCode
public HttpStatus getStatusCode()
Return the HTTP status code value.- 抛出:
IllegalArgumentException
- in case of an unknown HTTP status code
getRawStatusCode
public int getRawStatusCode()
Return the raw HTTP status code value.
getStatusText
public String getStatusText()
Return the HTTP status text.
getHeaders
public HttpHeaders getHeaders()
Return the HTTP response headers.
getResponseBodyAsByteArray
public byte[] getResponseBodyAsByteArray()
Return the response body as a byte array.
getResponseBodyAsString
public String getResponseBodyAsString()
Return the response body as a string.
getRequest
@Nullable public HttpRequest getRequest()
Return the corresponding request.- 从以下版本开始:
- 5.1.4
create
public static WebClientResponseException create(int statusCode, String statusText, HttpHeaders headers, byte[] body, @Nullable Charset charset)
CreateWebClientResponseException
or an HTTP status specific subclass.- 从以下版本开始:
- 5.1
create
public static WebClientResponseException create(int statusCode, String statusText, HttpHeaders headers, byte[] body, @Nullable Charset charset, @Nullable HttpRequest request)
CreateWebClientResponseException
or an HTTP status specific subclass.- 从以下版本开始:
- 5.1.4