Class StreamFileBodyWriter
java.lang.Object
io.micronaut.http.server.netty.body.StreamFileBodyWriter
- All Implemented Interfaces:
MessageBodyWriter<StreamedFile>,NettyBodyWriter<StreamedFile>
@Singleton
@Internal
public final class StreamFileBodyWriter
extends Object
implements NettyBodyWriter<StreamedFile>
Body writer for
StreamedFiles.- Since:
- 4.0.0
- Author:
- Graeme Rocher
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final NettyHttpServerConfiguration.FileTypeHandlerConfiguration -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanhandleIfModifiedAndHeaders(HttpRequest<?> request, MutableHttpResponse<?> response, FileCustomizableResponseType systemFile, NettyMutableHttpResponse<?> nettyResponse) protected io.netty.handler.codec.http.FullHttpResponsenotModified(MutableHttpResponse<?> originalResponse) protected voidsetDateAndCacheHeaders(MutableHttpResponse response, long lastModified) protected voidsetDateHeader(MutableHttpResponse response) voidwriteTo(Argument<StreamedFile> type, MediaType mediaType, StreamedFile object, MutableHeaders outgoingHeaders, OutputStream outputStream) Writes an object to the given output stream.voidwriteTo(HttpRequest<?> request, MutableHttpResponse<StreamedFile> outgoingResponse, Argument<StreamedFile> type, MediaType mediaType, StreamedFile object, NettyWriteContext nettyContext) Write an object to the given context.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.http.body.MessageBodyWriter
createSpecific, isBlocking, isWriteable, writeTo
-
Field Details
-
configuration
-
-
Method Details
-
writeTo
public void writeTo(HttpRequest<?> request, MutableHttpResponse<StreamedFile> outgoingResponse, Argument<StreamedFile> type, MediaType mediaType, StreamedFile object, NettyWriteContext nettyContext) throws CodecException Description copied from interface:NettyBodyWriterWrite an object to the given context.- Specified by:
writeToin interfaceNettyBodyWriter<StreamedFile>- 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<StreamedFile> type, MediaType mediaType, StreamedFile object, MutableHeaders outgoingHeaders, OutputStream outputStream) throws CodecException Description copied from interface:MessageBodyWriterWrites an object to the given output stream.- Specified by:
writeToin interfaceMessageBodyWriter<StreamedFile>- Parameters:
type- The typemediaType- The media typeobject- The object to writeoutgoingHeaders- The HTTP headersoutputStream- The output stream- Throws:
CodecException- If an error occurs decoding
-
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)
-