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
- Author:
- Jonas Konrad
-
Method Summary
Modifier and TypeMethodDescriptionbuffer(io.netty.buffer.ByteBufAllocator alloc) Fully buffer this body.io.netty.handler.codec.http.HttpRequestclaimForReuse(io.netty.handler.codec.http.HttpRequest request) Claim this body and convert it back to aHttpRequest.static ByteBodyempty()Create an empty byte body.static ByteBodyof(HotObservable<io.netty.handler.codec.http.HttpContent> content, long contentLength) Create a new byte body containing the given streamed content.static ByteBodyof(io.netty.buffer.ByteBuf content) Create a new byte body containing the given immediate content.processMulti(FormDataHttpContentProcessor processor) Process this body using the given processor.
Only used for form processing now.rawContent(HttpServerConfiguration configuration) Transform this body to aMultiObjectBodycontainingByteBufs with the raw body.
-
Method Details
-
processMulti
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(HttpServerConfiguration configuration) throws ContentLengthExceededException Transform this body to aMultiObjectBodycontainingByteBufs with the raw body. There is a check againstHttpServerConfiguration.getMaxRequestSize().- Parameters:
configuration- The configuration for request size limits- Returns:
- The body containing
ByteBufs - Throws:
ContentLengthExceededException- If the content length exceeds the configured request size. May also appear delayed forStreamingMultiObjectBody
-
buffer
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 aHttpRequest. 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
FullHttpRequestor aStreamedHttpRequest
-
of
Create a new byte body containing the given immediate content. Release ownership is transferred to the returned body.- Parameters:
content- The content- Returns:
- The ByteBody with the content
-
of
static ByteBody of(HotObservable<io.netty.handler.codec.http.HttpContent> content, long contentLength) Create a new byte body containing the given streamed content.- Parameters:
content- The publisher of HttpContentcontentLength- The advertised content length, or -1 if unknown- Returns:
- The streaming body
-
empty
Create an empty byte body.- Returns:
- An empty body
-