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
FieldsModifier and TypeFieldDescriptionprotected static final booleanprotected Callerprotected final ServiceContextprotected longprotected static final io.netty.handler.codec.http.multipart.HttpDataFactoryprotected final longprotected io.netty.handler.codec.http.multipart.HttpPostRequestDecoderprotected booleanprotected org.apache.logging.log4j.Loggerprotected io.netty.handler.codec.http.multipart.HttpDataprotected io.netty.handler.codec.http.HttpRequestprotected static final NioConfigprotected static final boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Callerauthenticate(io.netty.handler.codec.http.HttpHeaders httpHeaders, ServiceContext context) voidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) protected voidchannelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpObject httpObject) voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable ex) protected abstract longgetCallerFileUploadSizeLimit_Bytes(Caller caller, ServiceContext context) protected abstract booleanisValidRequestPath(io.netty.handler.codec.http.HttpMethod method, String httpRequestPath, ServiceContext context) protected abstract TonFileUploaded(io.netty.channel.ChannelHandlerContext ctx, String fileName, File file, Map<String, String> params, Caller caller, ServiceContext context) protected voidonLastChunk(io.netty.channel.ChannelHandlerContext ctx) protected booleanonPartialChunk(io.netty.channel.ChannelHandlerContext ctx, long maxAllowedSize) protected longprecheck(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpRequest req) protected voidreset()Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelReadMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
-
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
-
partialContent
protected io.netty.handler.codec.http.multipart.HttpData partialContent -
fileSizeQuota
protected long fileSizeQuota -
caller
-
params
-
-
Constructor Details
-
BootHttpFileUploadHandler
public BootHttpFileUploadHandler()
-
-
Method Details
-
exceptionCaught
- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter
-
channelInactive
- Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelInactivein classio.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:
channelRead0in classio.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
- 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
-
onFileUploaded
-