接口 ClientHttpResponse
- 所有超级接口:
AutoCloseable,Closeable,HttpInputMessage,HttpMessage
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.- 从以下版本开始:
- 3.0
- 作者:
- Arjen Poutsma
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 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.从接口继承的方法 org.springframework.http.HttpInputMessage
getBody
从接口继承的方法 org.springframework.http.HttpMessage
getHeaders
方法详细资料
getStatusCode
HttpStatus getStatusCode() throws IOException
Return the HTTP status code of the response.- 返回:
- the HTTP status as an HttpStatus enum value
- 抛出:
IOException- in case of I/O errorsIllegalArgumentException- in case of an unknown HTTP status code- 另请参阅:
HttpStatus.valueOf(int)
getRawStatusCode
int getRawStatusCode() throws IOException
Return the HTTP status code (potentially non-standard and not resolvable through theHttpStatusenum) as an integer.- 返回:
- the HTTP status as an integer
- 抛出:
IOException- in case of I/O errors- 从以下版本开始:
- 3.1.1
- 另请参阅:
getStatusCode()
getStatusText
String getStatusText() throws IOException
Return the HTTP status text of the response.- 返回:
- the HTTP status text
- 抛出:
IOException- in case of I/O errors
close
void close()
Close this response, freeing any resources created.- 指定者:
close在接口中AutoCloseable- 指定者:
close在接口中Closeable