类 WebClientResponseException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cn.taketoday.core.NestedRuntimeException
cn.taketoday.web.reactive.function.client.WebClientException
cn.taketoday.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
Exceptions that contain actual HTTP response data.
- 从以下版本开始:
- 4.0
- 作者:
- Arjen Poutsma
- 另请参阅:
-
嵌套类概要
嵌套类修饰符和类型类说明static classWebClientResponseExceptionfor status HTTP HTTP 502 Bad Gateway.static classWebClientResponseExceptionfor status HTTP 400 Bad Request.static classWebClientResponseExceptionfor status HTTP 409 Conflict.static classWebClientResponseExceptionfor status HTTP 403 Forbidden.static classWebClientResponseExceptionfor status HTTP 504 Gateway Timeout.static classWebClientResponseExceptionfor status HTTP 410 Gone.static classWebClientResponseExceptionfor status HTTP 500 Internal Server Error.static classWebClientResponseExceptionfor status HTTP 405 Method Not Allowed.static classWebClientResponseExceptionfor status HTTP 406 Not Acceptable.static classWebClientResponseExceptionfor status HTTP 404 Not Found.static classWebClientResponseExceptionfor status HTTP 501 Not Implemented.static classWebClientResponseExceptionfor status HTTP 503 Service Unavailable.static classWebClientResponseExceptionfor status HTTP 429 Too Many Requests.static classWebClientResponseExceptionfor status HTTP 401 Unauthorized.static classWebClientResponseExceptionfor status HTTP 422 Unprocessable Entity.static classWebClientResponseExceptionfor status HTTP 415 Unsupported Media Type. -
字段概要
字段修饰符和类型字段说明private Function<cn.taketoday.core.ResolvableType,?> private final HttpHeadersprivate final HttpRequestprivate final byte[]private final Charsetprivate static final longprivate final HttpStatusCodeprivate final String -
构造器概要
构造器构造器说明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(HttpStatusCode statusCode, 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.WebClientResponseException(String message, HttpStatusCode statusCode, String statusText, HttpHeaders headers, byte[] responseBody, Charset charset, HttpRequest request) Constructor with a prepared message. -
方法概要
修饰符和类型方法说明static WebClientResponseExceptioncreate(int statusCode, String statusText, HttpHeaders headers, byte[] body, Charset charset) CreateWebClientResponseExceptionor an HTTP status specific subclass.static WebClientResponseExceptioncreate(int statusCode, String statusText, HttpHeaders headers, byte[] body, Charset charset, HttpRequest request) CreateWebClientResponseExceptionor an HTTP status specific subclass.static WebClientResponseExceptioncreate(HttpStatusCode statusCode, String statusText, HttpHeaders headers, byte[] body, Charset charset, HttpRequest request) CreateWebClientResponseExceptionor an HTTP status specific subclass.private <E> EdecodeBody(cn.taketoday.core.ResolvableType targetType) Return the HTTP response headers.intReturn the raw HTTP status code value.Return the corresponding request.<E> EgetResponseBodyAs(cn.taketoday.core.ParameterizedTypeReference<E> targetType) Variant ofgetResponseBodyAs(Class)withParameterizedTypeReference.<E> EgetResponseBodyAs(Class<E> targetType) Decode the error content to the specified type.byte[]Return the response body as a byte array.Return the response content as a String using the charset of media type for the response, if available, or otherwise falling back on UTF-8.getResponseBodyAsString(Charset defaultCharset) Variant ofgetResponseBodyAsString()that allows specifying the charset to fall back on, if a charset is not available from the media type for the response.Return the HTTP status code value.Return the HTTP status text.private static StringinitMessage(HttpStatusCode status, String reasonPhrase, HttpRequest request) voidsetBodyDecodeFunction(Function<cn.taketoday.core.ResolvableType, ?> decoderFunction) Provide a function to find a decoder the given target type.从类继承的方法 cn.taketoday.core.NestedRuntimeException
contains, getMostSpecificCause, getNestedMessage, getRootCause
-
字段详细资料
-
serialVersionUID
private static final long serialVersionUID- 另请参阅:
-
statusCode
-
statusText
-
responseBody
private final byte[] responseBody -
headers
-
responseCharset
-
request
-
bodyDecodeFunction
-
-
构造器详细资料
-
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. -
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. -
WebClientResponseException
public WebClientResponseException(HttpStatusCode statusCode, String reasonPhrase, @Nullable HttpHeaders headers, @Nullable byte[] body, @Nullable Charset charset, @Nullable HttpRequest request) Constructor with response data only, and a default message. -
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. -
WebClientResponseException
public WebClientResponseException(String message, HttpStatusCode statusCode, String statusText, @Nullable HttpHeaders headers, @Nullable byte[] responseBody, @Nullable Charset charset, @Nullable HttpRequest request) Constructor with a prepared message.
-
-
方法详细资料
-
initMessage
private static String initMessage(HttpStatusCode status, String reasonPhrase, @Nullable HttpRequest request) -
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
Return the HTTP status text. -
getHeaders
Return the HTTP response headers. -
getResponseBodyAsByteArray
public byte[] getResponseBodyAsByteArray()Return the response body as a byte array. -
getResponseBodyAsString
Return the response content as a String using the charset of media type for the response, if available, or otherwise falling back on UTF-8. UsegetResponseBodyAsString(Charset)if you want to fall back on a different, default charset.- 另请参阅:
-
getResponseBodyAsString
Variant ofgetResponseBodyAsString()that allows specifying the charset to fall back on, if a charset is not available from the media type for the response.- 参数:
defaultCharset- the charset to use if the Content-Type of the response does not specify one.
-
getResponseBodyAs
Decode the error content to the specified type.- 类型参数:
E- the expected target type- 参数:
targetType- the type to decode to- 返回:
- the decoded content, or
nullif there is no content - 抛出:
IllegalStateException- if a Decoder cannot be foundcn.taketoday.core.codec.DecodingException- if decoding fails
-
getResponseBodyAs
@Nullable public <E> E getResponseBodyAs(cn.taketoday.core.ParameterizedTypeReference<E> targetType) Variant ofgetResponseBodyAs(Class)withParameterizedTypeReference. -
decodeBody
@Nullable private <E> E decodeBody(cn.taketoday.core.ResolvableType targetType) -
getRequest
Return the corresponding request. -
setBodyDecodeFunction
Provide a function to find a decoder the given target type. For use withgetResponseBodyAs(Class).- 参数:
decoderFunction- the function to find a decoder with
-
create
public static WebClientResponseException create(int statusCode, String statusText, HttpHeaders headers, byte[] body, @Nullable Charset charset) CreateWebClientResponseExceptionor an HTTP status specific subclass. -
create
public static WebClientResponseException create(int statusCode, String statusText, HttpHeaders headers, byte[] body, @Nullable Charset charset, @Nullable HttpRequest request) CreateWebClientResponseExceptionor an HTTP status specific subclass. -
create
public static WebClientResponseException create(HttpStatusCode statusCode, String statusText, HttpHeaders headers, byte[] body, @Nullable Charset charset, @Nullable HttpRequest request) CreateWebClientResponseExceptionor an HTTP status specific subclass.
-