- All Superinterfaces:
RequestBody
A Web request body with payload encoding support.
Implementors should rely on MediaTypeConverter
to encode a payload based on the content type of the request.
- Since:
- 1.12
- Author:
- Jeremy Kuhn
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.inverno.mod.http.client.RequestBody
RequestBody.Multipart<A extends Part.Factory,
B extends Part<?>>, RequestBody.Resource, RequestBody.UrlEncoded<A extends Parameter.Factory> -
Method Summary
Modifier and TypeMethodDescription<T> OutboundDataEncoder
<T> encoder()
Returns an encoder to encode a payload based on the content type of the request.<T> OutboundDataEncoder
<T> Returns an encoder to encode a payload of the specified type based on the content type of the request.<T> OutboundDataEncoder
<T> Returns an encoder to encode a payload of the specified type based on the content type of the request.Returns a Multipart form data producer.Transforms the request payload publisher.Methods inherited from interface io.inverno.mod.http.client.RequestBody
empty, raw, resource, string, urlEncoded
-
Method Details
-
transform
Description copied from interface:RequestBody
Transforms the request payload publisher.
- Specified by:
transform
in interfaceRequestBody
- Parameters:
transformer
- a payload publisher transformer- Returns:
- the request body
-
encoder
Returns an encoder to encode a payload based on the content type of the request.
- Type Parameters:
T
- the type to encode- Returns:
- a data encoder
-
encoder
Returns an encoder to encode a payload of the specified type based on the content type of the request.
- Type Parameters:
T
- the type to encode- Parameters:
type
- a class of T- Returns:
- a data encoder
-
encoder
Returns an encoder to encode a payload of the specified type based on the content type of the request.
- Type Parameters:
T
- the type to encode- Parameters:
type
- the type to encode- Returns:
- a data encoder
-
multipart
RequestBody.Multipart<WebPartFactory,Part<?>> multipart()Description copied from interface:RequestBody
Returns a Multipart form data producer.
A typical usage is:
exchange.request().body().ifPresent(body -> body.multipart().from( (factory, output) -> output.stream(Flux.just( factory.string(part -> part.name("key").value("value")), factory.resource(part -> part .name("myfile") .headers(headers -> headers.contentType("application/json")) .value(new FileResource("sample.json"))) ))));
- Specified by:
multipart
in interfaceRequestBody
- Returns:
- a Multipart form data producer
-