public final class HttpRequestBuilder extends HttpMessageBuilder<HttpRequestBuilder,HttpRequest>
HttpRequest
s. Instances can only be obtained using HttpRequest.builder()
. At the very least, the
request URI needs to be provided via uri(String)
. By default, GET is used as method with empty headers, query
params and entity.entity, headers
Modifier and Type | Method and Description |
---|---|
HttpRequestBuilder |
addQueryParam(String name,
String value)
Includes a new queryParam to be sent in the desired
HttpMessage . |
HttpRequest |
build() |
String |
getMethod() |
MultiMap<String,String> |
getQueryParams() |
URI |
getUri() |
HttpRequestBuilder |
method(HttpConstants.Method method) |
HttpRequestBuilder |
method(String method)
Allows for using extension methods, as defined in the rfc.
|
HttpRequestBuilder |
queryParams(MultiMap<String,String> queryParams) |
HttpRequestBuilder |
uri(String uri)
Declares the URI where this
HttpRequest will be sent. |
HttpRequestBuilder |
uri(URI uri)
Declares the URI where this
HttpRequest will be sent. |
addHeader, addHeaders, entity, getHeaders, getHeaderValue, getHeaderValues, headers, initHeaders, removeHeader
public HttpRequestBuilder uri(String uri)
HttpRequest
will be sent. Minimum required configuration.uri
- the URI (as a String) of the HttpRequest
desired. Non null.public HttpRequestBuilder uri(URI uri)
HttpRequest
will be sent. Minimum required configuration.uri
- the URI of the HttpRequest
desired. Non null.public HttpRequestBuilder method(String method)
#method(Method)
should be used.method
- the HTTP method of the HttpRequest
desired. Non null.public HttpRequestBuilder method(HttpConstants.Method method)
method
- the HTTP method of the HttpRequest
desired. Non null.public HttpRequestBuilder queryParams(MultiMap<String,String> queryParams)
queryParams
- a MultiMap
representing the HTTP query params of the HttpRequest
desired. Non null.public HttpRequestBuilder addQueryParam(String name, String value)
HttpMessage
.name
- the name of the HTTP queryParamvalue
- the value of the HTTP queryParampublic URI getUri()
public String getMethod()
public MultiMap<String,String> getQueryParams()
public HttpRequest build()
build
in class HttpMessageBuilder<HttpRequestBuilder,HttpRequest>
HttpRequest
as describedCopyright © 2018. All rights reserved.