
public abstract class HttpRequestHandler
extends io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.HttpObject>
| Modifier and Type | Field and Description | 
|---|---|
| protected String | baseStaticPath | 
| protected AbstractHttpBusinessRequest | businessRequest | 
| protected String | cookieSession | 
| protected io.netty.handler.codec.http.multipart.HttpPostRequestDecoder | decoder | 
| protected String | errorMesg | 
| protected HttpPage | httpPage | 
| protected HttpPageHandler | httpPageHandler | 
| protected io.netty.handler.codec.http.HttpMethod | method | 
| protected io.netty.handler.codec.http.HttpRequest | request | 
| protected HttpSession | session | 
| protected io.netty.handler.codec.http.HttpResponseStatus | status | 
| protected boolean | willClose | 
| Modifier | Constructor and Description | 
|---|---|
| protected  | HttpRequestHandler(String baseStaticPath,
                  String cookieSession,
                  HttpPageHandler httpPageHandler) | 
| Modifier and Type | Method and Description | 
|---|---|
| protected void | addBusinessCookie(io.netty.handler.codec.http.FullHttpResponse response,
                 Set<String> cookieNames)Method to add specific Cookies from business definition
 
 Override if needed | 
| protected abstract void | beforeSimplePage(io.netty.channel.ChannelHandlerContext ctx)Called before simple Page is called (Menu or HTML) | 
| abstract void | businessValidRequestAfterAllDataReceived(io.netty.channel.ChannelHandlerContext ctx)Validate all data as they should be all received (done before the
 isRequestValid) | 
| void | channelActive(io.netty.channel.ChannelHandlerContext ctx) | 
| void | channelInactive(io.netty.channel.ChannelHandlerContext ctx) | 
| protected void | channelRead0(io.netty.channel.ChannelHandlerContext ctx,
            io.netty.handler.codec.http.HttpObject msg) | 
| protected abstract void | checkConnection(io.netty.channel.ChannelHandlerContext ctx)To be used for instance to check correctness of connection | 
| protected void | clean()Clean method
 
 Override if needed | 
| protected void | createNewSessionAtConnection(io.netty.channel.ChannelHandlerContext ctx)Default session creation | 
| protected void | delete(io.netty.channel.ChannelHandlerContext ctx)Method that get delete data | 
| protected abstract void | error(io.netty.channel.ChannelHandlerContext ctx)Called when an error is raised. | 
| void | exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
               Throwable cause) | 
| protected void | finalData(io.netty.channel.ChannelHandlerContext ctx)Method that will use the result and send back the result | 
| protected abstract void | finalDelete(io.netty.channel.ChannelHandlerContext ctx)Method that will use the uploaded file and prepare the result | 
| protected abstract void | finalGet(io.netty.channel.ChannelHandlerContext ctx)Method that will use the uploaded file and send back the result  (this method must send back the answer using for instance a ChunkedInput handler and should try to call clean(), but taking into consideration that it will erase all data, so it must be ensured that all data are sent through the wire before calling it. | 
| protected abstract void | finalPost(io.netty.channel.ChannelHandlerContext ctx)Method that will use the post result and prepare the result | 
| protected abstract void | finalPostUpload(io.netty.channel.ChannelHandlerContext ctx)Method that will use the uploaded file and prepare the result | 
| protected abstract void | finalPut(io.netty.channel.ChannelHandlerContext ctx)Method that will use the put result and prepare the result | 
| protected void | forceClosing(io.netty.channel.ChannelHandlerContext ctx)To allow quick answer even if in very bad shape | 
| protected void | getCookieArgs()set values from Cookies | 
| protected void | getFile(io.netty.channel.ChannelHandlerContext ctx)Method that get "get" data, answer has to be written in the business part
 finalGet | 
| protected abstract String | getFilename() | 
| protected void | getHeaderArgs()set values from Header | 
| protected String | getNewCookieSession()Default Session Cookie generator | 
| protected io.netty.handler.codec.http.FullHttpResponse | getResponse(io.netty.buffer.ByteBuf buf) | 
| protected void | getUriArgs()set values from URI | 
| protected void | initialize()Called at the beginning of every new request
 
 Override if needed | 
| protected abstract boolean | isCookieValid(io.netty.handler.codec.http.cookie.Cookie cookie)Could be used for other method (as validation of an authent cookie) | 
| protected void | post(io.netty.channel.ChannelHandlerContext ctx)Method that get post data | 
| protected void | postChunk(io.netty.channel.ChannelHandlerContext ctx,
         io.netty.handler.codec.http.HttpContent chunk)Method that get a chunk of data | 
| protected void | prepareError(io.netty.channel.ChannelHandlerContext ctx,
            String message)Utility to prepare error | 
| protected void | readHttpData(io.netty.handler.codec.http.multipart.InterfaceHttpData data,
            io.netty.channel.ChannelHandlerContext ctx)Read one Data | 
| protected void | readHttpDataAllReceive(io.netty.channel.ChannelHandlerContext ctx)Read all InterfaceHttpData from finished transfer | 
| protected void | readHttpDataChunkByChunk(io.netty.channel.ChannelHandlerContext ctx)Read request by chunk and getting values from chunk to chunk | 
| protected void | setCookieEncoder(io.netty.handler.codec.http.FullHttpResponse response)Method to set Cookies in response | 
| protected boolean | setErrorPage(io.netty.channel.ChannelHandlerContext ctx)Instantiate the page and the businessRequest handler | 
| protected void | writeErrorPage(io.netty.channel.ChannelHandlerContext ctx)Write an error page | 
| protected void | writeSimplePage(io.netty.channel.ChannelHandlerContext ctx)Write a simple page from current httpPage and businessRequest | 
acceptInboundMessage, channelReadchannelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredensureNotSharable, handlerAdded, handlerRemoved, isSharableprotected final String baseStaticPath
protected final String cookieSession
protected final HttpPageHandler httpPageHandler
protected HttpSession session
protected io.netty.handler.codec.http.multipart.HttpPostRequestDecoder decoder
protected HttpPage httpPage
protected AbstractHttpBusinessRequest businessRequest
protected io.netty.handler.codec.http.HttpResponseStatus status
protected String errorMesg
protected io.netty.handler.codec.http.HttpRequest request
protected io.netty.handler.codec.http.HttpMethod method
protected volatile boolean willClose
protected HttpRequestHandler(String baseStaticPath, String cookieSession, HttpPageHandler httpPageHandler)
baseStaticPath - cookieSession - httpPageHandler - protected void clean()
Override if needed
protected void initialize()
Override if needed
protected void getUriArgs()
                   throws HttpIncorrectRequestException
HttpIncorrectRequestExceptionprotected void getHeaderArgs()
                      throws HttpIncorrectRequestException
HttpIncorrectRequestExceptionprotected void getCookieArgs()
                      throws HttpIncorrectRequestException
HttpIncorrectRequestExceptionprotected abstract void checkConnection(io.netty.channel.ChannelHandlerContext ctx)
                                 throws HttpIncorrectRequestException
ctx - HttpIncorrectRequestExceptionprotected abstract void error(io.netty.channel.ChannelHandlerContext ctx)
ctx - protected void channelRead0(io.netty.channel.ChannelHandlerContext ctx,
                            io.netty.handler.codec.http.HttpObject msg)
                     throws Exception
channelRead0 in class io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.HttpObject>Exceptionprotected void prepareError(io.netty.channel.ChannelHandlerContext ctx,
                            String message)
                     throws HttpIncorrectRequestException
ctx - message - HttpIncorrectRequestExceptionprotected boolean setErrorPage(io.netty.channel.ChannelHandlerContext ctx)
ctx - protected void writeErrorPage(io.netty.channel.ChannelHandlerContext ctx)
ctx - protected void forceClosing(io.netty.channel.ChannelHandlerContext ctx)
ctx - protected void writeSimplePage(io.netty.channel.ChannelHandlerContext ctx)
                        throws HttpIncorrectRequestException
ctx - HttpIncorrectRequestExceptionprotected abstract boolean isCookieValid(io.netty.handler.codec.http.cookie.Cookie cookie)
cookie - protected void addBusinessCookie(io.netty.handler.codec.http.FullHttpResponse response,
                                 Set<String> cookieNames)
Override if needed
response - cookieNames - protected void setCookieEncoder(io.netty.handler.codec.http.FullHttpResponse response)
response - protected io.netty.handler.codec.http.FullHttpResponse getResponse(io.netty.buffer.ByteBuf buf)
buf - might be nullprotected abstract String getFilename()
protected abstract void beforeSimplePage(io.netty.channel.ChannelHandlerContext ctx)
                                  throws HttpIncorrectRequestException
ctx - HttpIncorrectRequestExceptionprotected void finalData(io.netty.channel.ChannelHandlerContext ctx)
                  throws HttpIncorrectRequestException
ctx - HttpIncorrectRequestExceptionprotected abstract void finalDelete(io.netty.channel.ChannelHandlerContext ctx)
                             throws HttpIncorrectRequestException
ctx - HttpIncorrectRequestExceptionprotected abstract void finalGet(io.netty.channel.ChannelHandlerContext ctx)
                          throws HttpIncorrectRequestException
ctx - HttpIncorrectRequestExceptionprotected abstract void finalPostUpload(io.netty.channel.ChannelHandlerContext ctx)
                                 throws HttpIncorrectRequestException
ctx - HttpIncorrectRequestExceptionprotected abstract void finalPost(io.netty.channel.ChannelHandlerContext ctx)
                           throws HttpIncorrectRequestException
ctx - HttpIncorrectRequestExceptionprotected abstract void finalPut(io.netty.channel.ChannelHandlerContext ctx)
                          throws HttpIncorrectRequestException
ctx - HttpIncorrectRequestExceptionpublic abstract void businessValidRequestAfterAllDataReceived(io.netty.channel.ChannelHandlerContext ctx)
                                                       throws HttpIncorrectRequestException
ctx - HttpIncorrectRequestExceptionprotected void getFile(io.netty.channel.ChannelHandlerContext ctx)
                throws HttpIncorrectRequestException
ctx - HttpIncorrectRequestExceptionprotected void delete(io.netty.channel.ChannelHandlerContext ctx)
               throws HttpIncorrectRequestException
ctx - HttpIncorrectRequestExceptionprotected void post(io.netty.channel.ChannelHandlerContext ctx)
             throws HttpIncorrectRequestException
ctx - HttpIncorrectRequestExceptionprotected void postChunk(io.netty.channel.ChannelHandlerContext ctx,
                         io.netty.handler.codec.http.HttpContent chunk)
                  throws HttpIncorrectRequestException
ctx - chunk - HttpIncorrectRequestExceptionpublic void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
                            Throwable cause)
                     throws Exception
exceptionCaught in interface io.netty.channel.ChannelHandlerexceptionCaught in interface io.netty.channel.ChannelInboundHandlerexceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void channelInactive(io.netty.channel.ChannelHandlerContext ctx)
                     throws Exception
channelInactive in interface io.netty.channel.ChannelInboundHandlerchannelInactive in class io.netty.channel.ChannelInboundHandlerAdapterExceptionprotected void readHttpDataAllReceive(io.netty.channel.ChannelHandlerContext ctx)
                               throws HttpIncorrectRequestException
ctx - HttpIncorrectRequestExceptionprotected void readHttpDataChunkByChunk(io.netty.channel.ChannelHandlerContext ctx)
                                 throws HttpIncorrectRequestException
ctx - HttpIncorrectRequestExceptionprotected void readHttpData(io.netty.handler.codec.http.multipart.InterfaceHttpData data,
                            io.netty.channel.ChannelHandlerContext ctx)
                     throws HttpIncorrectRequestException
data - ctx - HttpIncorrectRequestExceptionprotected String getNewCookieSession()
protected void createNewSessionAtConnection(io.netty.channel.ChannelHandlerContext ctx)
ctx - Copyright © 2009–2020 Waarp. All rights reserved.