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
  • Constructor Details

  • 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 interface NettyCustomizableResponseTypeHandler<Object>
      Parameters:
      obj - The object to be handled
      request - The native Netty request
      response - The mutable Micronaut response
      context - The channel context
      Returns:
      The channel future that completes when the response is fully written.
    • supports

      public boolean supports(Class<?> type)
      Specified by:
      supports in interface NettyCustomizableResponseTypeHandler<Object>
      Parameters:
      type - The type to check
      Returns:
      True if the handler supports handling the given type
    • setDateAndCacheHeaders

      protected void setDateAndCacheHeaders(MutableHttpResponse response, long lastModified)
      Parameters:
      response - The Http response
      lastModified - The last modified
    • setDateHeader

      protected void setDateHeader(MutableHttpResponse response)
      Parameters:
      response - The Http response