当前位置:网站首页>AntPathMatcher uses
AntPathMatcher uses
2022-08-02 01:55:00 【Bright de Xuan rice 61】
ant匹配规则
规则:
字符wildcard 描述
? 匹配一个字符
* 匹配0个或者多个字符
** 匹配0个或者多个目录
官方示例:
1、com/t?st.jsp
匹配: com/test.jsp , com/tast.jsp , com/txst.jsp
2、com/*.jsp 匹配: com文件夹下的全部.jsp文件 3、com/**/test.jsp
匹配: com文件夹和子文件夹下的全部.jsp文件,
4、org/springframework/**/*.jsp
匹配: org/springframework文件夹和子文件夹下的全部.jsp文件
5、org/**/servlet/bla.jsp
匹配: org/springframework/servlet/bla.jsp,
org/springframework/testing/servlet/bla.jsp,
org/servlet/bla.jsp
PathMatcher接口方法讲解(AntPathMatcher实现PathMatcher接口)
说明:主要是判断是否匹配pattern,并解析出path中的参数
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);
}
边栏推荐
- Data transfer at the data link layer
- AOF重写
- Effects of Scraping and Aggregation
- 手写博客平台~第二天
- For effective automated testing, these software testing tools must be collected!!!
- Day115. Shangyitong: Background user management: user lock and unlock, details, authentication list approval
- 超大规模的产业实用语义分割数据集PSSL与预训练模型开源啦!
- typescript29-枚举类型的特点和原理
- 有效进行自动化测试,这几个软件测试工具一定要收藏好!!!
- 手写一个博客平台~第三天
猜你喜欢
随机推荐
当关注「互联网+」模式的时候,通常仅仅只是在关注「互联网+」模式本身
Multi-Party Threshold Private Set Intersection with Sublinear Communication-2021: Interpretation
Constructor instance method inheritance of typescript37-class (extends)
Shell入门终章
YGG 公会发展计划第 1 季总结
力扣 1161. 最大层内元素和
创新项目实战之智能跟随机器人原理与代码实现
PHP直播源码实现简单弹幕效果的相关代码
typescript30-any类型
Detailed explanation of fastjson
Redis 订阅与 Redis Stream
Local storage in Kubernetes
检查IP或端口是否被封
待读书单列表
typescript29-枚举类型的特点和原理
Basic use of typescript34-class
云和恩墨:让商业数据库时代的价值在openGauss生态上持续繁荣
ofstream,ifstream,fstream读写文件
Constructor of typescript35-class
3 Month Tester Readme: 4 Important Skills That Impacted My Career









