Package com.linecorp.armeria.common
Class HttpRequestBuilder
java.lang.Object
com.linecorp.armeria.common.AbstractHttpRequestBuilder
com.linecorp.armeria.common.HttpRequestBuilder
Builds a new
HttpRequest
.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the request.Sets the content for this request.Sets the content for this request.content(MediaType contentType, CharSequence content)
Sets the content for this request.Sets the content for this request.Sets the content for this request.Sets thePublisher
for this request.Sets a cookie for this request.Sets multiple cookies for this request.Shortcut to set DELETE method and path.Disables path parameters substitution.Shortcut to set GET method and path.Shortcut to set HEAD method and path.header(CharSequence name, Object value)
Adds a header for this request.headers(Iterable<? extends Map.Entry<? extends CharSequence,String>> headers)
Adds multiple headers for this request.method(HttpMethod method)
Sets the method for this request.Shortcut to set OPTIONS method and path.Shortcut to set PATCH method and path.Sets the path for this request.Sets a path param for this request.pathParams(Map<String,?> pathParams)
Sets multiple path params for this request.Shortcut to set POST method and path.Shortcut to set PUT method and path.queryParam(String name, Object value)
Sets a query param for this request.queryParams(Iterable<? extends Map.Entry<? extends String,String>> queryParams)
Sets multiple query params for this request.Shortcut to set TRACE method and path.trailers(Iterable<? extends Map.Entry<? extends CharSequence,String>> trailers)
Sets HTTP trailers for this request.Methods inherited from class com.linecorp.armeria.common.AbstractHttpRequestBuilder
buildRequest
-
Method Details
-
build
Builds the request. -
get
Description copied from class:AbstractHttpRequestBuilder
Shortcut to set GET method and path.- Overrides:
get
in classAbstractHttpRequestBuilder
-
post
Description copied from class:AbstractHttpRequestBuilder
Shortcut to set POST method and path.- Overrides:
post
in classAbstractHttpRequestBuilder
-
put
Description copied from class:AbstractHttpRequestBuilder
Shortcut to set PUT method and path.- Overrides:
put
in classAbstractHttpRequestBuilder
-
delete
Description copied from class:AbstractHttpRequestBuilder
Shortcut to set DELETE method and path.- Overrides:
delete
in classAbstractHttpRequestBuilder
-
patch
Description copied from class:AbstractHttpRequestBuilder
Shortcut to set PATCH method and path.- Overrides:
patch
in classAbstractHttpRequestBuilder
-
options
Description copied from class:AbstractHttpRequestBuilder
Shortcut to set OPTIONS method and path.- Overrides:
options
in classAbstractHttpRequestBuilder
-
head
Description copied from class:AbstractHttpRequestBuilder
Shortcut to set HEAD method and path.- Overrides:
head
in classAbstractHttpRequestBuilder
-
trace
Description copied from class:AbstractHttpRequestBuilder
Shortcut to set TRACE method and path.- Overrides:
trace
in classAbstractHttpRequestBuilder
-
method
Description copied from class:AbstractHttpRequestBuilder
Sets the method for this request.- Overrides:
method
in classAbstractHttpRequestBuilder
- See Also:
HttpMethod
-
path
Description copied from class:AbstractHttpRequestBuilder
Sets the path for this request.- Overrides:
path
in classAbstractHttpRequestBuilder
-
content
Description copied from class:AbstractHttpRequestBuilder
Sets the content for this request.- Overrides:
content
in classAbstractHttpRequestBuilder
-
content
Description copied from class:AbstractHttpRequestBuilder
Sets the content for this request.- Overrides:
content
in classAbstractHttpRequestBuilder
-
content
@FormatMethod public HttpRequestBuilder content(MediaType contentType, @FormatString String format, Object... content)Description copied from class:AbstractHttpRequestBuilder
Sets the content for this request. Thecontent
is formatted byString.format(Locale, String, Object...)
with English locale.- Overrides:
content
in classAbstractHttpRequestBuilder
-
content
Description copied from class:AbstractHttpRequestBuilder
Sets the content for this request. Thecontent
will be wrapped usingHttpData.wrap(byte[])
, so any changes made tocontent
will be reflected in the request.- Overrides:
content
in classAbstractHttpRequestBuilder
-
content
Description copied from class:AbstractHttpRequestBuilder
Sets the content for this request.- Overrides:
content
in classAbstractHttpRequestBuilder
-
content
public HttpRequestBuilder content(MediaType contentType, org.reactivestreams.Publisher<? extends HttpData> publisher)Description copied from class:AbstractHttpRequestBuilder
Sets thePublisher
for this request.- Overrides:
content
in classAbstractHttpRequestBuilder
-
header
Description copied from class:AbstractHttpRequestBuilder
Adds a header for this request. For example:HttpRequest.builder() .get("/") .header("authorization", "foo") .build();
- Overrides:
header
in classAbstractHttpRequestBuilder
-
headers
public HttpRequestBuilder headers(Iterable<? extends Map.Entry<? extends CharSequence,String>> headers)Description copied from class:AbstractHttpRequestBuilder
Adds multiple headers for this request. For example:HttpRequest.builder() .get("/") .headers(HttpHeaders.of("authorization", "foo", "bar", "baz")) .build();
- Overrides:
headers
in classAbstractHttpRequestBuilder
- See Also:
HttpHeaders
-
trailers
public HttpRequestBuilder trailers(Iterable<? extends Map.Entry<? extends CharSequence,String>> trailers)Description copied from class:AbstractHttpRequestBuilder
Sets HTTP trailers for this request.- Overrides:
trailers
in classAbstractHttpRequestBuilder
-
pathParam
Description copied from class:AbstractHttpRequestBuilder
Sets a path param for this request. For example:HttpRequest.builder() .get("/{foo}") .pathParam("foo", "bar") .build(); // GET `/bar`
- Overrides:
pathParam
in classAbstractHttpRequestBuilder
-
pathParams
Description copied from class:AbstractHttpRequestBuilder
Sets multiple path params for this request. For example:HttpRequest.builder() .get("/{foo}/:bar") .pathParams(Map.of("foo", 1, "bar", 2)) .build(); // GET `/1/2`
- Overrides:
pathParams
in classAbstractHttpRequestBuilder
-
disablePathParams
Description copied from class:AbstractHttpRequestBuilder
Disables path parameters substitution. If path parameter is not disabled and a parameter's, specified using{}
or:
, value is not found, anIllegalStateException
is thrown.- Overrides:
disablePathParams
in classAbstractHttpRequestBuilder
-
queryParam
Description copied from class:AbstractHttpRequestBuilder
Sets a query param for this request. For example:HttpRequest.builder() .get("/endpoint") .queryParam("foo", "bar") .build(); // GET `/endpoint?foo=bar`
- Overrides:
queryParam
in classAbstractHttpRequestBuilder
-
queryParams
public HttpRequestBuilder queryParams(Iterable<? extends Map.Entry<? extends String,String>> queryParams)Description copied from class:AbstractHttpRequestBuilder
Sets multiple query params for this request. For example:HttpRequest.builder() .get("/endpoint") .queryParams(QueryParams.of("from", "foo", "limit", 10)) .build(); // GET `/endpoint?from=foo&limit=10`
- Overrides:
queryParams
in classAbstractHttpRequestBuilder
- See Also:
QueryParams
-
cookie
Description copied from class:AbstractHttpRequestBuilder
Sets a cookie for this request. For example:HttpRequest.builder() .get("/") .cookie(Cookie.of("cookie", "foo")) .build();
- Overrides:
cookie
in classAbstractHttpRequestBuilder
- See Also:
Cookie
-
cookies
Description copied from class:AbstractHttpRequestBuilder
Sets multiple cookies for this request. For example:HttpRequest.builder() .get("/") .cookies(Cookies.of(Cookie.of("cookie1", "foo"), Cookie.of("cookie2", "bar"))) .build();
- Overrides:
cookies
in classAbstractHttpRequestBuilder
- See Also:
Cookies
-