Package com.linecorp.armeria.common
Interface HttpRequestSetters
- All Known Implementing Classes:
AbstractHttpRequestBuilder
,BlockingWebClientRequestPreparation
,FutureTransformingRequestPreparation
,HttpRequestBuilder
,TransformingRequestPreparation
,WebClientRequestPreparation
public interface HttpRequestSetters
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.contentJson
(Object content) Sets the content 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) Adds a query param for this request.queryParams
(Iterable<? extends Map.Entry<? extends String, String>> queryParams) Adds 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.
-
Method Details
-
get
Shortcut to set GET method and path. -
post
Shortcut to set POST method and path. -
put
Shortcut to set PUT method and path. -
delete
Shortcut to set DELETE method and path. -
patch
Shortcut to set PATCH method and path. -
options
Shortcut to set OPTIONS method and path. -
head
Shortcut to set HEAD method and path. -
trace
Shortcut to set TRACE method and path. -
method
Sets the method for this request.- See Also:
-
path
Sets the path for this request. -
content
Sets the content as UTF_8 for this request. -
content
Sets the content for this request. -
content
Sets the content for this request. -
content
Sets the content as UTF_8 for this request. Thecontent
is formatted byString.format(Locale, String, Object...)
with English locale. -
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. -
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. -
content
Sets the content for this request. -
content
HttpRequestSetters content(MediaType contentType, org.reactivestreams.Publisher<? extends HttpData> content) Sets thePublisher
for this request. -
contentJson
Sets the content for this request. Thecontent
is converted into JSON format using the defaultObjectMapper
. -
header
Adds a header for this request. For example:HttpRequest.builder() .get("/") .header("authorization", "foo") .build();
-
headers
Adds multiple headers for this request. For example:HttpRequest.builder() .get("/") .headers(HttpHeaders.of("authorization", "foo", "bar", "baz")) .build();
- See Also:
-
trailers
Sets HTTP trailers for this request. -
pathParam
Sets a path param for this request. For example:HttpRequest.builder() .get("/{foo}") .pathParam("foo", "bar") .build(); // GET `/bar`
-
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`
-
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. -
queryParam
Adds a query param for this request. For example:HttpRequest.builder() .get("/endpoint") .queryParam("foo", "bar") .build(); // GET `/endpoint?foo=bar`
-
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`
- See Also:
-
cookie
Sets a cookie for this request. For example:HttpRequest.builder() .get("/") .cookie(Cookie.ofSecure("cookie", "foo")) .build();
- 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();
- See Also:
-