接口 ClientHttpResponse
- 所有超级接口:
AutoCloseable
,Closeable
,HttpInputMessage
,HttpMessage
public interface ClientHttpResponse extends HttpInputMessage, Closeable
Represents a client-side HTTP response.Obtained via an invocation of
ClientHttpRequest.execute()
.A
ClientHttpResponse
must be closed, typically in afinally
block.- 从以下版本开始:
- 3.0
- 作者:
- Arjen Poutsma
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 void
close()
Close this response, freeing any resources created.int
getRawStatusCode()
Get the HTTP status code (potentially non-standard and not resolvable through theHttpStatus
enum) as an integer.HttpStatus
getStatusCode()
Get the HTTP status code as anHttpStatus
enum value.String
getStatusText()
Get the HTTP status text of the response.从接口继承的方法 org.springframework.http.HttpInputMessage
getBody
从接口继承的方法 org.springframework.http.HttpMessage
getHeaders
方法详细资料
getStatusCode
HttpStatus getStatusCode() throws IOException
Get the HTTP status code as anHttpStatus
enum value.For status codes not supported by
HttpStatus
, usegetRawStatusCode()
instead.- 返回:
- the HTTP status as an HttpStatus enum value (never
null
) - 抛出:
IOException
- in case of I/O errorsIllegalArgumentException
- in case of an unknown HTTP status code- 从以下版本开始:
- #getRawStatusCode()
- 另请参阅:
HttpStatus.valueOf(int)
getRawStatusCode
int getRawStatusCode() throws IOException
Get the HTTP status code (potentially non-standard and not resolvable through theHttpStatus
enum) as an integer.- 返回:
- the HTTP status as an integer value
- 抛出:
IOException
- in case of I/O errors- 从以下版本开始:
- 3.1.1
- 另请参阅:
getStatusCode()
,HttpStatus.resolve(int)
getStatusText
String getStatusText() throws IOException
Get 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