Class NioServerHttpRequestHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.FullHttpRequest>
org.summerboot.jexpress.nio.server.NioServerHttpRequestHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler, ErrorAuditor
Direct Known Subclasses:
BootHttpRequestHandler

@Sharable public abstract class NioServerHttpRequestHandler extends io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.FullHttpRequest> implements ErrorAuditor
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 org.apache.logging.log4j.Logger
     
    protected final String
     
    protected static NioConfig
     
    protected String
     
    protected ZoneId
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
    afterLogging(String logContent, io.netty.handler.codec.http.HttpHeaders httpHeaders, io.netty.handler.codec.http.HttpMethod httpMethod, String httpRequestUri, String httpPostRequestBody, ServiceContext context, long queuingTime, long processTime, long responseTime, long responseContentLength, Throwable ioEx)
     
    protected abstract void
    afterService(io.netty.handler.codec.http.HttpHeaders httpHeaders, io.netty.handler.codec.http.HttpMethod httpMethod, String httpRequestPath, Map<String,List<String>> queryParams, String httpPostRequestBody, ServiceContext context)
     
    protected abstract String
    beforeLogging(String originallLogContent, io.netty.handler.codec.http.HttpHeaders httpHeaders, io.netty.handler.codec.http.HttpMethod httpMethod, String httpRequestUri, String httpPostRequestBody, ServiceContext context, long queuingTime, long processTime, long responseTime, long responseContentLength, Throwable ioEx)
     
    void
    channelActive(io.netty.channel.ChannelHandlerContext ctx)
     
    void
    channelInactive(io.netty.channel.ChannelHandlerContext ctx)
     
    void
    channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest req)
     
    void
    channelReadComplete(io.netty.channel.ChannelHandlerContext ctx)
     
    void
    exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable ex)
     
    getRequestProcessor(io.netty.handler.codec.http.HttpMethod httptMethod, String httpRequestPath)
     
    protected String
    info(io.netty.channel.ChannelHandlerContext ctx)
     
    protected String
    requestMetaInfo(io.netty.channel.ChannelHandlerContext ctx, String hitIndex, String protol, io.netty.handler.codec.http.HttpMethod httpMethod, String httpRequestUriRaw, String httpRequestUriDecoded, boolean isKeepAlive, long dataSize)
     
    protected abstract ProcessorSettings
    service(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpHeaders httpHeaders, io.netty.handler.codec.http.HttpMethod httpMethod, String httpRequestPath, Map<String,List<String>> queryParams, String httpPostRequestBody, ServiceContext context)
     
    void
    userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt)
     
    protected void
    verboseClientServerCommunication(NioConfig cfg, io.netty.handler.codec.http.HttpHeaders httpHeaders, String httpPostRequestBody, ServiceContext context, StringBuilder sb, boolean isTraceAll)
     

    Methods inherited from class io.netty.channel.SimpleChannelInboundHandler

    acceptInboundMessage, channelRead

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelRegistered, channelUnregistered, channelWritabilityChanged

    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

    Methods inherited from interface org.summerboot.jexpress.nio.server.ErrorAuditor

    beforeSendingError
  • Field Details

    • log

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

      protected ZoneId zoneId
    • nioCfg

      protected static NioConfig nioCfg
    • protectedContectReplaceWith

      protected String protectedContectReplaceWith
    • me

      protected final String me
  • Constructor Details

    • NioServerHttpRequestHandler

      public NioServerHttpRequestHandler()
  • Method Details

    • userEventTriggered

      public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception
      Specified by:
      userEventTriggered in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      userEventTriggered in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • channelActive

      public void channelActive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      channelActive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelActive in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • 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
    • 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
    • channelReadComplete

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

      public void channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest req)
      Specified by:
      channelRead0 in class io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.FullHttpRequest>
    • info

      protected String info(io.netty.channel.ChannelHandlerContext ctx)
    • requestMetaInfo

      protected String requestMetaInfo(io.netty.channel.ChannelHandlerContext ctx, String hitIndex, String protol, io.netty.handler.codec.http.HttpMethod httpMethod, String httpRequestUriRaw, String httpRequestUriDecoded, boolean isKeepAlive, long dataSize)
    • verboseClientServerCommunication

      protected void verboseClientServerCommunication(NioConfig cfg, io.netty.handler.codec.http.HttpHeaders httpHeaders, String httpPostRequestBody, ServiceContext context, StringBuilder sb, boolean isTraceAll)
    • service

      protected abstract ProcessorSettings service(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpHeaders httpHeaders, io.netty.handler.codec.http.HttpMethod httpMethod, String httpRequestPath, Map<String,List<String>> queryParams, String httpPostRequestBody, ServiceContext context)
    • afterService

      protected abstract void afterService(io.netty.handler.codec.http.HttpHeaders httpHeaders, io.netty.handler.codec.http.HttpMethod httpMethod, String httpRequestPath, Map<String,List<String>> queryParams, String httpPostRequestBody, ServiceContext context)
    • beforeLogging

      protected abstract String beforeLogging(String originallLogContent, io.netty.handler.codec.http.HttpHeaders httpHeaders, io.netty.handler.codec.http.HttpMethod httpMethod, String httpRequestUri, String httpPostRequestBody, ServiceContext context, long queuingTime, long processTime, long responseTime, long responseContentLength, Throwable ioEx) throws Exception
      Throws:
      Exception
    • afterLogging

      protected abstract void afterLogging(String logContent, io.netty.handler.codec.http.HttpHeaders httpHeaders, io.netty.handler.codec.http.HttpMethod httpMethod, String httpRequestUri, String httpPostRequestBody, ServiceContext context, long queuingTime, long processTime, long responseTime, long responseContentLength, Throwable ioEx) throws Exception
      Throws:
      Exception
    • getRequestProcessor

      protected RequestProcessor getRequestProcessor(io.netty.handler.codec.http.HttpMethod httptMethod, String httpRequestPath)