Class PipeliningServerHandler.OutboundAccess
java.lang.Object
io.micronaut.http.server.netty.handler.PipeliningServerHandler.OutboundAccess
- All Implemented Interfaces:
NettyWriteContext
- Enclosing class:
- PipeliningServerHandler
public final class PipeliningServerHandler.OutboundAccess
extends Object
implements NettyWriteContext
Class that allows writing the response for the request this object is associated with.
-
Method Summary
Modifier and TypeMethodDescriptionio.netty.buffer.ByteBufAllocator
alloc()
void
attachment
(Object attachment) Set an attachment that is passed toRequestHandler.responseWritten(java.lang.Object)
.void
Mark this channel to be closed after this response has been written.void
writeChunked
(io.netty.handler.codec.http.HttpResponse response, io.netty.handler.codec.http.HttpChunkedInput chunkedInput) Write a response with aHttpChunkedInput
body.void
writeFile
(io.netty.handler.codec.http.HttpResponse response, RandomAccessFile randomAccessFile, long position, long contentLength) Write a response with a body that is a section of aRandomAccessFile
.void
writeFull
(io.netty.handler.codec.http.FullHttpResponse response, boolean headResponse) Write a full response.void
writeStreamed
(io.netty.handler.codec.http.HttpResponse response, Publisher<io.netty.handler.codec.http.HttpContent> content) Write a streamed response.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.http.netty.body.NettyWriteContext
writeFull
-
Method Details
-
alloc
public io.netty.buffer.ByteBufAllocator alloc()- Specified by:
alloc
in interfaceNettyWriteContext
- Returns:
- The bytebuf allocator.
-
attachment
Set an attachment that is passed toRequestHandler.responseWritten(java.lang.Object)
. Defaults tonull
.- Parameters:
attachment
- The attachment to forward
-
closeAfterWrite
public void closeAfterWrite()Mark this channel to be closed after this response has been written. -
writeFull
public void writeFull(io.netty.handler.codec.http.FullHttpResponse response, boolean headResponse) Description copied from interface:NettyWriteContext
Write a full response.- Specified by:
writeFull
in interfaceNettyWriteContext
- Parameters:
response
- The response to writeheadResponse
- Iftrue
, this is a response to aHEAD
request, so theContent-Length
header should not be overwritten.
-
writeStreamed
public void writeStreamed(io.netty.handler.codec.http.HttpResponse response, Publisher<io.netty.handler.codec.http.HttpContent> content) Description copied from interface:NettyWriteContext
Write a streamed response.- Specified by:
writeStreamed
in interfaceNettyWriteContext
- Parameters:
response
- The response to writecontent
- The body
-
writeChunked
public void writeChunked(io.netty.handler.codec.http.HttpResponse response, io.netty.handler.codec.http.HttpChunkedInput chunkedInput) Description copied from interface:NettyWriteContext
Write a response with aHttpChunkedInput
body.- Specified by:
writeChunked
in interfaceNettyWriteContext
- Parameters:
response
- The response. Must not be aFullHttpResponse
chunkedInput
- The response body
-
writeFile
public void writeFile(io.netty.handler.codec.http.HttpResponse response, RandomAccessFile randomAccessFile, long position, long contentLength) Description copied from interface:NettyWriteContext
Write a response with a body that is a section of aRandomAccessFile
.- Specified by:
writeFile
in interfaceNettyWriteContext
- Parameters:
response
- The response. Must not be aFullHttpResponse
randomAccessFile
- File to read fromposition
- Start positioncontentLength
- Length of the section to send
-