Interface ByteBody

All Superinterfaces:
HttpBody
All Known Implementing Classes:
ImmediateByteBody, StreamingByteBody

@Internal public sealed interface ByteBody extends HttpBody permits ImmediateByteBody, StreamingByteBody
Base class for a raw HttpBody with just bytes.
Since:
4.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    io.micronaut.core.execution.ExecutionFlow<ImmediateByteBody>
    buffer(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 a HttpRequest.
    static ByteBody
    of(io.netty.handler.codec.http.HttpRequest request)
    Create a byte body for the given request.
    Process this body using the given processor.
    Only used for form processing now.
    rawContent(io.micronaut.http.server.HttpServerConfiguration configuration)
    Transform this body to a MultiObjectBody containing ByteBufs with the raw body.

    Methods inherited from interface io.micronaut.http.server.netty.body.HttpBody

    next, release
  • Method Details

    • processMulti

      MultiObjectBody processMulti(FormDataHttpContentProcessor processor) throws Throwable
      Process this body using the given processor.
      Only used for form processing now.
      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

      MultiObjectBody rawContent(io.micronaut.http.server.HttpServerConfiguration configuration) throws io.micronaut.http.exceptions.ContentLengthExceededException
      Transform this body to a MultiObjectBody containing ByteBufs with the raw body. There is a check against HttpServerConfiguration.getMaxRequestSize().
      Parameters:
      configuration - The configuration for request size limits
      Returns:
      The body containing ByteBufs
      Throws:
      io.micronaut.http.exceptions.ContentLengthExceededException - If the content length exceeds the configured request size. May also appear delayed for StreamingMultiObjectBody
    • buffer

      io.micronaut.core.execution.ExecutionFlow<ImmediateByteBody> buffer(io.netty.buffer.ByteBufAllocator alloc)
      Fully buffer this body.
      Parameters:
      alloc - The allocator for storage
      Returns:
      A flow that completes when all data has been read
    • claimForReuse

      io.netty.handler.codec.http.HttpRequest claimForReuse(io.netty.handler.codec.http.HttpRequest request)
      Claim this body and convert it back to a HttpRequest. This is used for proxying, where the request received by the server is reused by the client.
      Parameters:
      request - The input request (headers and such)
      Returns:
      The request including the body, either a FullHttpRequest or a StreamedHttpRequest
    • of

      static ByteBody of(io.netty.handler.codec.http.HttpRequest request)
      Create a byte body for the given request. The request must be either a FullHttpRequest or a StreamedHttpRequest.
      Parameters:
      request - The request
      Returns:
      The ByteBody for the body data