Class FileTypeHandler
- java.lang.Object
-
- io.micronaut.http.server.netty.types.files.FileTypeHandler
-
- All Implemented Interfaces:
io.micronaut.core.order.Ordered,NettyCustomizableResponseTypeHandler<java.lang.Object>
@Internal public class FileTypeHandler extends java.lang.Object implements NettyCustomizableResponseTypeHandler<java.lang.Object>
Responsible for writing files out to the response in Netty.- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor Description FileTypeHandler(NettyHttpServerConfiguration.FileTypeHandlerConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.netty.channel.ChannelFuturehandle(java.lang.Object obj, io.micronaut.http.HttpRequest<?> request, io.micronaut.http.MutableHttpResponse<?> response, io.netty.channel.ChannelHandlerContext context)Responsible for fully handling the response, including any closing of the channel.protected voidsetDateAndCacheHeaders(io.micronaut.http.MutableHttpResponse response, long lastModified)protected voidsetDateHeader(io.micronaut.http.MutableHttpResponse response)booleansupports(java.lang.Class<?> type)
-
-
-
Constructor Detail
-
FileTypeHandler
public FileTypeHandler(NettyHttpServerConfiguration.FileTypeHandlerConfiguration configuration)
- Parameters:
configuration- The file type handler configuration
-
-
Method Detail
-
handle
public io.netty.channel.ChannelFuture handle(java.lang.Object obj, io.micronaut.http.HttpRequest<?> request, io.micronaut.http.MutableHttpResponse<?> response, io.netty.channel.ChannelHandlerContext context)Description copied from interface:NettyCustomizableResponseTypeHandlerResponsible for fully handling the response, including any closing of the channel.- Specified by:
handlein interfaceNettyCustomizableResponseTypeHandler<java.lang.Object>- Parameters:
obj- The object to be handledrequest- The native Netty requestresponse- The mutable Micronaut responsecontext- The channel context- Returns:
- The channel future that completes when the response is fully written.
-
supports
public boolean supports(java.lang.Class<?> type)
- Specified by:
supportsin interfaceNettyCustomizableResponseTypeHandler<java.lang.Object>- Parameters:
type- The type to check- Returns:
- True if the handler supports handling the given type
-
setDateAndCacheHeaders
protected void setDateAndCacheHeaders(io.micronaut.http.MutableHttpResponse response, long lastModified)- Parameters:
response- The Http responselastModified- The last modified
-
setDateHeader
protected void setDateHeader(io.micronaut.http.MutableHttpResponse response)
- Parameters:
response- The Http response
-
-