Top Description Methods
org.springframework.http.client

public Interface ClientHttpResponse

extends HttpInputMessage, Closeable
Known Direct Subinterfaces
org.springframework.web.client.RestClient.RequestHeadersSpec.ConvertibleClientHttpResponse
Known Direct Implementers
org.springframework.http.client.HttpComponentsClientHttpResponse, org.springframework.http.client.JdkClientHttpResponse, org.springframework.http.client.JettyClientHttpResponse, org.springframework.http.client.OkHttp3ClientHttpResponse, org.springframework.http.client.ReactorNettyClientResponse, org.springframework.http.client.SimpleClientHttpResponse, org.springframework.web.client.ClientHttpResponseDecorator, org.springframework.http.client.AbstractClientHttpResponse, org.springframework.http.client.BufferingClientHttpResponseWrapper
Imports
java.io.Closeable, .IOException, org.springframework.http.HttpInputMessage, .HttpStatusCode

Represents a client-side HTTP response.

Obtained via an invocation of ClientHttpRequest#execute().

A ClientHttpResponse must be closed, typically in a finally block.

Author
Arjen Poutsma
Since
3.0

Method Summary

Modifier and TypeMethod and Description
public void
close()

Redeclares java.io.Closeable.close.

Close this response, freeing any resources created.
public default int

Returns:

the HTTP status as an integer value
getRawStatusCode
()

Deprecated for removal since 6.0. as of 6.0, in favor of getStatusCode(); scheduled for removal in 6.2
Get the HTTP status code as an integer.
public HttpStatusCode

Returns:

the HTTP status as HttpStatusCode value (never null)
getStatusCode
()

Get the HTTP status code as an HttpStatusCode.

public String

Returns:

the HTTP status text
getStatusText
()

Get the HTTP status text of the response.

Inherited from org.springframework.http.HttpInputMessage:
getBody

Method Detail

closeback to summary
public void close()

Redeclares java.io.Closeable.close.

Close this response, freeing any resources created.

Annotations
@Override
getRawStatusCodeback to summary
public default int getRawStatusCode() throws IOException

Deprecated

for removal since 6.0.

as of 6.0, in favor of getStatusCode(); scheduled for removal in 6.2

Get the HTTP status code as an integer.

Returns:int

the HTTP status as an integer value

Annotations
@Deprecated
since:6.0
forRemoval:true
Exceptions
IOException:
in case of I/O errors
Since
3.1.1
See Also
getStatusCode()
getStatusCodeback to summary
public HttpStatusCode getStatusCode() throws IOException

Get the HTTP status code as an HttpStatusCode.

Returns:HttpStatusCode

the HTTP status as HttpStatusCode value (never null)

Exceptions
IOException:
in case of I/O errors
getStatusTextback to summary
public String getStatusText() throws IOException

Get the HTTP status text of the response.

Returns:String

the HTTP status text

Exceptions
IOException:
in case of I/O errors