Class FileTypeHandler
java.lang.Object
io.micronaut.http.server.netty.types.files.FileTypeHandler
- All Implemented Interfaces:
Ordered
,NettyCustomizableResponseTypeHandler<Object>
@Internal
public class FileTypeHandler
extends Object
implements NettyCustomizableResponseTypeHandler<Object>
Responsible for writing files out to the response in Netty.
- Since:
- 1.0
- Author:
- James Kleeh
-
Field Summary
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionio.netty.channel.ChannelFuture
handle
(Object obj, HttpRequest<?> request, MutableHttpResponse<?> response, io.netty.channel.ChannelHandlerContext context) Responsible for fully handling the response, including any closing of the channel.protected void
setDateAndCacheHeaders
(MutableHttpResponse response, long lastModified) protected void
setDateHeader
(MutableHttpResponse response) boolean
-
Constructor Details
-
FileTypeHandler
- Parameters:
configuration
- The file type handler configuration
-
-
Method Details
-
handle
public io.netty.channel.ChannelFuture handle(Object obj, HttpRequest<?> request, MutableHttpResponse<?> response, io.netty.channel.ChannelHandlerContext context) Description copied from interface:NettyCustomizableResponseTypeHandler
Responsible for fully handling the response, including any closing of the channel.- Specified by:
handle
in interfaceNettyCustomizableResponseTypeHandler<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
- Specified by:
supports
in interfaceNettyCustomizableResponseTypeHandler<Object>
- Parameters:
type
- The type to check- Returns:
- True if the handler supports handling the given type
-
setDateAndCacheHeaders
- Parameters:
response
- The Http responselastModified
- The last modified
-
setDateHeader
- Parameters:
response
- The Http response
-