Package org.mozilla.geckoview
Class WebResponse
Object
org.mozilla.geckoview.WebMessage
org.mozilla.geckoview.WebResponse
WebResponse represents an HTTP[S] response. It is normally created by
GeckoWebExecutor.fetch(WebRequest)
.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder offers a convenient way to create WebResponse instances. -
Field Summary
Modifier and TypeFieldDescriptionfinal InputStream
AnInputStream
containing the response body, if available.final X509Certificate
The server certificate used with this response, if any.static final long
The default read timeout for thebody
stream.final boolean
Whether or not this response was delivered via a secure connection.final boolean
A boolean indicating whether or not this response is the result of a redirection.final boolean
Specifies that the contents should request to be opened in another Android application.final boolean
Specifies that the app may skip requesting the download in the UI.final int
The HTTP status code for the response, e.g.Fields inherited from class org.mozilla.geckoview.WebMessage
headers, uri
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
setReadTimeoutMillis
(long millis) Sets the maximum amount of time to wait for data in thebody
read() method.
-
Field Details
-
DEFAULT_READ_TIMEOUT_MS
public static final long DEFAULT_READ_TIMEOUT_MSThe default read timeout for thebody
stream.- See Also:
-
statusCode
public final int statusCodeThe HTTP status code for the response, e.g. 200. -
redirected
public final boolean redirectedA boolean indicating whether or not this response is the result of a redirection. -
isSecure
public final boolean isSecureWhether or not this response was delivered via a secure connection. -
certificate
The server certificate used with this response, if any. -
body
AnInputStream
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 collected -
requestExternalApp
@Nullable public final boolean requestExternalAppSpecifies that the contents should request to be opened in another Android application. For example, provide PDF content and set this to true to request that Android opens the PDF in a system PDF viewer (if possible and allowed by the user). -
skipConfirmation
@Nullable public final boolean skipConfirmationSpecifies that the app may skip requesting the download in the UI. A confirmation of the download will still be shown.
-
-
Constructor Details
-
WebResponse
-
-
Method Details
-
setReadTimeoutMillis
public void setReadTimeoutMillis(long millis) Sets the maximum amount of time to wait for data in thebody
read() method. By default, the read timeout is set toDEFAULT_READ_TIMEOUT_MS
.If 0, there will be no timeout and read() will block indefinitely.
- Parameters:
millis
- The duration in milliseconds for the timeout.
-