Interface MultiObjectBody
- All Superinterfaces:
HttpBody
- All Known Implementing Classes:
ImmediateMultiObjectBody
,ImmediateSingleObjectBody
,StreamingMultiObjectBody
@Internal
public sealed interface MultiObjectBody
extends HttpBody
permits ImmediateMultiObjectBody, ImmediateSingleObjectBody, StreamingMultiObjectBody
A body consisting of multiple objects of arbitrary type. Basically a
Publisher
<?>
. This class is so generic for compatibility reasons, it's the
result of processing a ByteBody
using a
HttpContentProcessor
.- Since:
- 4.0.0
- Author:
- Jonas Konrad
-
Method Summary
Modifier and TypeMethodDescriptionPublisher<?>
Get this value as a publisher.coerceToInputStream
(io.netty.buffer.ByteBufAllocator alloc) Coerce this value to anInputStream
.void
handleForm
(FormRouteCompleter formRouteCompleter) Special handling for form data.mapNotNull
(Function<Object, Object> transform) Apply a mapping function to all objects in this body.
-
Method Details
-
coerceToInputStream
Coerce this value to anInputStream
. This implementsNettyInputStreamBodyBinder
. Requires the objects of this body to beByteBuf
s.
Ownership is transferred to the stream, it must be closed to release all buffers.- Parameters:
alloc
- The buffer allocator to use- Returns:
- The stream that reads the data in this body
-
asPublisher
Publisher<?> asPublisher()Get this value as a publisher. The publisher must be subscribed to exactly once. All objects forwarded to the subscriber become its responsibility and must be released by the subscriber.- Returns:
- The publisher
-
mapNotNull
Apply a mapping function to all objects in this body.null
values in the output are skipped.- Parameters:
transform
- The mapping function- Returns:
- A new body with the mapped values
-
handleForm
Special handling for form data. This method basically acts likeasPublisher().subscribe(formRouteCompleter)
. However,FormRouteCompleter
needs to release the form data fields when the request is destroyed. To do this, it implementsHttpBody.release()
. By calling this method, theFormRouteCompleter
is registered as thenext body
and will be released.- Parameters:
formRouteCompleter
- The form route completer that should take over processing
-