Package org.springframework.http.client
Interface ClientHttpResponse
- All Superinterfaces:
AutoCloseable,Closeable,HttpInputMessage,HttpMessage
- All Known Implementing Classes:
AbstractClientHttpResponse,MockClientHttpResponse
public interface ClientHttpResponse extends HttpInputMessage, Closeable
Represents a client-side HTTP response. Obtained via an calling of theClientHttpRequest.execute().A
ClientHttpResponsemust be closed, typically in afinallyblock.- Since:
- 3.0
- Author:
- Arjen Poutsma
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Close this response, freeing any resources created.intgetRawStatusCode()Return the HTTP status code (potentially non-standard and not resolvable through theHttpStatusenum) as an integer.HttpStatusgetStatusCode()Return the HTTP status code of the response.StringgetStatusText()Return the HTTP status text of the response.Methods inherited from interface org.springframework.http.HttpInputMessage
getBody
Methods inherited from interface org.springframework.http.HttpMessage
getHeaders
Method Detail
getStatusCode
HttpStatus getStatusCode() throws IOException
Return the HTTP status code of the response.- Returns:
- the HTTP status as an HttpStatus enum value
- Throws:
IOException- in case of I/O errorsIllegalArgumentException- in case of an unknown HTTP status code- See Also:
HttpStatus.valueOf(int)
getRawStatusCode
int getRawStatusCode() throws IOException
Return the HTTP status code (potentially non-standard and not resolvable through theHttpStatusenum) as an integer.- Returns:
- the HTTP status as an integer
- Throws:
IOException- in case of I/O errors- Since:
- 3.1.1
- See Also:
getStatusCode()
getStatusText
String getStatusText() throws IOException
Return 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