Package io.micronaut.http.netty.body
Interface NettyWriteContext
@Internal
public interface NettyWriteContext
This interface is used to write the different kinds of netty responses.
- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescription@NonNull io.netty.buffer.ByteBufAllocatoralloc()voidwriteChunked(@NonNull io.netty.handler.codec.http.HttpResponse response, @NonNull io.netty.handler.codec.http.HttpChunkedInput chunkedInput) Write a response with aHttpChunkedInputbody.voidwriteFile(@NonNull io.netty.handler.codec.http.HttpResponse response, @NonNull RandomAccessFile randomAccessFile, long position, long contentLength) Write a response with a body that is a section of aRandomAccessFile.voidwriteFull(@NonNull io.netty.handler.codec.http.FullHttpResponse response) Write a full response.voidwriteStreamed(@NonNull io.netty.handler.codec.http.HttpResponse response, @NonNull org.reactivestreams.Publisher<io.netty.handler.codec.http.HttpContent> content) Write a streamed response.
-
Method Details
-
alloc
@NonNull @NonNull io.netty.buffer.ByteBufAllocator alloc()- Returns:
- The bytebuf allocator.
-
writeFull
void writeFull(@NonNull @NonNull io.netty.handler.codec.http.FullHttpResponse response) Write a full response.- Parameters:
response- The response to write
-
writeStreamed
void writeStreamed(@NonNull @NonNull io.netty.handler.codec.http.HttpResponse response, @NonNull @NonNull org.reactivestreams.Publisher<io.netty.handler.codec.http.HttpContent> content) Write a streamed response.- Parameters:
response- The response to writecontent- The body
-
writeChunked
void writeChunked(@NonNull @NonNull io.netty.handler.codec.http.HttpResponse response, @NonNull @NonNull io.netty.handler.codec.http.HttpChunkedInput chunkedInput) Write a response with aHttpChunkedInputbody.- Parameters:
response- The response. Must not be aFullHttpResponsechunkedInput- The response body
-
writeFile
void writeFile(@NonNull @NonNull io.netty.handler.codec.http.HttpResponse response, @NonNull @NonNull RandomAccessFile randomAccessFile, long position, long contentLength) Write a response with a body that is a section of aRandomAccessFile.- Parameters:
response- The response. Must not be aFullHttpResponserandomAccessFile- File to read fromposition- Start positioncontentLength- Length of the section to send
-