java语言编写,匹配URL中的访问资源,不匹配后面的参数,正则表达式怎么写?
"GET /SchoolClubManage/jsp/common/applyjoinclub.html?name=../../../../../../../../../../etc/passwd%00.jpg HTTP/1.1" 200 5953
这条记录只匹配/SchoolClubManage/jsp/common/applyjoinclub.html?
"GET /SchoolClubManage/font/ HTTP/1.1" 200 3216
这条记录只匹配 /SchoolClubManage/font
多谢,急急急
可以不用正则,使用这个IndexOf()吗
PathMatcher matcher = new AntPathMatcher()
String uri = "/user/rest/isc/user/UUID1238weqw123";
String pattern = "/user/rest/isc/user/**";
matcher.match(pattern, uri);
Pattern p = Pattern.compile("/SchoolClubManage/.*?[\? ]");
Matcher m= p.matcher("GET /SchoolClubManage/jsp/common/applyjoinclub.html?name=../../../../../../../../../../etc/passwd%00.jpg HTTP/1.1\" 200 5953");
if(m.find()){
System.out.println(m.group());
}