/*
- * $Header: /cvsroot/securityfilter/securityfilter/src/share/org/securityfilter/filter/Attic/MatchableURLPattern.java,v 1.5 2002/09/14 08:45:28 maxcooper Exp $
- * $Revision: 1.5 $
- * $Date: 2002/09/14 08:45:28 $
+ * $Header: /cvsroot/securityfilter/securityfilter/src/share/org/securityfilter/filter/Attic/MatchableURLPattern.java,v 1.6 2002/12/09 12:23:03 maxcooper Exp $
+ * $Revision: 1.6 $
+ * $Date: 2002/12/09 12:23:03 $
*
* ====================================================================
* The SecurityFilter Software License, Version 1.1
* by the order field).
*
* @author Max Cooper (max@maxcooper.com)
- * @version $Revision: 1.5 $ $Date: 2002/09/14 08:45:28 $
+ * @version $Revision: 1.6 $ $Date: 2002/12/09 12:23:03 $
*/
public class MatchableURLPattern implements Comparable {
private String pattern;
buf.replace(pos, pos + 1, ".*");
pos = buf.toString().indexOf('*', pos + 2);
}
+ // adjustments for the different expression types
+ switch (patternType) {
+ case PATH:
+ // make sure it matches from the start of the string
+ buf.insert(0, '^');
+ // make sure /foo/* matches /foo and /foo/morestuff, but not /foobar
+ buf.insert(buf.length()-3, "($|");
+ buf.append(")");
+ break;
+ case EXTENSION:
+ buf.append('$');
+ break;
+ case EXACT:
+ buf.insert(0, '^');
+ buf.append('$');
+ break;
+ }
return buf.toString();
}
}