蚂蚁路径样式模式 [英] Ant path style patterns

查看:98
本文介绍了蚂蚁路径样式模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

蚂蚁路径样式模式的规则是什么.

Ant网站本身令人惊讶地没有提供信息.

The Ant site itself is surprisingly uninformative.

推荐答案

:

映射使用以下规则匹配URL:

The mapping matches URLs using the following rules:

  • ?匹配一个字符
  • * 匹配零个或多个字符
  • ** 匹配路径中的零个或多个目录"
  • {spring:[a-z] +} 与正则表达式 [a-z] + 匹配为路径变量"spring"
  • ? matches one character
  • * matches zero or more characters
  • ** matches zero or more 'directories' in a path
  • {spring:[a-z]+} matches the regexp [a-z]+ as a path variable named "spring"

一些例子:

  • com/t?st.jsp -匹配com/test.jsp,但也匹配 com/tast.jsp com/txst.jsp
  • com/*.jsp -匹配 com 目录中的所有 .jsp 文件
  • com/**/test.jsp -匹配 com 路径
  • 下的所有 test.jsp 文件
  • org/springframework/**/*.jsp -匹配 org/springframework路径
  • 下的所有 .jsp 文件
  • org/**/servlet/bla.jsp -匹配 org/springframework/servlet/bla.jsp 但也匹配 org/springframework/testing/servlet/bla.jsp org/servlet/bla.jsp
  • com/{文件名:\\ w +}.jsp 将与 com/test.jsp 匹配,并将值 test 分配给文件名变量
  • com/t?st.jsp - matches com/test.jsp but also com/tast.jsp or com/txst.jsp
  • com/*.jsp - matches all .jsp files in the com directory
  • com/**/test.jsp - matches all test.jsp files underneath the com path
  • org/springframework/**/*.jsp - matches all .jsp files underneath the org/springframework path
  • org/**/servlet/bla.jsp - matches org/springframework/servlet/bla.jsp but also org/springframework/testing/servlet/bla.jsp and org/servlet/bla.jsp
  • com/{filename:\\w+}.jsp will match com/test.jsp and assign the value test to the filename variable

http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/util/AntPathMatcher.html

这篇关于蚂蚁路径样式模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆