RequestMatcher使用。

1.设置匹配规则

private RequestMatcher matcherHtml = new AntPathRequestMatcher("/**", "GET");

2.把ServletRequest转化成HttpServletRequest,强转即可

 

3.调用matches方法进行匹配

matcherBbsHtml.matches(request)


public interface RequestMatcher {

    boolean matches(HttpServletRequest request);

}

 

posted @ 2020-04-08 09:39  埼玉howfree  阅读(1781)  评论(0编辑  收藏  举报