@AnyThread public static class WebResponse.Builder extends WebMessage.Builder
Constructor and Description |
---|
Builder(String uri)
Constructs a new Builder instance with the specified URI.
|
Modifier and Type | Method and Description |
---|---|
WebResponse.Builder |
addHeader(String key,
String value)
Add a HTTP header.
|
WebResponse.Builder |
body(InputStream stream)
Sets the
InputStream containing the body of this response. |
WebResponse |
build() |
WebResponse.Builder |
certificate(X509Certificate certificate) |
WebResponse.Builder |
header(String key,
String value)
Set a HTTP header.
|
WebResponse.Builder |
isSecure(boolean isSecure) |
WebResponse.Builder |
redirected(boolean redirected)
Set whether or not this response was the result of a redirect.
|
WebResponse.Builder |
statusCode(int code)
Set the HTTP status code, e.g.
|
WebResponse.Builder |
uri(String uri)
Set the URI
|
public Builder(@NonNull String uri)
uri
- A URI String.@NonNull public WebResponse.Builder uri(@NonNull String uri)
WebMessage.Builder
uri
in class WebMessage.Builder
uri
- A URI String@NonNull public WebResponse.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 WebResponse.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 WebResponse.Builder body(@NonNull InputStream stream)
InputStream
containing the body of this response.stream
- An InputStream
with the body of the response.@NonNull public WebResponse.Builder isSecure(boolean isSecure)
isSecure
- Whether or not this response is secure.@NonNull public WebResponse.Builder certificate(@NonNull X509Certificate certificate)
certificate
- The certificate used.@NonNull public WebResponse.Builder statusCode(int code)
code
- A int representing the HTTP status code.@NonNull public WebResponse.Builder redirected(boolean redirected)
redirected
- A boolean representing whether or not the request was redirected.@NonNull public WebResponse build()
WebResponse
constructed with the values from this Builder instance.