public final class Response extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Response.Builder |
Modifier and Type | Method and Description |
---|---|
ResponseBody |
body() |
CacheControl |
cacheControl()
Returns the cache control directives for this response.
|
Response |
cacheResponse()
Returns the raw response received from the cache.
|
List<Challenge> |
challenges()
Returns the authorization challenges appropriate for this response's code.
|
int |
code()
Returns the HTTP status code.
|
Handshake |
handshake()
Returns the TLS handshake of the connection that carried this response, or
null if the response was received without TLS.
|
String |
header(String name) |
String |
header(String name,
String defaultValue) |
Headers |
headers() |
List<String> |
headers(String name) |
boolean |
isRedirect()
Returns true if this response redirects to another resource.
|
boolean |
isSuccessful()
Returns true if the code is in [200..300), which means the request was
successfully received, understood, and accepted.
|
String |
message()
Returns the HTTP status message or null if it is unknown.
|
Response |
networkResponse()
Returns the raw response received from the network.
|
Response.Builder |
newBuilder() |
Response |
priorResponse()
Returns the response for the HTTP redirect or authorization challenge that
triggered this response, or null if this response wasn't triggered by an
automatic retry.
|
Protocol |
protocol()
Returns the HTTP protocol, such as
Protocol.HTTP_1_1 or Protocol.HTTP_1_0 . |
Request |
request()
The wire-level request that initiated this HTTP response.
|
String |
toString() |
public Request request()
Content-Length
from the request body.
public Protocol protocol()
Protocol.HTTP_1_1
or Protocol.HTTP_1_0
.public int code()
public boolean isSuccessful()
public String message()
public Handshake handshake()
public Headers headers()
public ResponseBody body()
public Response.Builder newBuilder()
public boolean isRedirect()
public Response networkResponse()
public Response cacheResponse()
public Response priorResponse()
public List<Challenge> challenges()
public CacheControl cacheControl()
Cache-Control
header.Copyright © 2016. All Rights Reserved.