Spring源码解析 - AntPathMatcher
文章摘要:
1. ant匹配规则
2. PathMatcher接口
3. 通过测试用例看AntPathMatcher的使用
ant匹配规则
AntPathMatcher如名使用的ant 的匹配规则,我们先看看吧.
字符wildcard 描述
? 匹配一个字符
* 匹配0个及以上字符
** 匹配0个及以上目录directories
看几个官方的例子吧:
com/t?st.jsp - 匹配: com/test.jsp , com/tast.jsp , com/txst.jsp
com/*.jsp - 匹配: com文件夹下的全部.jsp文件
com/**/test.jsp - 匹配: com文件夹和子文件夹下的全部.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
package org.springframework.util;
public interface PathMatcher {
/**
* 判断传入的path是否可以作为pattern使用
*/
boolean isPattern(String path);
/**
* 使用pattern匹配path
*/
boolean match(String pattern, String path);
/**
* 如名,是否开始部分匹配
*/
boolean matchStart(String pattern, String path);
/**
* 提取path中匹配到的部分,如pattern(myroot/*.html),path(myroot/myfile.html),返回myfile.html
*/
String extractPathWithinPattern(String pattern, String path);
/**
* 提取path中匹配到的部分,只是这边还需跟占位符配对为map,
* 如pattern(/hotels/{hotel}),path(/hotels/1),解析出"hotel"->"1"
*/
Map<String, String> extractUriTemplateVariables(String pattern, String path);
/**
* 提供比较器
*/
Comparator<String> getPatternComparator(String path);
/**
* 合并pattern,pattern1然后pattern2
*/
String combine(String pattern1, String pattern2);
}
http://www.cnblogs.com/leftthen/p/5212221.html
Spring源码解析 - AntPathMatcher的更多相关文章
- Spring源码解析 - AbstractBeanFactory 实现接口与父类分析
我们先来看类图吧: 除了BeanFactory这一支的接口,AbstractBeanFactory主要实现了AliasRegistry和SingletonBeanRegistry接口. 这边主要提供了 ...
- spring 源码解析
1. [文件] spring源码.txt ~ 15B 下载(167) ? 1 springн┤┬вио╬Ш: 2. [文件] spring源码分析之AOP.txt ~ 15KB 下载( ...
- Spring源码解析——循环依赖的解决方案
一.前言 承接<Spring源码解析--创建bean>.<Spring源码解析--创建bean的实例>,我们今天接着聊聊,循环依赖的解决方案,即创建bean的ObjectFac ...
- Spring源码解析-ioc容器的设计
Spring源码解析-ioc容器的设计 1 IoC容器系列的设计:BeanFactory和ApplicatioContext 在Spring容器中,主要分为两个主要的容器系列,一个是实现BeanFac ...
- Spring源码解析系列汇总
相信我,你会收藏这篇文章的 本篇文章是这段时间撸出来的Spring源码解析系列文章的汇总,总共包含以下专题.喜欢的同学可以收藏起来以备不时之需 SpringIOC源码解析(上) 本篇文章搭建了IOC源 ...
- Spring源码解析之PropertyPlaceholderHelper(占位符解析器)
Spring源码解析之PropertyPlaceholderHelper(占位符解析器) https://blog.csdn.net/weixin_39471249/article/details/7 ...
- Spring源码解析之BeanFactoryPostProcessor(三)
在上一章中笔者介绍了refresh()的<1>处是如何获取beanFactory对象,下面我们要来学习refresh()方法的<2>处是如何调用invokeBeanFactor ...
- Spring源码解析之ConfigurationClassPostProcessor(二)
上一个章节,笔者向大家介绍了spring是如何来过滤配置类的,下面我们来看看在过滤出配置类后,spring是如何来解析配置类的.首先过滤出来的配置类会存放在configCandidates列表, 在代 ...
- Spring源码解析之八finishBeanFactoryInitialization方法即初始化单例bean
Spring源码解析之八finishBeanFactoryInitialization方法即初始化单例bean 七千字长文深刻解读,Spirng中是如何初始化单例bean的,和面试中最常问的Sprin ...
随机推荐
- android使用镜像 Android sdk 和源码等
HTTP Proxy Server:mirrors.neusoft.edu.cn HTTP Proxy Port :80
- 《C++primer》v5 第5章 语句 读书笔记 习题答案
5.1 空语句只有一个";".如果什么也不想做可以使用空语句. 5.2 用花括号{}括起来的叫块,也叫复合语句.有多条语句作用在同一个作用域时,需要用花括号括起来. 5.3 降低了 ...
- cocos2dx 中使用的一些C++ 11 特性
0. placeholder 头文件:<functional> namespace: placeholder placeholder 就是一堆帮助bind占参数位置的东西,名字分别为 _ ...
- 题目1203:IP地址
题目: http://ac.jobdu.com/problem.php?pid=1203 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3052 解决:1504 题目描述: 输入一个ip地 ...
- IntelliJ IDEA手工安python装插件方法
IntelliJ IDEA手工安装插件方法 以IntelliJ IDEA 11.0.1安装python为例: (1)下载python插件地址:http://plugins.intellij.net/p ...
- AC自动机及trie图 pascal
; type data=record sum,failed:longint; son:array ['a'..'z'] of longint; end; ..maxn] of data; que:.. ...
- jsRender绑定数据
首先,引入jquery(很重要),其次引入jsRender.js <script type="text/javascript" src="js/jquery-1.7 ...
- python抓取某学院视频
视频抓取原理:获取所有的知识类别id->然后获取其子项->根据子项链接分析获取该类课程数->循环获取链接指向的视频.需要安装python库:requestspython解析xml使用 ...
- eclipse搭建servlet项目
1.创建web项目 2.勾选Generate web.xml 3.创建Class文件并实现Servlet接口 当搜索Servlet接口时,如果未发现接口则Add library→选择tomcat版本至 ...
- New XAMPP security concept:错误解决方法
New XAMPP security concept:错误解决方法 (2014-03-06 16:07:46) 转载▼ 分类: php 在Linux上配置xampp后远程访问域名报错: New X ...