Class WebResponse


@AnyThread public class WebResponse extends WebMessage
WebResponse represents an HTTP[S] response. It is normally created by GeckoWebExecutor.fetch(WebRequest).
  • Field Details


      public static final long DEFAULT_READ_TIMEOUT_MS
      The default read timeout for the body stream.
      See Also:
    • statusCode

      public final int statusCode
      The HTTP status code for the response, e.g. 200.
    • redirected

      public final boolean redirected
      A boolean indicating whether or not this response is the result of a redirection.
    • isSecure

      public final boolean isSecure
      Whether or not this response was delivered via a secure connection.
    • certificate

      @Nullable public final X509Certificate certificate
      The server certificate used with this response, if any.
    • body

      @Nullable public final InputStream body
      An 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 collected
    • requestExternalApp

      @Nullable public final boolean requestExternalApp
      Specifies 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 skipConfirmation
      Specifies that the app may skip requesting the download in the UI. A confirmation of the download will still be shown.
  • Constructor Details

  • Method Details

    • setReadTimeoutMillis

      public void setReadTimeoutMillis(long millis)
      Sets the maximum amount of time to wait for data in the 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.