1 package org.springframework.security.util;
2
3 import org.apache.commons.logging.Log;
4 import org.apache.commons.logging.LogFactory;
5
6 import java.util.regex.Pattern;
7
8
9
10
11
12 public class RegexUrlPathMatcher implements UrlMatcher {
13 private static final Log logger = LogFactory.getLog(RegexUrlPathMatcher.class);
14
15 private boolean requiresLowerCaseUrl = false;
16
17 public Object compile(String path) {
18 return Pattern.compile(path);
19 }
20
21 public void setRequiresLowerCaseUrl(boolean requiresLowerCaseUrl) {
22 this.requiresLowerCaseUrl = requiresLowerCaseUrl;
23 }
24
25 public boolean pathMatchesUrl(Object compiledPath, String url) {
26 Pattern pattern = (Pattern)compiledPath;
27
28 return pattern.matcher(url).matches();
29 }
30
31 public String getUniversalMatchPattern() {
32 return "/.*";
33 }
34
35 public boolean requiresLowerCaseUrl() {
36 return requiresLowerCaseUrl;
37 }
38 }