Skip to content

Commit

Permalink
bugfix #69 AntPathMatcher方式
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Mar 30, 2021
1 parent 77514df commit b382844
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@

import com.cxytiandi.encrypt.algorithm.AesEncryptAlgorithm;
import com.cxytiandi.encrypt.algorithm.EncryptAlgorithm;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.HandlerExecutionChain;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.handler.AbstractHandlerMethodMapping;

/**
* 数据加解密过滤器
Expand Down Expand Up @@ -227,6 +226,14 @@ private boolean contains(List<String> list, String uri, String methodType, HttpS
return true;
}

// 优先用AntPathMatcher,其实用这个也够了,底层是一样的,下面用的方式兜底
for (String u : list) {
boolean match = new AntPathMatcher().match(u, uri);
if (match) {
return true;
}
}

try {
// 支持RestFul风格API
// 采用Spring MVC内置的匹配方式将当前请求匹配到对应的Controller Method上,获取注解进行匹配是否要加解密
Expand Down

0 comments on commit b382844

Please sign in to comment.