Class WebMessage.Builder

Object
org.mozilla.geckoview.WebMessage.Builder
Direct Known Subclasses:
WebRequest.Builder, WebResponse.Builder
Enclosing class:
WebMessage

@AnyThread public abstract static class WebMessage.Builder extends Object
This is a Builder used by subclasses of WebMessage.
  • Method Details

    • uri

      @NonNull public WebMessage.Builder uri(@NonNull String uri)
      Set the URI
      Parameters:
      uri - A URI String
      Returns:
      This Builder instance.
    • header

      @NonNull public WebMessage.Builder header(@NonNull String key, @NonNull String value)
      Set a HTTP header. This may be called multiple times for additional headers. If an existing header of the same name exists, it will be replaced by this value.

      Please note that the HTTP header keys are case-insensitive. It means you can retrieve "Content-Type" with map.get("content-type"), and value for "Content-Type" will be overwritten by map.put("cONTENt-TYpe", value); The keys are also sorted in natural order.

      Parameters:
      key - The key for the HTTP header, e.g. "content-type".
      value - The value for the HTTP header, e.g. "application/json".
      Returns:
      This Builder instance.
    • addHeader

      @NonNull public WebMessage.Builder addHeader(@NonNull String key, @NonNull String value)
      Add a HTTP header. This may be called multiple times for additional headers. If an existing header of the same name exists, the values will be merged.

      Please note that the HTTP header keys are case-insensitive. It means you can retrieve "Content-Type" with map.get("content-type"), and value for "Content-Type" will be overwritten by map.put("cONTENt-TYpe", value); The keys are also sorted in natural order.

      Parameters:
      key - The key for the HTTP header, e.g. "content-type".
      value - The value for the HTTP header, e.g. "application/json".
      Returns:
      This Builder instance.