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

com.github.firelcw.interceptor.HttpInterceptor Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
package com.github.firelcw.interceptor;


import com.github.firelcw.model.ExcludePath;
import com.github.firelcw.model.HttpRequest;
import com.github.firelcw.model.HttpRequestConfig;
import com.github.firelcw.model.HttpResponse;

import java.util.Collections;
import java.util.List;

/**
 * 响应拦截器
 * @author liaochongwei
 * @date 2020/7/31 13:43
 */
public interface HttpInterceptor {

    /**
     * 前置拦截
     * @param config 请求配置
     * @param request 后置拦截
     * @return boolean
     */
    boolean preHandle(HttpRequest request, HttpRequestConfig config);

    /**
     * 后置拦截
     * @param request
     * @param response
     */
    void postHandle(HttpRequest request, HttpResponse response);

    /**
     * 执行顺序(值越小越先执行)
     * @return int
     */
    default int order() {
        return 0;
    }
    /**
     *  排除路径
     * @return List
     */
    default List excludes() {
        return Collections.emptyList();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy