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 ...
随机推荐
- __block修饰变量以及代码块的用法
//如果没有"__block"修饰变量,则在代码块中无法修改变量的值 __block ; //定义代码块: //返回值类型 (^代码块名称)(参数类型) = ^(参数类型 参数名称 ...
- python bytes to string
python bytes 转化成 string 会遇到如下错误: codec can't decode byte 0xff in position 5: illegal multibyte seque ...
- 题目: 求1+2+...+n,要求不使用乘除发、for、while、if、else、switch、case、等关键字以及条件判断语句(A?B:C)
#include <iostream> using namespace std; int add_(int a,int b){ return 0; } int Add(int i,bool ...
- BackTrack5-r3任务栏显示网络图标及自定义DNS
任务栏显示网络连接图标:安装NM工具,在BT终端中执行:apt-get install network-manager按y继续执行,显示:ldconfig deferred processing no ...
- 完成Matrix丶Kingdom PPT后的感想
这次Presentation是我在这节课的第一次上台演讲,让我感悟良多. 具体对我的PPT有兴趣的朋友可以call我,我会共享给大家. 这次老师布置的任务对我而言很有意义.首先,我作为最后一组,我欣赏 ...
- Day23_IO第五天
1.递归求5的阶乘 package com.heima.chario; public class Demo8_Digui { /** * @param args * 递归:方法自己调用自己 * 5! ...
- golang http服务器跨域问题解决
func main() { openHttpListen() } func openHttpListen() { http.HandleFunc("/", receiveClien ...
- 优化 UltraEdit 打开大文件时的性能
UltraEdit 原本就是被设计成可以打开超大文件的工具,只不过在默认情况下需要进行以下优化设置: 禁止临时文件 禁止显示行号 禁止文件(回车 & 换行符)转换 禁止代码折叠 禁止显示函数列 ...
- Iso-Seq学习
SMRT portal安装教程: http://www.pacb.com/wp-content/uploads/2015/09/SMRT-Analysis-Software-Installation- ...
- python 自学 1 day
#!/usr/bin/env python #coding = utf-8 age_of_oldby = 56 user = "fyt" word = "fyt" ...