Package com.linecorp.armeria.client
Class WebClientRequestPreparation
java.lang.Object
com.linecorp.armeria.common.AbstractHttpRequestBuilder
com.linecorp.armeria.client.WebClientRequestPreparation
public final class WebClientRequestPreparation extends AbstractHttpRequestBuilder
Prepares and executes a new
HttpRequest
for WebClient
.-
Method Summary
Modifier and Type Method Description <V> WebClientRequestPreparation
attr(AttributeKey<V> key, V value)
WebClientRequestPreparation
content(MediaType contentType, byte[] content)
Sets the content for this request.WebClientRequestPreparation
content(MediaType contentType, HttpData content)
Sets the content for this request.WebClientRequestPreparation
content(MediaType contentType, CharSequence content)
Sets the content for this request.WebClientRequestPreparation
content(MediaType contentType, String content)
Sets the content for this request.WebClientRequestPreparation
content(MediaType contentType, String format, Object... content)
Sets the content for this request.WebClientRequestPreparation
content(MediaType contentType, org.reactivestreams.Publisher<? extends HttpData> publisher)
Sets thePublisher
for this request.WebClientRequestPreparation
cookie(Cookie cookie)
Sets a cookie for this request.WebClientRequestPreparation
cookies(Iterable<? extends Cookie> cookies)
Sets multiple cookies for this request.WebClientRequestPreparation
delete(String path)
Shortcut to set DELETE method and path.WebClientRequestPreparation
disablePathParams()
Disables path parameters substitution.HttpResponse
execute()
Builds and executes the request.WebClientRequestPreparation
get(String path)
Shortcut to set GET method and path.WebClientRequestPreparation
head(String path)
Shortcut to set HEAD method and path.WebClientRequestPreparation
header(CharSequence name, Object value)
Adds a header for this request.WebClientRequestPreparation
headers(Iterable<? extends Map.Entry<? extends CharSequence,String>> headers)
Adds multiple headers for this request.WebClientRequestPreparation
maxResponseLength(long maxResponseLength)
WebClientRequestPreparation
method(HttpMethod method)
Sets the method for this request.WebClientRequestPreparation
options(String path)
Shortcut to set OPTIONS method and path.WebClientRequestPreparation
patch(String path)
Shortcut to set PATCH method and path.WebClientRequestPreparation
path(String path)
Sets the path for this request.WebClientRequestPreparation
pathParam(String name, Object value)
Sets a path param for this request.WebClientRequestPreparation
pathParams(Map<String,?> pathParams)
Sets multiple path params for this request.WebClientRequestPreparation
post(String path)
Shortcut to set POST method and path.WebClientRequestPreparation
put(String path)
Shortcut to set PUT method and path.WebClientRequestPreparation
queryParam(String name, Object value)
Sets a query param for this request.WebClientRequestPreparation
queryParams(Iterable<? extends Map.Entry<? extends String,String>> queryParams)
Sets multiple query params for this request.WebClientRequestPreparation
requestOptions(RequestOptions requestOptions)
Sets the specifiedRequestOptions
that could overwrite the previously configured values such asresponseTimeout(Duration)
,writeTimeout(Duration)
,maxResponseLength(long)
andattr(AttributeKey, Object)
.WebClientRequestPreparation
responseTimeout(Duration responseTimeout)
WebClientRequestPreparation
responseTimeoutMillis(long responseTimeoutMillis)
WebClientRequestPreparation
trace(String path)
Shortcut to set TRACE method and path.WebClientRequestPreparation
trailers(Iterable<? extends Map.Entry<? extends CharSequence,String>> trailers)
Sets HTTP trailers for this request.WebClientRequestPreparation
writeTimeout(Duration writeTimeout)
WebClientRequestPreparation
writeTimeoutMillis(long writeTimeoutMillis)
Methods inherited from class com.linecorp.armeria.common.AbstractHttpRequestBuilder
buildRequest
-
Method Details
-
execute
Builds and executes the request. -
requestOptions
Sets the specifiedRequestOptions
that could overwrite the previously configured values such asresponseTimeout(Duration)
,writeTimeout(Duration)
,maxResponseLength(long)
andattr(AttributeKey, Object)
. -
responseTimeout
-
responseTimeoutMillis
-
writeTimeout
-
writeTimeoutMillis
-
maxResponseLength
-
attr
-
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 WebClientRequestPreparation 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 WebClientRequestPreparation 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 WebClientRequestPreparation 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 WebClientRequestPreparation 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 WebClientRequestPreparation 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
-