Package org.springframework.http.client
Interface ClientHttpResponse
- All Superinterfaces:
- AutoCloseable,- Closeable,- HttpInputMessage,- HttpMessage
- All Known Implementing Classes:
- AbstractClientHttpResponse,- 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 SummaryModifier and TypeMethodDescriptionvoidclose()Close this response, freeing any resources created.intGet the HTTP status code (potentially non-standard and not resolvable through theHttpStatusenum) as an integer.Get the HTTP status code as anHttpStatusenum value.Get the HTTP status text of the response.Methods inherited from interface org.springframework.http.HttpInputMessagegetBodyMethods inherited from interface org.springframework.http.HttpMessagegetHeaders
- 
Method Details- 
getStatusCodeGet the HTTP status code as anHttpStatusenum value.For status codes not supported by HttpStatus, usegetRawStatusCode()instead.- Returns:
- the HTTP status as an HttpStatus enum value (never null)
- Throws:
- IOException- in case of I/O errors
- IllegalArgumentException- in case of an unknown HTTP status code
- Since:
- #getRawStatusCode()
- See Also:
 
- 
getRawStatusCodeGet the HTTP status code (potentially non-standard and not resolvable through theHttpStatusenum) 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:
 
- 
getStatusTextGet the HTTP status text of the response.- Returns:
- the HTTP status text
- Throws:
- IOException- in case of I/O errors
 
- 
closevoid close()Close this response, freeing any resources created.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
 
-