Class WebRequest

Object
org.mozilla.geckoview.WebMessage
org.mozilla.geckoview.WebRequest

@AnyThread public class WebRequest extends WebMessage
WebRequest represents an HTTP[S] request. The typical pattern is to create instances of this class via WebRequest.Builder, and fetch responses via GeckoWebExecutor.fetch(WebRequest).
  • Field Details

    • method

      @NonNull public final String method
      The HTTP method for the request. Defaults to "GET".
    • body

      @Nullable public final ByteBuffer body
      The body of the request. Must be a directly-allocated ByteBuffer. May be null.
    • cacheMode

      public final int cacheMode
      The cache mode for the request. See CACHE_MODE_DEFAULT. These modes match those from the DOM Fetch API.
      See Also:
    • beConservative

      public final boolean beConservative
      If true, do not use newer protocol features that might have interop problems on the Internet. Intended only for use with critical infrastructure.
    • referrer

      @Nullable public final String referrer
      The value of the Referer header for this request.
    • CACHE_MODE_DEFAULT

      public static final int CACHE_MODE_DEFAULT
      Default cache mode. Normal caching rules apply.
      See Also:
    • CACHE_MODE_NO_STORE

      public static final int CACHE_MODE_NO_STORE
      The response will be fetched from the server without looking in the cache, and will not update the cache with the downloaded response.
      See Also:
    • CACHE_MODE_RELOAD

      public static final int CACHE_MODE_RELOAD
      The response will be fetched from the server without looking in the cache. The cache will be updated with the downloaded response.
      See Also:
    • CACHE_MODE_NO_CACHE

      public static final int CACHE_MODE_NO_CACHE
      Forces a conditional request to the server if there is a cache match.
      See Also:
    • CACHE_MODE_FORCE_CACHE

      public static final int CACHE_MODE_FORCE_CACHE
      If a response is found in the cache, it will be returned, whether it's fresh or not. If there is no match, a normal request will be made and the cache will be updated with the downloaded response.
      See Also:
    • CACHE_MODE_ONLY_IF_CACHED

      public static final int CACHE_MODE_ONLY_IF_CACHED
      If a response is found in the cache, it will be returned, whether it's fresh or not. If there is no match from the cache, 504 Gateway Timeout will be returned.
      See Also:
  • Constructor Details

    • WebRequest

      public WebRequest(@NonNull String uri)
      Constructs a WebRequest with the specified URI.
      Parameters:
      uri - A URI String, e.g. https://mozilla.org