public interface ClientHttpResponse extends HttpInputMessage, Closeable
Obtained via an invocation of ClientHttpRequest.execute()
.
A ClientHttpResponse
must be closed,
typically in a finally
block.
Modifier and Type | Method and Description |
---|---|
void |
close()
Close this response, freeing any resources created.
|
int |
getRawStatusCode()
Get the HTTP status code (potentially non-standard and not
resolvable through the
HttpStatus enum) as an integer. |
HttpStatus |
getStatusCode()
Get the HTTP status code as an
HttpStatus enum value. |
String |
getStatusText()
Get the HTTP status text of the response.
|
getBody
getHeaders
HttpStatus getStatusCode() throws IOException
HttpStatus
enum value.
For status codes not supported by HttpStatus
, use
getRawStatusCode()
instead.
null
)IOException
- in case of I/O errorsIllegalArgumentException
- in case of an unknown HTTP status codeHttpStatus.valueOf(int)
int getRawStatusCode() throws IOException
HttpStatus
enum) as an integer.IOException
- in case of I/O errorsgetStatusCode()
,
HttpStatus.resolve(int)
String getStatusText() throws IOException
IOException
- in case of I/O errorsvoid close()
close
in interface AutoCloseable
close
in interface Closeable