Class SystemFileBodyWriter
java.lang.Object
io.micronaut.http.server.netty.body.SystemFileBodyWriter
- All Implemented Interfaces:
MessageBodyWriter<SystemFile>
,NettyBodyWriter<SystemFile>
@Singleton
@Internal
public final class SystemFileBodyWriter
extends Object
implements NettyBodyWriter<SystemFile>
Body writer for
SystemFile
s.- Since:
- 4.0.0
- Author:
- Graeme Rocher
-
Field Summary
Modifier and TypeFieldDescriptionprotected final NettyHttpServerConfiguration.FileTypeHandlerConfiguration
-
Constructor Summary
ConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
handleIfModifiedAndHeaders
(HttpRequest<?> request, MutableHttpResponse<?> response, FileCustomizableResponseType systemFile, NettyMutableHttpResponse<?> nettyResponse) protected io.netty.handler.codec.http.FullHttpResponse
notModified
(MutableHttpResponse<?> originalResponse) protected void
setDateAndCacheHeaders
(MutableHttpResponse response, long lastModified) protected void
setDateHeader
(MutableHttpResponse response) void
writeTo
(Argument<SystemFile> type, MediaType mediaType, SystemFile file, MutableHeaders outgoingHeaders, OutputStream outputStream) Writes an object to the given output stream.void
writeTo
(HttpRequest<?> request, MutableHttpResponse<SystemFile> outgoingResponse, Argument<SystemFile> type, MediaType mediaType, SystemFile object, NettyWriteContext nettyContext) Write an object to the given context.void
writeTo
(HttpRequest<?> request, MutableHttpResponse<SystemFile> response, SystemFile systemFile, NettyWriteContext nettyContext) 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.body.MessageBodyWriter
createSpecific, isBlocking, isWriteable, writeTo
-
Field Details
-
configuration
-
-
Constructor Details
-
SystemFileBodyWriter
public SystemFileBodyWriter(NettyHttpServerConfiguration.FileTypeHandlerConfiguration configuration)
-
-
Method Details
-
writeTo
public void writeTo(HttpRequest<?> request, MutableHttpResponse<SystemFile> outgoingResponse, Argument<SystemFile> type, MediaType mediaType, SystemFile object, NettyWriteContext nettyContext) throws CodecException Description copied from interface:NettyBodyWriter
Write an object to the given context.- Specified by:
writeTo
in interfaceNettyBodyWriter<SystemFile>
- Parameters:
request
- The associated requestoutgoingResponse
- The outgoing response.type
- The typemediaType
- The media typeobject
- The object to writenettyContext
- The netty context- Throws:
CodecException
- If an error occurs decoding
-
writeTo
public void writeTo(Argument<SystemFile> type, MediaType mediaType, SystemFile file, MutableHeaders outgoingHeaders, OutputStream outputStream) throws CodecException Description copied from interface:MessageBodyWriter
Writes an object to the given output stream.- Specified by:
writeTo
in interfaceMessageBodyWriter<SystemFile>
- Parameters:
type
- The typemediaType
- The media typefile
- The object to writeoutgoingHeaders
- The HTTP headersoutputStream
- The output stream- Throws:
CodecException
- If an error occurs decoding
-
writeTo
public void writeTo(HttpRequest<?> request, MutableHttpResponse<SystemFile> response, SystemFile systemFile, NettyWriteContext nettyContext) throws CodecException - Throws:
CodecException
-
handleIfModifiedAndHeaders
protected boolean handleIfModifiedAndHeaders(HttpRequest<?> request, MutableHttpResponse<?> response, FileCustomizableResponseType systemFile, NettyMutableHttpResponse<?> nettyResponse) -
setDateAndCacheHeaders
- Parameters:
response
- The Http responselastModified
- The last modified
-
setDateHeader
- Parameters:
response
- The Http response
-
notModified
protected io.netty.handler.codec.http.FullHttpResponse notModified(MutableHttpResponse<?> originalResponse)
-