public final class Response
extends java.lang.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.
|
java.util.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.
|
java.lang.String |
header(java.lang.String name) |
java.lang.String |
header(java.lang.String name,
java.lang.String defaultValue) |
Headers |
headers() |
java.util.List<java.lang.String> |
headers(java.lang.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.
|
java.lang.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.
|
java.lang.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 java.lang.String message()
public Handshake handshake()
public java.util.List<java.lang.String> headers(java.lang.String name)
public java.lang.String header(java.lang.String name)
public java.lang.String header(java.lang.String name, java.lang.String defaultValue)
public Headers headers()
public ResponseBody body()
public Response.Builder newBuilder()
public boolean isRedirect()
public Response networkResponse()
public Response cacheResponse()
public Response priorResponse()
public java.util.List<Challenge> challenges()
public CacheControl cacheControl()
Cache-Control
header.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2014. All Rights Reserved.