Annotation Interface Body


@Documented @Retention(SOURCE) @Target(PARAMETER) public @interface Body

Binds a request body to a Web route method parameter.

The type of the annotated parameter can be any of:

  • ByteBuf, Mono<ByteBuf>, Flux<ByteBuf> or Publisher<ByteBuf> to produce or consume raw data.
  • String, Mono<String>, Flux<String> or Publisher<String> to produce or consume string data.
  • T, Mono<T>, Flux<T> or Publisher<T> where type T is the type of application resource to produce or consume data encoded or decoded based on the request content type.

Server Web routes also accept:

  • Mono<Parameter>, Flux<Parameter> or Publisher<Parameter> to consume URL encoded form data.
  • Mono<T>, Flux<T> or Publisher<T> where type T is a super type of WebPart to consume multipart form data

Client Web route also accept:

  • Resource to send resources as request body in which case the request content type can be automatically deduced from the resource.

An encoded payload is encoded or decoded using a MediaTypeConverter corresponding to the content type specified in the request.

This annotation can't be used in conjunction with other parameters that specifies the request body format such as @FormParam.

Since:
1.0
Author:
Jeremy Kuhn
See Also: