public class WebClientResponseException extends WebClientException
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
static WebClientResponseException |
create(int statusCode,
String statusText,
HttpHeaders headers,
byte[] body,
Charset charset)
Create
WebClientResponseException or an HTTP status specific subclass. |
static WebClientResponseException |
create(int statusCode,
String statusText,
HttpHeaders headers,
byte[] body,
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.
|
String |
getResponseBodyAsString()
Return the response body as a string.
|
HttpStatus |
getStatusCode()
Return the HTTP status code value.
|
String |
getStatusText()
Return the HTTP status text.
|
contains, getMessage, getMostSpecificCause, getRootCause
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public WebClientResponseException(int statusCode, String statusText, @Nullable HttpHeaders headers, @Nullable byte[] body, @Nullable Charset charset)
public WebClientResponseException(int status, String reasonPhrase, @Nullable HttpHeaders headers, @Nullable byte[] body, @Nullable Charset charset, @Nullable HttpRequest request)
public WebClientResponseException(String message, int statusCode, String statusText, @Nullable HttpHeaders headers, @Nullable byte[] responseBody, @Nullable Charset charset)
public WebClientResponseException(String message, int statusCode, String statusText, @Nullable HttpHeaders headers, @Nullable byte[] responseBody, @Nullable Charset charset, @Nullable HttpRequest request)
public HttpStatus getStatusCode()
IllegalArgumentException
- in case of an unknown HTTP status codepublic int getRawStatusCode()
public String getStatusText()
public HttpHeaders getHeaders()
public byte[] getResponseBodyAsByteArray()
public String getResponseBodyAsString()
@Nullable public HttpRequest getRequest()
public static WebClientResponseException create(int statusCode, String statusText, HttpHeaders headers, byte[] body, @Nullable Charset charset)
WebClientResponseException
or an HTTP status specific subclass.public static WebClientResponseException create(int statusCode, String statusText, HttpHeaders headers, byte[] body, @Nullable Charset charset, @Nullable HttpRequest request)
WebClientResponseException
or an HTTP status specific subclass.