Class HttpRequestHandler

  • All Implemented Interfaces:
    org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler, org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler

    @Sharable
    public class HttpRequestHandler
    extends org.apache.flink.shaded.netty4.io.netty.channel.SimpleChannelInboundHandler<org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpObject>
    Simple code which handles all HTTP requests from the user, and passes them to the Router handler directly if they do not involve file upload requests. If a file is required to be uploaded, it handles the upload, and in the http request to the next handler, passes the name of the file to the next handler.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler

        org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler.Sharable
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void channelRead0​(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx, org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpObject msg)  
      void channelUnregistered​(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx)  
      static void checkAndCreateUploadDir​(File uploadDir)
      Checks whether the given directory exists and is writable.
      static void logExternalUploadDirDeletion​(File uploadDir)  
      • Methods inherited from class org.apache.flink.shaded.netty4.io.netty.channel.SimpleChannelInboundHandler

        acceptInboundMessage, channelRead
      • Methods inherited from class org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandlerAdapter

        channelActive, channelInactive, channelReadComplete, channelRegistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
      • Methods inherited from class org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerAdapter

        ensureNotSharable, handlerAdded, handlerRemoved, isSharable
      • Methods inherited from interface org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler

        handlerAdded, handlerRemoved
    • Constructor Detail

      • HttpRequestHandler

        public HttpRequestHandler​(File tmpDir)
    • Method Detail

      • channelUnregistered

        public void channelUnregistered​(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx)
                                 throws Exception
        Specified by:
        channelUnregistered in interface org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler
        Overrides:
        channelUnregistered in class org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandlerAdapter
        Throws:
        Exception
      • channelRead0

        public void channelRead0​(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx,
                                 org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpObject msg)
        Specified by:
        channelRead0 in class org.apache.flink.shaded.netty4.io.netty.channel.SimpleChannelInboundHandler<org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpObject>
      • logExternalUploadDirDeletion

        public static void logExternalUploadDirDeletion​(File uploadDir)
      • checkAndCreateUploadDir

        public static void checkAndCreateUploadDir​(File uploadDir)
                                            throws IOException
        Checks whether the given directory exists and is writable. If it doesn't exist this method will attempt to create it.
        Parameters:
        uploadDir - directory to check
        Throws:
        IOException - if the directory does not exist and cannot be created, or if the directory isn't writable