蚂蚁路径样式模式 [英] Ant path style patterns
本文介绍了蚂蚁路径样式模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
蚂蚁路径样式模式的规则是什么.
Ant网站本身令人惊讶地没有提供信息.
The Ant site itself is surprisingly uninformative.
推荐答案
在 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
路径 下的所有 -
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/{文件名:\\ w +}.jsp
将与com/test.jsp
匹配,并将值test
分配给文件名
变量
test.jsp
文件 .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屋!
查看全文