- 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 TypeMethodDescriptionTransforms the payload publisher to subscribe to the specified publisher after payload publisher completion.Transforms the payload publisher to subscribe to the specified publisher before subscribing to the payload publisher.<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 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 payload publisher.
- Specified by:
transform
in interfaceRequestBody
- Parameters:
transformer
- a payload publisher transformer- Returns:
- the request body
-
before
Description copied from interface:RequestBody
Transforms the payload publisher to subscribe to the specified publisher before subscribing to the payload publisher.
This basically allows to perform actions before the request is actually sent.
- Specified by:
before
in interfaceRequestBody
- Parameters:
before
- the publisher to subscribe before the request body publisher- Returns:
- the request body
-
after
Description copied from interface:RequestBody
Transforms the payload publisher to subscribe to the specified publisher after payload publisher completion.
This basically allows to perform actions after the request has been sent.
- Specified by:
after
in interfaceRequestBody
- Parameters:
after
- the publisher to subscribe before the request body publisher- 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
-