这些可以组合出很多种灵活的路径模式
Table Ant Wildcard Characters
Wildcard | Description | |
? | 匹配任何单字符 | |
* | 匹配0或者任意数量的字符 | |
** | 匹配0或者更多的目录 |
Table Example Ant-Style Path Patterns
Path | Description | |
/app/*.x | 匹配(Matches)所有在app路径下的.x文件 | |
/app/p?ttern | 匹配(Matches) /app/pattern 和 /app/pXttern,但是不包括/app/pttern | |
/**/example | 匹配(Matches) /app/example, /app/foo/example, 和 /example | |
/app/**/dir/file. | 匹配(Matches) /app/dir/file.jsp, /app/foo/dir/file.html,/app/foo/bar/dir/file.pdf, 和 /app/dir/file.java | |
/**/*.jsp | 匹配(Matches)任何的.jsp 文件 |
HandlerMapping
一 个WEB应用程序基本上都要依赖于URL与请求处理器之间的映射,Spring MVC也是一样,但Spring MVC就像Spring所作的一切一样(译者:灵活,可以配置各种东西,但是也造成了很多复杂性),肯定不会只有一种方法来映射URL和 Controller之间的关系,并且在实际上,允许你自己创建映射规则和实现,而不仅仅依赖URL映射。
Spring提供了URL的映射处理, 并且处理路径模式的顺序和方法并没有限定到任何的接口上。Spring MVC的默认实现org.springframework.web.servlet.handler. AbstractUrlHandlerMapping, 会以最长符合路径模式来匹配一个路径。
例如:给定一个请求是 /app/dir/file.jsp 并且现在存在两个路径匹配模式/**/*.jsp 和/app/dir/*.jsp, 那么,URL会匹配那个模式呢?最后的那个模式/app/dir/*.jsp,会因为最长(has more characters)的原则被匹配,它比/**/*.jsp拥有更多的字符.注意的是,这个原则并没有在任何高级别的接口中指定,但却是一种实现细节。
!!下面看一下默认的两个HandlerMapping
BeanNameUrlHandlerMapping
默 认的映射策略实现是org.springframework.web. servlet.handler.BeanNameUrlHandlerMapping类. 这个类要求任何有可能处理请求的Bean都要起一个以反斜杠(/)字符开头的名称或者别名,这个名称或者别名可以是符合URL Path匹配原则中的任何名字。
相关推荐
Head-First-Design-Patterns的官方源码,帮助你更好地学习Head-First-Design-Patterns。
Pro-Objective-C-Design-Patterns-for-iOS.pdf
Java codes to study patterns
Data Structures And Algorithms With Object-oriented Design Patterns In Java.chm
cloud-design-patterns, 云应用的规范架构指南 云设计模式Microsoft模式&实践http://aka.ms/cloud-design-patterns本项目采用了微软的微软开源代码。 有关更多信息,请参见代码 Conduct FAQ FAQ或者联系 opencode@
Data Structures and Algorithms with Object-Oriented Design Patterns in C++.rar Data Structures and Algorithms with Object-Oriented Design Patterns in C++.rar
postfix-grok-patterns, 解析后缀日志记录的Logstash配置和grok模式 用于后缀日志的 Logstash注释模式一组使用grok解析后缀日志记录的grok模式。 还包括一个示例Logstash配置文件,用于将grok模式作为过滤器应用。...
Systems Engineering - EAA - Patterns of Enterprise Application Architecture Systems Engineering - EAA - Patterns of Enterprise Application Architecture Systems Engineering - EAA - Patterns of ...
很经典的一本编译方面的书.需要的,拿去看看吧.
Real-Time Design Patterns is the foremost reference for developers seeking to employ this powerful technique. The text begins with a review of the Unified Modeling Language (UML) notation and ...
I have observed that the advent of object-oriented methods and the emergence of object-oriented design patterns has lead to a profound change in the pedagogy of data structures and algorithms....
经典23种设计模式的java版本,英文文档,内容详尽,不可多得
Java设计模式源码,便于更深入的了解和认识。
Wiley - EJB design patterns
Learning-Python-Design-Patterns-Second-Edition.pdf
Learning-Python-Design-Patterns.pdf
the emerging object-oriented design patterns. Experienced object-oriented programmers find that certain ways of doing things work best and that these ways occur over and over again. The book shows how...
encyclopedia-of-chart-patterns-3rd.pdf
software-architecture-patterns 软件架构设计英文原版。
Laracasts - design -patterns -in- php 课程资源