public class RestClientResponseException extends RestClientException
Constructor and Description |
---|
RestClientResponseException(String message,
int statusCode,
String statusText,
HttpHeaders responseHeaders,
byte[] responseBody,
Charset responseCharset)
Construct a new instance of with the given response data.
|
Modifier and Type | Method and Description |
---|---|
int |
getRawStatusCode()
Return the raw HTTP status code value.
|
byte[] |
getResponseBodyAsByteArray()
Return the response body as a byte array.
|
String |
getResponseBodyAsString()
Return the response body converted to String.
|
String |
getResponseBodyAsString(Charset fallbackCharset)
Return the response body converted to String.
|
HttpHeaders |
getResponseHeaders()
Return the HTTP response headers.
|
String |
getStatusText()
Return the HTTP status text.
|
contains, getMessage, getMostSpecificCause, getRootCause
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public RestClientResponseException(String message, int statusCode, String statusText, @Nullable HttpHeaders responseHeaders, @Nullable byte[] responseBody, @Nullable Charset responseCharset)
statusCode
- the raw status code valuestatusText
- the status textresponseHeaders
- the response headers (may be null
)responseBody
- the response body content (may be null
)responseCharset
- the response body charset (may be null
)public int getRawStatusCode()
public String getStatusText()
@Nullable public HttpHeaders getResponseHeaders()
public byte[] getResponseBodyAsByteArray()
public String getResponseBodyAsString()
"UTF-8"
.public String getResponseBodyAsString(Charset fallbackCharset)
fallbackCharset
- the charset to use on if the response doesn't specify.