@AnyThread public class WebResponse extends WebMessage
GeckoWebExecutor.fetch(WebRequest)
.Modifier and Type | Class and Description |
---|---|
static class |
WebResponse.Builder
Builder offers a convenient way to create WebResponse instances.
|
Modifier and Type | Field and Description |
---|---|
InputStream |
body
An
InputStream containing the response body, if available. |
X509Certificate |
certificate
The server certificate used with this response, if any.
|
static long |
DEFAULT_READ_TIMEOUT_MS
The default read timeout for the
body stream. |
boolean |
isSecure
Whether or not this response was delivered via a secure connection.
|
boolean |
redirected
A boolean indicating whether or not this response is
the result of a redirection.
|
int |
statusCode
The HTTP status code for the response, e.g.
|
headers, uri
Modifier | Constructor and Description |
---|---|
protected |
WebResponse(WebResponse.Builder builder) |
Modifier and Type | Method and Description |
---|---|
void |
setReadTimeoutMillis(long millis)
Sets the maximum amount of time to wait for data in the
body read() method. |
public static final long DEFAULT_READ_TIMEOUT_MS
body
stream.public final int statusCode
public final boolean redirected
public final boolean isSecure
@Nullable public final X509Certificate certificate
@Nullable public final InputStream body
InputStream
containing the response body, if available.
Attention: the stream must be closed whenever the app is done with it,
even when the body is ignored.
Otherwise the connection will not be closed until the stream is garbage collectedprotected WebResponse(@NonNull WebResponse.Builder builder)
public void setReadTimeoutMillis(long millis)
body
read() method.
By default, the read timeout is set to DEFAULT_READ_TIMEOUT_MS
.
If 0, there will be no timeout and read() will block indefinitely.millis
- The duration in milliseconds for the timeout.