Class HttpLifecycleHandler
java.lang.Object
org.summerboot.jexpress.boot.event.HttpLifecycleHandler
- All Implemented Interfaces:
HttpLifecycleListener
- Version:
- 1.0
- Author:
- Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterLogging(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) step5voidafterProcess(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) step1 - after process is done, before sending response to clientvoidafterSendPingResponse(io.netty.channel.ChannelHandlerContext ctx, String uri, long hit, io.netty.handler.codec.http.HttpResponseStatus status) voidafterService(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) step2 - after sending response to client, before starting loggingbeforeLogging(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) step4booleanbeforeProcessPingRequest(io.netty.channel.ChannelHandlerContext ctx, String uri, long hit, io.netty.handler.codec.http.HttpResponseStatus status) beforeSendingError(String errorContent) step3booleanbeofreProcess(RequestProcessor processor, io.netty.handler.codec.http.HttpHeaders httpRequestHeaders, String httpRequestPath, ServiceContext context) step0 - do any validation checks before processing
-
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:
beforeProcessPingRequestin interfaceHttpLifecycleListener
-
afterSendPingResponse
public void afterSendPingResponse(io.netty.channel.ChannelHandlerContext ctx, String uri, long hit, io.netty.handler.codec.http.HttpResponseStatus status) - Specified by:
afterSendPingResponsein interfaceHttpLifecycleListener
-
beofreProcess
public boolean beofreProcess(RequestProcessor processor, io.netty.handler.codec.http.HttpHeaders httpRequestHeaders, String httpRequestPath, ServiceContext context) throws Exception Description copied from interface:HttpLifecycleListenerstep0 - do any validation checks before processing- Specified by:
beofreProcessin interfaceHttpLifecycleListener- Returns:
- true if good to process request, otherwise false
- Throws:
Exception
-
afterProcess
public void afterProcess(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:HttpLifecycleListenerstep1 - after process is done, before sending response to client- Specified by:
afterProcessin interfaceHttpLifecycleListener
-
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:HttpLifecycleListenerstep2 - after sending response to client, before starting logging- Specified by:
afterServicein interfaceHttpLifecycleListener
-
beforeSendingError
Description copied from interface:HttpLifecycleListenerstep3- Specified by:
beforeSendingErrorin interfaceHttpLifecycleListener- 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:HttpLifecycleListenerstep4- Specified by:
beforeLoggingin interfaceHttpLifecycleListener- 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:HttpLifecycleListenerstep5- Specified by:
afterLoggingin interfaceHttpLifecycleListener
-