public class WebClientResponseException extends WebClientException
Modifier and Type | Field and Description |
---|---|
private HttpHeaders |
headers |
private HttpRequest |
request |
private byte[] |
responseBody |
private java.nio.charset.Charset |
responseCharset |
private static long |
serialVersionUID |
private int |
statusCode |
private java.lang.String |
statusText |
Constructor and Description |
---|
WebClientResponseException(int statusCode,
java.lang.String statusText,
HttpHeaders headers,
byte[] body,
java.nio.charset.Charset charset)
Constructor with response data only, and a default message.
|
WebClientResponseException(int statusCode,
java.lang.String statusText,
HttpHeaders headers,
byte[] body,
java.nio.charset.Charset charset,
HttpRequest request)
Constructor with response data only, and a default message.
|
WebClientResponseException(java.lang.String message,
int statusCode,
java.lang.String statusText,
HttpHeaders headers,
byte[] responseBody,
java.nio.charset.Charset charset)
Constructor with a prepared message.
|
WebClientResponseException(java.lang.String message,
int statusCode,
java.lang.String statusText,
HttpHeaders headers,
byte[] responseBody,
java.nio.charset.Charset charset,
HttpRequest request)
Constructor with a prepared message.
|
Modifier and Type | Method and Description |
---|---|
static WebClientResponseException |
create(int statusCode,
java.lang.String statusText,
HttpHeaders headers,
byte[] body,
java.nio.charset.Charset charset)
Create
WebClientResponseException or an HTTP status specific subclass. |
static WebClientResponseException |
create(int statusCode,
java.lang.String statusText,
HttpHeaders headers,
byte[] body,
java.nio.charset.Charset charset,
HttpRequest request)
Create
WebClientResponseException 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.
|
java.lang.String |
getResponseBodyAsString()
Return the response body as a string.
|
HttpStatus |
getStatusCode()
Return the HTTP status code value.
|
java.lang.String |
getStatusText()
Return the HTTP status text.
|
contains, getMessage, getMostSpecificCause, getRootCause
private static final long serialVersionUID
private final int statusCode
private final java.lang.String statusText
private final byte[] responseBody
private final HttpHeaders headers
private final java.nio.charset.Charset responseCharset
@Nullable private final HttpRequest request
public WebClientResponseException(int statusCode, java.lang.String statusText, @Nullable HttpHeaders headers, @Nullable byte[] body, @Nullable java.nio.charset.Charset charset)
public WebClientResponseException(int statusCode, java.lang.String statusText, @Nullable HttpHeaders headers, @Nullable byte[] body, @Nullable java.nio.charset.Charset charset, @Nullable HttpRequest request)
public WebClientResponseException(java.lang.String message, int statusCode, java.lang.String statusText, @Nullable HttpHeaders headers, @Nullable byte[] responseBody, @Nullable java.nio.charset.Charset charset)
public WebClientResponseException(java.lang.String message, int statusCode, java.lang.String statusText, @Nullable HttpHeaders headers, @Nullable byte[] responseBody, @Nullable java.nio.charset.Charset charset, @Nullable HttpRequest request)
public HttpStatus getStatusCode()
java.lang.IllegalArgumentException
- in case of an unknown HTTP status codepublic int getRawStatusCode()
public java.lang.String getStatusText()
public HttpHeaders getHeaders()
public byte[] getResponseBodyAsByteArray()
public java.lang.String getResponseBodyAsString()
@Nullable public HttpRequest getRequest()
public static WebClientResponseException create(int statusCode, java.lang.String statusText, HttpHeaders headers, byte[] body, @Nullable java.nio.charset.Charset charset)
WebClientResponseException
or an HTTP status specific subclass.public static WebClientResponseException create(int statusCode, java.lang.String statusText, HttpHeaders headers, byte[] body, @Nullable java.nio.charset.Charset charset, @Nullable HttpRequest request)
WebClientResponseException
or an HTTP status specific subclass.