Package com.linecorp.armeria.client
Class TransformingRequestPreparation<T,R>
java.lang.Object
com.linecorp.armeria.client.TransformingRequestPreparation<T,R>
- All Implemented Interfaces:
HttpRequestSetters
Prepares and executes a new
HttpRequest
for a WebClient
or BlockingWebClient
, and
transforms an HttpResponse
into the T
type object.-
Method Summary
Modifier and TypeMethodDescription<U> TransformingRequestPreparation<T,
U> as
(ResponseAs<R, U> responseAs) Sets the specifiedResponseAs
that converts theT
type object into another.attr
(AttributeKey<V> key, V value) 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 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.execute()
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.maxResponseLength
(long maxResponseLength) 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.requestOptions
(RequestOptions requestOptions) responseTimeout
(Duration responseTimeout) responseTimeoutMillis
(long responseTimeoutMillis) Shortcut to set TRACE method and path.trailers
(Iterable<? extends Map.Entry<? extends CharSequence, String>> trailers) Sets HTTP trailers for this request.writeTimeout
(Duration writeTimeout) writeTimeoutMillis
(long writeTimeoutMillis)
-
Method Details
-
execute
-
requestOptions
-
as
Sets the specifiedResponseAs
that converts theT
type object into another. -
get
Description copied from interface:HttpRequestSetters
Shortcut to set GET method and path.- Specified by:
get
in interfaceHttpRequestSetters
-
post
Description copied from interface:HttpRequestSetters
Shortcut to set POST method and path.- Specified by:
post
in interfaceHttpRequestSetters
-
put
Description copied from interface:HttpRequestSetters
Shortcut to set PUT method and path.- Specified by:
put
in interfaceHttpRequestSetters
-
delete
Description copied from interface:HttpRequestSetters
Shortcut to set DELETE method and path.- Specified by:
delete
in interfaceHttpRequestSetters
-
patch
Description copied from interface:HttpRequestSetters
Shortcut to set PATCH method and path.- Specified by:
patch
in interfaceHttpRequestSetters
-
options
Description copied from interface:HttpRequestSetters
Shortcut to set OPTIONS method and path.- Specified by:
options
in interfaceHttpRequestSetters
-
head
Description copied from interface:HttpRequestSetters
Shortcut to set HEAD method and path.- Specified by:
head
in interfaceHttpRequestSetters
-
trace
Description copied from interface:HttpRequestSetters
Shortcut to set TRACE method and path.- Specified by:
trace
in interfaceHttpRequestSetters
-
method
Description copied from interface:HttpRequestSetters
Sets the method for this request.- Specified by:
method
in interfaceHttpRequestSetters
- See Also:
-
path
Description copied from interface:HttpRequestSetters
Sets the path for this request.- Specified by:
path
in interfaceHttpRequestSetters
-
content
Description copied from interface:HttpRequestSetters
Sets the content as UTF_8 for this request.- Specified by:
content
in interfaceHttpRequestSetters
-
content
Description copied from interface:HttpRequestSetters
Sets the content for this request.- Specified by:
content
in interfaceHttpRequestSetters
-
content
Description copied from interface:HttpRequestSetters
Sets the content for this request.- Specified by:
content
in interfaceHttpRequestSetters
-
content
Description copied from interface:HttpRequestSetters
Sets the content as UTF_8 for this request. Thecontent
is formatted byString.format(Locale, String, Object...)
with English locale.- Specified by:
content
in interfaceHttpRequestSetters
-
content
@FormatMethod public TransformingRequestPreparation<T,R> content(MediaType contentType, String format, Object... content) Description copied from interface:HttpRequestSetters
Sets the content for this request. Thecontent
is formatted byString.format(Locale, String, Object...)
with English locale.- Specified by:
content
in interfaceHttpRequestSetters
-
content
Description copied from interface:HttpRequestSetters
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 interfaceHttpRequestSetters
-
content
Description copied from interface:HttpRequestSetters
Sets the content for this request.- Specified by:
content
in interfaceHttpRequestSetters
-
content
public TransformingRequestPreparation<T,R> content(MediaType contentType, org.reactivestreams.Publisher<? extends HttpData> content) Description copied from interface:HttpRequestSetters
Sets thePublisher
for this request.- Specified by:
content
in interfaceHttpRequestSetters
-
contentJson
Description copied from interface:HttpRequestSetters
Sets the content for this request. Thecontent
is converted into JSON format using the defaultObjectMapper
.- Specified by:
contentJson
in interfaceHttpRequestSetters
-
header
Description copied from interface:HttpRequestSetters
Adds a header for this request. For example:HttpRequest.builder() .get("/") .header("authorization", "foo") .build();
- Specified by:
header
in interfaceHttpRequestSetters
-
headers
public TransformingRequestPreparation<T,R> headers(Iterable<? extends Map.Entry<? extends CharSequence, String>> headers) Description copied from interface:HttpRequestSetters
Adds multiple headers for this request. For example:HttpRequest.builder() .get("/") .headers(HttpHeaders.of("authorization", "foo", "bar", "baz")) .build();
- Specified by:
headers
in interfaceHttpRequestSetters
- See Also:
-
trailers
public TransformingRequestPreparation<T,R> trailers(Iterable<? extends Map.Entry<? extends CharSequence, String>> trailers) Description copied from interface:HttpRequestSetters
Sets HTTP trailers for this request.- Specified by:
trailers
in interfaceHttpRequestSetters
-
pathParam
Description copied from interface:HttpRequestSetters
Sets a path param for this request. For example:HttpRequest.builder() .get("/{foo}") .pathParam("foo", "bar") .build(); // GET `/bar`
- Specified by:
pathParam
in interfaceHttpRequestSetters
-
pathParams
Description copied from interface:HttpRequestSetters
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 interfaceHttpRequestSetters
-
disablePathParams
Description copied from interface:HttpRequestSetters
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 interfaceHttpRequestSetters
-
queryParam
Description copied from interface:HttpRequestSetters
Sets a query param for this request. For example:HttpRequest.builder() .get("/endpoint") .queryParam("foo", "bar") .build(); // GET `/endpoint?foo=bar`
- Specified by:
queryParam
in interfaceHttpRequestSetters
-
queryParams
public TransformingRequestPreparation<T,R> queryParams(Iterable<? extends Map.Entry<? extends String, String>> queryParams) Description copied from interface:HttpRequestSetters
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`
- Specified by:
queryParams
in interfaceHttpRequestSetters
- See Also:
-
cookie
Description copied from interface:HttpRequestSetters
Sets a cookie for this request. For example:HttpRequest.builder() .get("/") .cookie(Cookie.ofSecure("cookie", "foo")) .build();
- Specified by:
cookie
in interfaceHttpRequestSetters
- See Also:
-
cookies
Description copied from interface:HttpRequestSetters
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 interfaceHttpRequestSetters
- See Also:
-
responseTimeout
-
responseTimeoutMillis
-
writeTimeout
-
writeTimeoutMillis
-
maxResponseLength
-
attr
-