Package org.mozilla.geckoview
Class WebRequest.Builder
Object
org.mozilla.geckoview.WebMessage.Builder
org.mozilla.geckoview.WebRequest.Builder
- Enclosing class:
- WebRequest
Builder offers a convenient way for constructing
WebRequest
instances.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd a HTTP header.beConservative
(boolean beConservative) Set the beConservative property.Set the body.body
(ByteBuffer buffer) Set the body.build()
cacheMode
(int mode) Set the cache mode.Set a HTTP header.Set the HTTP method.Set the HTTP Referer header.Set the URI
-
Constructor Details
-
Builder
Construct a Builder instance with the specified URI.- Parameters:
uri
- A URI String.
-
-
Method Details
-
uri
Description copied from class:WebMessage.Builder
Set the URI- Overrides:
uri
in classWebMessage.Builder
- Parameters:
uri
- A URI String- Returns:
- This Builder instance.
-
header
Description copied from class:WebMessage.Builder
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.
- Overrides:
header
in classWebMessage.Builder
- 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
Description copied from class:WebMessage.Builder
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.
- Overrides:
addHeader
in classWebMessage.Builder
- 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.
-
body
Set the body.- Parameters:
buffer
- AByteBuffer
with the data. Must be allocated directly viaByteBuffer.allocateDirect(int)
.- Returns:
- This Builder instance.
-
body
Set the body.- Parameters:
bodyString
- AString
with the data.- Returns:
- This Builder instance.
-
method
Set the HTTP method.- Parameters:
method
- The HTTP method String.- Returns:
- This Builder instance.
-
cacheMode
Set the cache mode.- Parameters:
mode
- One of theCACHE_*
flags.- Returns:
- This Builder instance.
-
referrer
Set the HTTP Referer header.- Parameters:
referrer
- A URI String- Returns:
- This Builder instance.
-
beConservative
Set the beConservative property.- Parameters:
beConservative
- If true, do not use newer protocol features that might have interop problems on the Internet. Intended only for use with critical infrastructure.- Returns:
- This Builder instance.
-
build
- Returns:
- A
WebRequest
constructed with the values from this Builder instance.
-