1 24 package org.riotfamily.common.web.resource; 25 26 import org.springframework.util.AntPathMatcher; 27 import org.springframework.util.PathMatcher; 28 29 public abstract class AbstractPathMatchingResourceFilter 30 implements ResourceFilter { 31 32 private String [] matches; 33 34 private PathMatcher pathMatcher = new AntPathMatcher(); 35 36 public void setMatch(String match) { 37 this.matches = new String [] { match }; 38 } 39 40 public void setMatches(String [] matches) { 41 this.matches = matches; 42 } 43 44 public void setPathMatcher(PathMatcher pathMatcher) { 45 this.pathMatcher = pathMatcher; 46 } 47 48 public boolean matches(String path) { 49 for (int i = 0; i < matches.length; i++) { 50 if (pathMatcher.match(matches[i], path)) { 51 return true; 52 } 53 } 54 return false; 55 } 56 57 } 58 | Popular Tags |