|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IPathMapper
The PathMapper is used to map file patterns to keys, and find an approriate key for a given file path. The pattern rules are consistent with those defined in the Servlet 2.3 API on the whole. Wildcard patterns are also supported, using any combination of * and ?.
PathMapper pm = new PathMapper();
pm.put("one","/");
pm.put("two","/mydir/*");
pm.put("three","*.xml");
pm.put("four","/myexactfile.html");
pm.put("five","/*\/admin/*.??ml");
String result1 = pm.get("/mydir/myfile.xml"); // returns "two";
String result2 = pm.get("/mydir/otherdir/admin/myfile.html"); // returns "five";
Implementation note, this uses the I prefix as the PathMapper
class predates the interface and is already in use in many places. This
interface should be preferred to the PathMapper
class though.
Method Summary | |
---|---|
String |
get(String path)
Retrieve appropriate key by matching patterns with supplied path. |
Collection<String> |
getAll(String path)
Retrieve all mappings which match a supplied path. |
void |
put(String key,
String pattern)
Add a key and appropriate matching pattern. |
Method Detail |
---|
String get(String path)
Collection<String> getAll(String path)
void put(String key, String pattern)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |