Class PathMapper
java.lang.Object
com.opensymphony.module.sitemesh.mapper.PathMapper
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 ?.
Example
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";
- Version:
- $Revision: 1.3 $
- Author:
- Joe Walnes, Mike Cannon-Brookes, Hani Suleiman
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
findComplexKey
(String path, Map mappings) private static String
findDefaultKey
(Map mappings) Look for root pattern ( / ).private static String
findExactKey
(String path, Map mappings) Check if path matches exact pattern ( /blah/blah.jsp ).private static String
Find exact key in mappings.Retrieve appropriate key by matching patterns with supplied path.private static boolean
void
Add a key and appropriate matching pattern.
-
Field Details
-
mappings
-
-
Constructor Details
-
PathMapper
public PathMapper()
-
-
Method Details
-
put
Add a key and appropriate matching pattern. -
get
Retrieve appropriate key by matching patterns with supplied path. -
findKey
Find exact key in mappings. -
findExactKey
Check if path matches exact pattern ( /blah/blah.jsp ). -
findComplexKey
-
findDefaultKey
Look for root pattern ( / ). -
match
-