当前位置:网站首页>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);
}
边栏推荐
- C语言实验八 字符数组程序设计
- Flex layout in detail
- 3. Bean scope and life cycle
- go泛型使用方法
- feign异常传递的两种方式 fallbackfactory和全局处理 获取服务端自定义异常
- Two ways to pass feign exceptions: fallbackfactory and global processing Get server-side custom exceptions
- ALCCIKERS Shane 20191114
- typeof in typescript32-ts
- 【服务器数据恢复】服务器Raid5阵列mdisk磁盘离线的数据恢复案例
- Kubernetes — 网络流量模型
猜你喜欢

YGG Guild Development Plan Season 1 Summary

typescript37-class的构造函数实例方法继承(extends)

canal realizes mysql data synchronization

Can't connect to MySQL server on 'localhost3306' (10061) Simple and clear solution

创新项目实战之智能跟随机器人原理与代码实现

27英寸横置大屏+实体按键,全新探险者才是安全而合理的做法!

C语言实验九 函数(一)

喜报 | AR 开启纺织产业新模式,ALVA Systems 再获殊荣!

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

Typescript31 - any type
随机推荐
Flink_CDC construction and simple use
typescript36-class的构造函数实例方法
安全(1)
HSDC和独立生成树相关
【刷题篇】打家劫舍
信息收集之cms指纹识别
Day116.尚医通:预约挂号详情 ※
秒懂大模型 | 3步搞定AI写摘要
电商库存系统的防超卖和高并发扣减方案
Kubernetes — Flannel
字节给我狠狠上了一课:危机来的时候你连准备时间都没有...
飞桨助力航天宏图PIE-Engine地球科学引擎构建
Kubernetes — 核心资源对象 — Controller
3. Bean scope and life cycle
Huawei's 5-year female test engineer resigns: what a painful realization...
html+css+php+mysql实现注册+登录+修改密码(附完整代码)
Kubernetes之本地存储
R语言使用table1包绘制(生成)三线表、使用单变量分列构建三线表、编写自定义三线表结构(将因子变量细粒度化重新构建三线图)、自定义修改描述性统计参数输出自定义统计量
3 Month Tester Readme: 4 Important Skills That Impacted My Career
《自然语言处理实战入门》 基于知识图谱的问答机器人