Class ImmediateByteBody
java.lang.Object
io.micronaut.http.server.netty.body.ImmediateByteBody
Fully buffered
ByteBody
, all operations are eager.- Since:
- 4.0.0
- Author:
- Jonas Konrad
-
Method Summary
Modifier and TypeMethodDescriptionbuffer
(io.netty.buffer.ByteBufAllocator alloc) Fully buffer this body.io.netty.handler.codec.http.HttpRequest
claimForReuse
(io.netty.handler.codec.http.HttpRequest request) Claim this body and convert it back to aHttpRequest
.io.netty.buffer.ByteBuf
boolean
empty()
next()
Get the next representation this body was transformed into, if any.processMulti
(FormDataHttpContentProcessor processor) Process this body using the given processor.
Only used for form processing now.processSingle
(HttpServerConfiguration configuration, MessageBodyReader<T> reader, Argument<T> type, MediaType mediaType, Headers httpHeaders) Process this body using the givenMessageBodyReader
.processSingle
(FormDataHttpContentProcessor processor, Charset defaultCharset, io.netty.buffer.ByteBufAllocator alloc) Process this body and then transform it into a single object usingImmediateMultiObjectBody.single(java.nio.charset.Charset, io.netty.buffer.ByteBufAllocator)
.
Only used for form processing now.rawContent
(HttpServerConfiguration configuration) Transform this body to aMultiObjectBody
containingByteBuf
s with the raw body.final void
release()
Release this body and any downstream representations.
-
Method Details
-
processMulti
Description copied from interface:ByteBody
Process this body using the given processor.
Only used for form processing now.- Specified by:
processMulti
in interfaceByteBody
- Parameters:
processor
- The processor to apply- Returns:
- The new processed body
- Throws:
Throwable
- Any exception thrown by the processor. Not all processing failures may throw immediately, however
-
rawContent
public ImmediateSingleObjectBody rawContent(HttpServerConfiguration configuration) throws ContentLengthExceededException Description copied from interface:ByteBody
Transform this body to aMultiObjectBody
containingByteBuf
s with the raw body. There is a check againstHttpServerConfiguration.getMaxRequestSize()
.- Specified by:
rawContent
in interfaceByteBody
- Parameters:
configuration
- The configuration for request size limits- Returns:
- The body containing
ByteBuf
s - Throws:
ContentLengthExceededException
- If the content length exceeds the configured request size. May also appear delayed forStreamingMultiObjectBody
-
processSingle
public ImmediateSingleObjectBody processSingle(FormDataHttpContentProcessor processor, Charset defaultCharset, io.netty.buffer.ByteBufAllocator alloc) throws Throwable Process this body and then transform it into a single object usingImmediateMultiObjectBody.single(java.nio.charset.Charset, io.netty.buffer.ByteBufAllocator)
.
Only used for form processing now.- Parameters:
processor
- The processordefaultCharset
- The default charset (seeImmediateMultiObjectBody.single(java.nio.charset.Charset, io.netty.buffer.ByteBufAllocator)
)alloc
- The buffer allocator (seeImmediateMultiObjectBody.single(java.nio.charset.Charset, io.netty.buffer.ByteBufAllocator)
)- Returns:
- The processed object
- Throws:
Throwable
- Any failure
-
processSingle
public <T> ImmediateSingleObjectBody processSingle(HttpServerConfiguration configuration, MessageBodyReader<T> reader, Argument<T> type, MediaType mediaType, Headers httpHeaders) Process this body using the givenMessageBodyReader
.- Type Parameters:
T
- The type to parse to- Parameters:
configuration
- The server configuration. Used for checking body length restrictionsreader
- The readertype
- The type to parse tomediaType
- The request media typehttpHeaders
- The request headers- Returns:
- The parsed value
-
buffer
Description copied from interface:ByteBody
Fully buffer this body. -
contentUnclaimed
public io.netty.buffer.ByteBuf contentUnclaimed() -
claimForReuse
public io.netty.handler.codec.http.HttpRequest claimForReuse(io.netty.handler.codec.http.HttpRequest request) Description copied from interface:ByteBody
Claim this body and convert it back to aHttpRequest
. This is used for proxying, where the request received by the server is reused by the client.- Specified by:
claimForReuse
in interfaceByteBody
- Parameters:
request
- The input request (headers and such)- Returns:
- The request including the body, either a
FullHttpRequest
or aStreamedHttpRequest
-
empty
public boolean empty() -
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.
-