Package org.springframework.http.client
Interface ClientHttpResponse
- All Superinterfaces:
AutoCloseable,Closeable,HttpInputMessage,HttpMessage
- All Known Subinterfaces:
RestClient.RequestHeadersSpec.ConvertibleClientHttpResponse
- All Known Implementing Classes:
MockClientHttpResponse
Represents a client-side HTTP response.
Obtained via an invocation of ClientHttpRequest.execute().
A ClientHttpResponse must be closed,
typically in a finally block.
- Since:
- 3.0
- Author:
- Arjen Poutsma
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close this response, freeing any resources created.default intDeprecated, for removal: This API element is subject to removal in a future version.Get the HTTP status code as anHttpStatusCode.Get the HTTP status text of the response.Methods inherited from interface org.springframework.http.HttpInputMessage
getBodyMethods inherited from interface org.springframework.http.HttpMessage
getHeaders
-
Method Details
-
getStatusCode
Get the HTTP status code as anHttpStatusCode.- Returns:
- the HTTP status as
HttpStatusCodevalue (nevernull) - Throws:
IOException- in case of I/O errors
-
getRawStatusCode
Deprecated, for removal: This API element is subject to removal in a future version.in favor ofgetStatusCode(), for removal in 7.0Get the HTTP status code as an integer.- Returns:
- the HTTP status as an integer value
- Throws:
IOException- in case of I/O errors- Since:
- 3.1.1
- See Also:
-
getStatusText
Get the HTTP status text of the response.- Returns:
- the HTTP status text
- Throws:
IOException- in case of I/O errors
-
close
void close()Close this response, freeing any resources created.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getStatusCode(), for removal in 7.0