@AnyThread public static class WebRequest.Builder extends WebMessage.Builder
WebRequest
instances.Constructor and Description |
---|
Builder(String uri)
Construct a Builder instance with the specified URI.
|
Modifier and Type | Method and Description |
---|---|
WebRequest.Builder |
addHeader(String key,
String value)
Add a HTTP header.
|
WebRequest.Builder |
body(ByteBuffer buffer)
Set the body.
|
WebRequest.Builder |
body(String bodyString)
Set the body.
|
WebRequest |
build() |
WebRequest.Builder |
cacheMode(int mode)
Set the cache mode.
|
WebRequest.Builder |
header(String key,
String value)
Set a HTTP header.
|
WebRequest.Builder |
method(String method)
Set the HTTP method.
|
WebRequest.Builder |
referrer(String referrer)
Set the HTTP Referer header.
|
WebRequest.Builder |
uri(String uri)
Set the URI
|
public Builder(@NonNull String uri)
uri
- A URI String.@NonNull public WebRequest.Builder uri(@NonNull String uri)
WebMessage.Builder
uri
in class WebMessage.Builder
uri
- A URI String@NonNull public WebRequest.Builder header(@NonNull String key, @NonNull String value)
WebMessage.Builder
header
in class WebMessage.Builder
key
- The key for the HTTP header, e.g. "content-type".value
- The value for the HTTP header, e.g. "application/json".@NonNull public WebRequest.Builder addHeader(@NonNull String key, @NonNull String value)
WebMessage.Builder
addHeader
in class WebMessage.Builder
key
- The key for the HTTP header, e.g. "content-type".value
- The value for the HTTP header, e.g. "application/json".@NonNull public WebRequest.Builder body(@Nullable ByteBuffer buffer)
buffer
- A ByteBuffer
with the data.
Must be allocated directly via ByteBuffer.allocateDirect(int)
.@NonNull public WebRequest.Builder body(@Nullable String bodyString)
bodyString
- A String
with the data.@NonNull public WebRequest.Builder method(@NonNull String method)
method
- The HTTP method String.@NonNull public WebRequest.Builder cacheMode(int mode)
mode
- One of the CACHE_*
flags.@NonNull public WebRequest.Builder referrer(@Nullable String referrer)
referrer
- A URI String@NonNull public WebRequest build()
WebRequest
constructed with the values from this Builder instance.