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
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder offers a convenient way to create WebResponse instances. -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal InputStreamAnInputStreamcontaining the response body, if available.final X509CertificateThe server certificate used with this response, if any.static final longThe default read timeout for thebodystream.final booleanWhether or not this response was delivered via a secure connection.final booleanA boolean indicating whether or not this response is the result of a redirection.final booleanSpecifies that the contents should request to be opened in another Android application.final booleanSpecifies that the app may skip requesting the download in the UI.final intThe HTTP status code for the response, e.g.Fields inherited from class org.mozilla.geckoview.WebMessage
headers, uri -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedWebResponse(WebResponse.Builder builder) Construct a new WebResponse from the given builder. -
Method Summary
Modifier and TypeMethodDescriptionvoidsetReadTimeoutMillis(long millis) Sets the maximum amount of time to wait for data in thebodyread() method.
-
Field Details
-
DEFAULT_READ_TIMEOUT_MS
public static final long DEFAULT_READ_TIMEOUT_MSThe default read timeout for thebodystream.- 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
AnInputStreamcontaining 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
Construct a new WebResponse from the given builder.- Parameters:
builder- Builder instance containing the response parameters
-
-
Method Details
-
setReadTimeoutMillis
public void setReadTimeoutMillis(long millis) Sets the maximum amount of time to wait for data in thebodyread() 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.
-