Class BootHttpFileUploadHandler<T>

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.HttpObject>
org.summerboot.jexpress.nio.server.BootHttpFileUploadHandler<T>
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

public abstract class BootHttpFileUploadHandler<T> extends io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.HttpObject>
Author:
Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final boolean
     
    protected Caller
     
    protected final ServiceContext
     
    protected long
     
    protected static final io.netty.handler.codec.http.multipart.HttpDataFactory
     
    protected final long
     
    protected io.netty.handler.codec.http.multipart.HttpPostRequestDecoder
     
    protected boolean
     
    protected org.apache.logging.log4j.Logger
     
    protected Map<String,String>
     
    protected io.netty.handler.codec.http.multipart.HttpData
     
    protected io.netty.handler.codec.http.HttpRequest
     
    protected static final NioConfig
     
    protected static final boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract Caller
    authenticate(io.netty.handler.codec.http.HttpHeaders httpHeaders, ServiceContext context)
     
    void
    channelInactive(io.netty.channel.ChannelHandlerContext ctx)
     
    protected void
    channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpObject httpObject)
     
    void
    exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable ex)
     
    protected abstract long
     
    protected abstract boolean
    isValidRequestPath(io.netty.handler.codec.http.HttpMethod method, String httpRequestPath, ServiceContext context)
     
    protected abstract T
    onFileUploaded(io.netty.channel.ChannelHandlerContext ctx, String fileName, File file, Map<String,String> params, Caller caller, ServiceContext context)
     
    protected void
    onLastChunk(io.netty.channel.ChannelHandlerContext ctx)
     
    protected boolean
    onPartialChunk(io.netty.channel.ChannelHandlerContext ctx, long maxAllowedSize)
     
    protected long
    precheck(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpRequest req)
     
    protected void
     

    Methods inherited from class io.netty.channel.SimpleChannelInboundHandler

    acceptInboundMessage, channelRead

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, handlerAdded, handlerRemoved, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.netty.channel.ChannelHandler

    handlerAdded, handlerRemoved
  • Field Details

    • log

      protected org.apache.logging.log4j.Logger log
    • AUTO_RELEASE

      protected static final boolean AUTO_RELEASE
      See Also:
    • USER_DISK

      protected static final boolean USER_DISK
      See Also:
    • HDF

      protected static final io.netty.handler.codec.http.multipart.HttpDataFactory HDF
    • uploadCfg

      protected static final NioConfig uploadCfg
    • request

      protected io.netty.handler.codec.http.HttpRequest request
    • isMultipart

      protected boolean isMultipart
    • httpDecoder

      protected io.netty.handler.codec.http.multipart.HttpPostRequestDecoder httpDecoder
    • hitIndex

      protected final long hitIndex
    • context

      protected final ServiceContext context
    • partialContent

      protected io.netty.handler.codec.http.multipart.HttpData partialContent
    • fileSizeQuota

      protected long fileSizeQuota
    • caller

      protected Caller caller
    • params

      protected Map<String,String> params
  • Constructor Details

    • BootHttpFileUploadHandler

      public BootHttpFileUploadHandler()
  • Method Details

    • exceptionCaught

      public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable ex)
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelHandler
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      exceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapter
    • channelInactive

      public void channelInactive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      channelInactive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelInactive in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • channelRead0

      protected void channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpObject httpObject) throws Exception
      Specified by:
      channelRead0 in class io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.HttpObject>
      Throws:
      Exception
    • reset

      protected void reset()
    • onPartialChunk

      protected boolean onPartialChunk(io.netty.channel.ChannelHandlerContext ctx, long maxAllowedSize) throws IOException
      Throws:
      IOException
    • onLastChunk

      protected void onLastChunk(io.netty.channel.ChannelHandlerContext ctx) throws IOException
      Throws:
      IOException
    • precheck

      protected long precheck(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpRequest req)
      Parameters:
      ctx -
      req -
      Returns:
      quota (in bytes) of uploaded file size
    • isValidRequestPath

      protected abstract boolean isValidRequestPath(io.netty.handler.codec.http.HttpMethod method, String httpRequestPath, ServiceContext context)
    • authenticate

      protected abstract Caller authenticate(io.netty.handler.codec.http.HttpHeaders httpHeaders, ServiceContext context)
    • getCallerFileUploadSizeLimit_Bytes

      protected abstract long getCallerFileUploadSizeLimit_Bytes(Caller caller, ServiceContext context)
    • onFileUploaded

      protected abstract T onFileUploaded(io.netty.channel.ChannelHandlerContext ctx, String fileName, File file, Map<String,String> params, Caller caller, ServiceContext context)