蚂蚁路径样式图案 [英] Ant path style patterns
本文介绍了蚂蚁路径样式图案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Ant 路径样式模式的规则是什么.
Ant 网站本身的信息量惊人.
The Ant site itself is surprisingly uninformative.
推荐答案
Ant-style path patterns matching in 弹簧框架:
Ant-style path patterns matching in spring-framework:
映射使用以下规则匹配 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 路径
下的所有 org/**/servlet/bla.jsp
- 匹配org/springframework/servlet/bla.jsp
但也匹配org/springframework/testing/servlet/bla.jsp
和org/servlet/bla.jsp
com/{filename:\\w+}.jsp
将匹配com/test.jsp
并将值test
分配给 <代码>文件名代码>变量
.jsp
文件com/t?st.jsp
- matches com/test.jsp but alsocom/tast.jsp
orcom/txst.jsp
com/*.jsp
- matches all.jsp
files in thecom
directorycom/**/test.jsp
- matches alltest.jsp
files underneath thecom
pathorg/springframework/**/*.jsp
- matches all.jsp
files underneath theorg/springframework path
org/**/servlet/bla.jsp
- matchesorg/springframework/servlet/bla.jsp
but alsoorg/springframework/testing/servlet/bla.jsp
andorg/servlet/bla.jsp
com/{filename:\\w+}.jsp
will matchcom/test.jsp
and assign the valuetest
to thefilename
variable
http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/util/AntPathMatcher.html
这篇关于蚂蚁路径样式图案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文