mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-10-29 22:59:22 +08:00
perf(log): 扩展静态资源路径匹配规则
- 新增 AntPathMatcher 支持更灵活的路径匹配 - 更新 RESOURCE_PATH 列表以包含更多静态资源路径模式 - 实现 isMatchAnt 方法用于 Ant 风格路径匹配 - 添加多个新的静态资源排除路径,如 /actuator/**、/favicon.ico 等 - 修改访问日志工具类使用新的 Ant 路径匹配方法
This commit is contained in:
@@ -40,10 +40,10 @@ public class AccessLogUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 资源路径 - doc 路径
|
||||
* 静态资源路径模式
|
||||
*/
|
||||
private static final List<String> RESOURCE_PATH = List
|
||||
.of("/doc/**", "/v2/api-docs/**", "/v3/api-docs/**", "/webjars/**", "/swagger-resources/**", "/swagger-ui.html");
|
||||
.of("/**/doc/**", "/**/doc.html", "/**/nextdoc/**", "/**/v*/api-docs/**", "/**/api-docs/**", "/**/swagger-ui/**", "/**/swagger-ui.html", "/**/swagger-resources/**", "/**/webjars/**", "/**/favicon.ico", "/**/static/**", "/**/assets/**", "/**/actuator/**", "/error", "/health");
|
||||
|
||||
/**
|
||||
* 获取参数信息
|
||||
@@ -91,7 +91,7 @@ public class AccessLogUtils {
|
||||
public static boolean exclusionPath(LogProperties properties, String path) {
|
||||
// 放行路由配置的排除检查
|
||||
return properties.isMatch(path) || RESOURCE_PATH.stream()
|
||||
.anyMatch(resourcePath -> SpringWebUtils.isMatch(path, resourcePath));
|
||||
.anyMatch(resourcePath -> SpringWebUtils.isMatchAnt(path, resourcePath));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user