当前位置:网站首页>AntPathMatcher使用
AntPathMatcher使用
2022-08-02 01:36:00 【明快de玄米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);
}
边栏推荐
- 【轮式里程计】
- 华为5年女测试工程师离职:多么痛的领悟...
- IDEA版Postman插件Restful Fast Request,细节到位,功能好用
- 3.Bean的作用域与生命周期
- Newton's theorem and related corollaries
- Redis cluster mode
- Kubernetes — Flannel
- The characteristics and principle of typescript29 - enumeration type
- Moonbeam与Project Galaxy集成,为社区带来全新的用户体验
- Kubernetes — 核心资源对象 — Controller
猜你喜欢

Oracle data to mysql FlinkSQL CDC to achieve synchronization

Byte taught me a hard lesson: When a crisis comes, you don't even have time to prepare...

3 Month Tester Readme: 4 Important Skills That Impacted My Career

【轮式里程计】

datax与datax-web安装部署

The characteristics and principle of typescript29 - enumeration type

Local storage in Kubernetes

制造企业数字化转型现状分析

Navicat数据显示不完全的解决方法

大话西游创建角色失败解决
随机推荐
Record the pits where an error occurs when an array is converted to a collection, and try to use an array of packaging types for conversion
A full set of common interview questions for software testing functional testing [open thinking questions] interview summary 4-3
5年自动化测试经验的一些感悟:做UI自动化一定要跨过这10个坑
力扣 1161. 最大层内元素和
有效进行自动化测试,这几个软件测试工具一定要收藏好!!!
ALCCIKERS Shane 20191114
For effective automated testing, these software testing tools must be collected!!!
hash table
Kubernetes — 核心资源对象 — 网络
JDBC PreparedStatement 的命名参数实现
typescript34-class的基本使用
力扣 1374. 生成每种字符都是奇数个的字符串
3.Bean的作用域与生命周期
Redis cluster mode
tf.keras.callbacks.EarlyStopping()
安全(1)
Can't connect to MySQL server on 'localhost3306' (10061) Simple and clear solution
typescript32-ts中的typeof
百度、百图生科 | HelixFold-Single: 使用蛋白质语言模型作为替代进行无MSA蛋白质结构预测
Oracle data to mysql FlinkSQL CDC to achieve synchronization