Package com.linecorp.armeria.common
Interface HttpRequestSetters
- All Superinterfaces:
HttpMessageSetters
,PathAndQueryParamSetters
,RequestMethodSetters
- All Known Implementing Classes:
AbstractHttpRequestBuilder
,HttpRequestBuilder
,WebClientRequestPreparation
@UnstableApi
public interface HttpRequestSetters
extends RequestMethodSetters, PathAndQueryParamSetters, HttpMessageSetters
Sets properties for building an
HttpRequest
.-
Method Summary
Modifier and TypeMethodDescriptionSets 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 the content as UTF-8 for this request.Sets the content as UTF-8 for this request.Sets thePublisher
for this request.contentJson
(Object content) Sets the content for this request.Sets a cookie for this request.Sets multiple cookies for this request.Disables path parameters substitution.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.Sets a path param for this request.pathParams
(Map<String, ?> pathParams) Sets multiple path params for this request.queryParam
(String name, Object value) Adds a query param for this request.queryParams
(Iterable<? extends Map.Entry<? extends String, String>> queryParams) Adds multiple query params for this request.trailers
(Iterable<? extends Map.Entry<? extends CharSequence, String>> trailers) Sets HTTP trailers for this request.Methods inherited from interface com.linecorp.armeria.common.HttpMessageSetters
trailer
-
Method Details
-
content
Sets the content as UTF-8 for this request.- Specified by:
content
in interfaceHttpMessageSetters
-
content
Sets the content for this request.- Specified by:
content
in interfaceHttpMessageSetters
-
content
Sets the content for this request.- Specified by:
content
in interfaceHttpMessageSetters
-
content
Sets the content as UTF-8 for this request. Thecontent
is formatted byString.format(Locale, String, Object...)
with English locale.- Specified by:
content
in interfaceHttpMessageSetters
-
content
@FormatMethod HttpRequestSetters content(MediaType contentType, @FormatString String format, Object... content) Sets the content for this request. Thecontent
is formatted byString.format(Locale, String, Object...)
with English locale.- Specified by:
content
in interfaceHttpMessageSetters
-
content
Sets the content for this request. Thecontent
will be wrapped usingHttpData.wrap(byte[])
, so any changes made tocontent
will be reflected in the request.- Specified by:
content
in interfaceHttpMessageSetters
-
content
Sets the content for this request.- Specified by:
content
in interfaceHttpMessageSetters
-
content
Sets thePublisher
for this request.- Specified by:
content
in interfaceHttpMessageSetters
-
content
HttpRequestSetters content(MediaType contentType, org.reactivestreams.Publisher<? extends HttpData> content) Sets thePublisher
for this request.- Specified by:
content
in interfaceHttpMessageSetters
-
contentJson
Sets the content for this request. Thecontent
is converted into JSON format using the defaultObjectMapper
.- Specified by:
contentJson
in interfaceHttpMessageSetters
-
header
Adds a header for this request. For example:HttpRequest.builder() .get("/") .header("authorization", "foo") .build();
- Specified by:
header
in interfaceHttpMessageSetters
-
headers
Adds multiple headers for this request. For example:HttpRequest.builder() .get("/") .headers(HttpHeaders.of("authorization", "foo", "bar", "baz")) .build();
- Specified by:
headers
in interfaceHttpMessageSetters
- See Also:
-
trailers
Sets HTTP trailers for this request.- Specified by:
trailers
in interfaceHttpMessageSetters
-
pathParam
Sets a path param for this request. For example:HttpRequest.builder() .get("/{foo}") .pathParam("foo", "bar") .build(); // GET `/bar`
- Specified by:
pathParam
in interfacePathAndQueryParamSetters
-
pathParams
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`
- Specified by:
pathParams
in interfacePathAndQueryParamSetters
-
disablePathParams
HttpRequestSetters disablePathParams()Disables path parameters substitution. If path parameter is not disabled and a parameter's, specified using{}
or:
, value is not found, anIllegalStateException
is thrown.- Specified by:
disablePathParams
in interfacePathAndQueryParamSetters
-
queryParam
Adds a query param for this request. For example:HttpRequest.builder() .get("/endpoint") .queryParam("foo", "bar") .build(); // GET `/endpoint?foo=bar`
- Specified by:
queryParam
in interfacePathAndQueryParamSetters
-
queryParams
Adds 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`
- Specified by:
queryParams
in interfacePathAndQueryParamSetters
- See Also:
-
cookie
Sets a cookie for this request. For example:HttpRequest.builder() .get("/") .cookie(Cookie.ofSecure("cookie", "foo")) .build();
- Specified by:
cookie
in interfaceHttpMessageSetters
- See Also:
-
cookies
Sets multiple cookies for this request. For example:HttpRequest.builder() .get("/") .cookies(Cookies.ofSecure(Cookie.ofSecure("cookie1", "foo"), Cookie.ofSecure("cookie2", "bar"))) .build();
- Specified by:
cookies
in interfaceHttpMessageSetters
- See Also:
-