Class StreamingMultiObjectBody
java.lang.Object
io.micronaut.http.server.netty.body.StreamingMultiObjectBody
- All Implemented Interfaces:
HttpBody
,MultiObjectBody
MultiObjectBody
derived from a StreamingByteBody
. Operations are lazy.- Since:
- 4.0.0
- Author:
- Jonas Konrad
-
Constructor Summary
-
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.next()
Get the next representation this body was transformed into, if any.final void
release()
Release this body and any downstream representations.
-
Constructor Details
-
StreamingMultiObjectBody
-
-
Method Details
-
coerceToInputStream
Description copied from interface:MultiObjectBody
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.- Specified by:
coerceToInputStream
in interfaceMultiObjectBody
- Parameters:
alloc
- The buffer allocator to use- Returns:
- The stream that reads the data in this body
-
asPublisher
Description copied from interface:MultiObjectBody
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.- Specified by:
asPublisher
in interfaceMultiObjectBody
- Returns:
- The publisher
-
mapNotNull
Description copied from interface:MultiObjectBody
Apply a mapping function to all objects in this body.null
values in the output are skipped.- Specified by:
mapNotNull
in interfaceMultiObjectBody
- Parameters:
transform
- The mapping function- Returns:
- A new body with the mapped values
-
handleForm
Description copied from interface:MultiObjectBody
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.- Specified by:
handleForm
in interfaceMultiObjectBody
- Parameters:
formRouteCompleter
- The form route completer that should take over processing
-
release
public final void release()Description copied from interface:HttpBody
Release this body and any downstream representations. -
next
Description copied from interface:HttpBody
Get the next representation this body was transformed into, if any.
-