public interface ClientHttpResponse extends HttpInputMessage, CloseableSE
ClientHttpRequest.execute()
の呼び出しによって取得されます。
ClientHttpResponse
は、通常 finally
ブロックでクローズする必要があります。
修飾子と型 | メソッドと説明 |
---|---|
void | close() このレスポンスを閉じて、作成されたリソースを解放します。 |
int | getRawStatusCode() HTTP ステータスコード(非標準で、 HttpStatus 列挙型では解決できない可能性があります)を整数として取得します。 |
HttpStatus | getStatusCode() HTTP ステータスコードを HttpStatus 列挙値として取得します。 |
StringSE | getStatusText() レスポンスの HTTP ステータステキストを取得します。 |
getBody
getHeaders
HttpStatus getStatusCode() throws IOExceptionSE
HttpStatus
列挙値として取得します。HttpStatus
でサポートされていないステータスコードについては、代わりに getRawStatusCode()
を使用してください。
null
)IOExceptionSE
- I/O エラーの場合 IllegalArgumentExceptionSE
- 不明な HTTP ステータスコードの場合 HttpStatus.valueOf(int)
int getRawStatusCode() throws IOExceptionSE
HttpStatus
列挙型では解決できない可能性があります)を整数として取得します。IOExceptionSE
- I/O エラーの場合 getStatusCode()
, HttpStatus.resolve(int)
StringSE getStatusText() throws IOExceptionSE
IOExceptionSE
- I/O エラーの場合 void close()
AutoCloseableSE
の closeSE
CloseableSE
の closeSE