Class HttpLifecycleHandler

java.lang.Object
org.summerboot.jexpress.boot.event.HttpLifecycleHandler
All Implemented Interfaces:
HttpLifecycleListener

public class HttpLifecycleHandler extends Object implements HttpLifecycleListener
Version:
1.0
Author:
Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
  • Constructor Details

    • HttpLifecycleHandler

      public HttpLifecycleHandler()
  • Method Details

    • beforeProcessPingRequest

      public boolean beforeProcessPingRequest(io.netty.channel.ChannelHandlerContext ctx, String uri, long hit, io.netty.handler.codec.http.HttpResponseStatus status)
      Specified by:
      beforeProcessPingRequest in interface HttpLifecycleListener
    • afterSendPingResponse

      public void afterSendPingResponse(io.netty.channel.ChannelHandlerContext ctx, String uri, long hit, io.netty.handler.codec.http.HttpResponseStatus status)
      Specified by:
      afterSendPingResponse in interface HttpLifecycleListener
    • beforeProcess

      public boolean beforeProcess(RequestProcessor processor, io.netty.handler.codec.http.HttpHeaders httpRequestHeaders, String httpRequestPath, ServiceContext context) throws Exception
      Description copied from interface: HttpLifecycleListener
      step0 - do any validation checks before processing
      Specified by:
      beforeProcess in interface HttpLifecycleListener
      Parameters:
      processor -
      httpRequestHeaders -
      httpRequestPath -
      context -
      Returns:
      true if good to process request, otherwise false
      Throws:
      Exception
    • afterProcess

      public void afterProcess(boolean preProcessResult, Object processResult, Throwable processException, RequestProcessor processor, io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpHeaders httpRequestHeaders, io.netty.handler.codec.http.HttpMethod httptMethod, String httpRequestPath, Map<String,List<String>> queryParams, String httpPostRequestBody, ServiceContext context)
      Description copied from interface: HttpLifecycleListener
      step1 - after process is done, before sending response to client
      Specified by:
      afterProcess in interface HttpLifecycleListener
      Parameters:
      preProcessResult -
      processResult -
      processException -
      processor -
      ctx -
      httpRequestHeaders -
      httptMethod -
      httpRequestPath -
      queryParams -
      httpPostRequestBody -
      context -
    • afterService

      public 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)
      Description copied from interface: HttpLifecycleListener
      step2 - after sending response to client, before starting logging
      Specified by:
      afterService in interface HttpLifecycleListener
      Parameters:
      httpHeaders -
      httpMethod -
      httpRequestPath -
      queryParams -
      httpPostRequestBody -
      context -
    • beforeSendingError

      public String beforeSendingError(String errorContent)
      Description copied from interface: HttpLifecycleListener
      step3
      Specified by:
      beforeSendingError in interface HttpLifecycleListener
      Parameters:
      errorContent -
      Returns:
    • beforeLogging

      public 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)
      Description copied from interface: HttpLifecycleListener
      step4
      Specified by:
      beforeLogging in interface HttpLifecycleListener
      Parameters:
      originallLogContent -
      httpHeaders -
      httpMethod -
      httpRequestUri -
      httpPostRequestBody -
      context -
      queuingTime -
      processTime -
      responseTime -
      responseContentLength -
      ioEx -
      Returns:
    • afterLogging

      public 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)
      Description copied from interface: HttpLifecycleListener
      step5
      Specified by:
      afterLogging in interface HttpLifecycleListener
      Parameters:
      logContent -
      httpHeaders -
      httpMethod -
      httpRequestUri -
      httpPostRequestBody -
      context -
      queuingTime -
      processTime -
      responseTime -
      responseContentLength -
      ioEx -