getServletPath getRequestURI getRequestURL区别
getContextPath:/test //上下文,类似工程名
getServletPath:/test.jsp
getRequestURI:/test/test.jsp
getRequestURL:http://localhost:8080/test/test.jsp
private String imgUrls="/ssoserver/get/authentication/accountpass,/ssoserver/get/authentication/adminaccountpass,/ssoserver/get/authentication/temporaryaccount,/ssoserver/get/authentication/dynamic,/ssoserver/get/authentication/dynamicpwd
";
@Override
public void afterPropertiesSet() throws ServletException {
super.afterPropertiesSet();
String[] configUrls = StringUtils.splitByWholeSeparatorPreserveAllTokens(imgUrls, ",");
for (String configUrl : configUrls) {
urls.add(configUrl);
}
}
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException {
boolean action = false;
for (String url : urls) {
if (pathMatcher.match(url, request.getServletPath())) {
action = true;
}
}