All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.litongjava.tio.http.server.intf.HttpRequestInterceptor Maven / Gradle / Ivy

There is a newer version: 3.7.3.v20241201-RELEASE
Show newest version
package com.litongjava.tio.http.server.intf;

import com.litongjava.tio.http.common.HttpRequest;
import com.litongjava.tio.http.common.HttpResponse;
import com.litongjava.tio.http.common.RequestLine;

/**
 * @author tanyaowu
 * 2017年7月25日 下午2:16:06
 */
public interface HttpRequestInterceptor {

  /**
   * 在执行org.tio.http.server.handler.IHttpRequestHandler.handler()前会先调用这个方法
* 如果返回了HttpResponse对象,则后续都不再执行,表示调用栈就此结束
* @param request * @param requestLine * @param channelContext * @param responseFromCache 从缓存中获取到的HttpResponse对象 * @return * @throws Exception * @author tanyaowu */ public HttpResponse doBeforeHandler(HttpRequest request, RequestLine requestLine, HttpResponse responseFromCache) throws Exception; /** * 在执行org.tio.http.server.handler.IHttpRequestHandler.handler()后会调用此方法,业务层可以统一在这里给HttpResponse作一些修饰 * @param request * @param requestLine * @param response * @param cost 本次请求耗时,单位:毫秒 * @throws Exception */ public void doAfterHandler(HttpRequest request, RequestLine requestLine, HttpResponse response, long cost) throws Exception; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy