Shiro系列教程URL匹配规则(AntPathMatcher)
来源:互联网 发布:jquery.reveal js关闭 编辑:程序博客网 时间:2024/06/05 18:55
官方示例
...[urls]/index.html = anon/user/create = anon/user/** = authc/admin/** = authc, roles[administrator]/rest/** = authc, rest/remoting/rpc/** = authc, perms["remote:invoke"]
匹配规则
? 匹配一个字符
* 匹配一个或多个字符
** 匹配一个或多个目录
com/t?st.jsp 匹配 com/test.jsp but also com/tast.jsp or com/txst.jsp
PatternMatcher matcher = new AntPathMatcher();System.out.println(matcher.matches("/com/t?st.jsp", "/com/txst.jsp"));System.out.println(matcher.matches("/com/t?st.jsp", "/com/tast.jsp"));System.out.println(matcher.matches("/com/t?st.jsp", "/com/txst.jsp"));
com/*.jsp 匹配com目录下任何.jsp文件
PatternMatcher matcher = new AntPathMatcher();System.out.println(matcher.matches("com/*.jsp", "com/txst.jsp"));System.out.println(matcher.matches("com/*.jsp", "com/tast.jsp"));System.out.println(matcher.matches("com/*.jsp", "com/txst.jsp"));
PatternMatcher matcher = new AntPathMatcher();System.out.println(matcher.matches("com/**/test.jsp", "com/a/test.jsp"));System.out.println(matcher.matches("com/**/test.jsp", "com/b/test.jsp"));System.out.println(matcher.matches("com/**/test.jsp", "com/c/d/test.jsp"));
org/apache/shiro/**/*.jsp 匹配org/apache/shiro 目录下任何jsp文件
PatternMatcher matcher = new AntPathMatcher();System.out.println(matcher.matches("org/apache/shiro/**/*.jsp ", "org/apache/shiro/test.jsp"));System.out.println(matcher.matches("org/apache/shiro/**/*.jsp ", "org/apache/shiro/sub1/sub1.jsp"));System.out.println(matcher.matches("org/apache/shiro/**/*.jsp ", "org/apache/shiro/sub2/sub2.jsp"));
org/**/servlet/bla.jsp 匹配 org/apache/shiro/servlet/bla.jsp || org/apache/shiro/testing/servlet/bla.jsp || org/servlet/bla.jsp
PatternMatcher matcher = new AntPathMatcher();System.out.println(matcher.matches("org/**/servlet/bla.jsp", "org/apache/shiro/servlet/bla.jsp"));System.out.println(matcher.matches("org/**/servlet/bla.jsp", "org/apache/shiro/testing/servlet/bla.jsp"));System.out.println(matcher.matches("org/**/servlet/bla.jsp", "org/servlet/bla.jsp"));
0 0
- Shiro系列教程URL匹配规则(AntPathMatcher)
- Shiro的URL匹配规则(AntPathMatcher)
- SpringMVC路径匹配规则AntPathMatcher
- Spring3 url匹配规则
- url-pattern匹配规则
- url-pattern匹配规则
- shiro 系列教程
- nginx loaction url 匹配规则
- 理论---<url pattern> 匹配规则
- url-pattern的匹配规则
- Tomcat中<url-pattern/>的匹配规则
- Servlet的url-pattern匹配规则
- web.xml中url-pattern匹配规则
- Servlet的url-pattern匹配规则
- web.xml中url-pattern匹配规则
- Servlet的url-pattern匹配规则
- web.xml中url-pattern匹配规则
- Servlet的url-pattern匹配规则
- Java内存区域划分
- 反射
- 将博客搬至CSDN
- codeforces 675c Money Transfers
- apache多站点配置
- Shiro系列教程URL匹配规则(AntPathMatcher)
- ubuntu 16.04 git 服务器安装
- git clone 命令行http代理设置
- Golang Template
- win10下Chrome安装位置调整
- 第十一天2017/04/25(1、二叉树)
- 商品展示案例
- 797A
- HTML5做移动开发一定要搞明白MPA 与 SPA 的差别