com.atlassian.plugin.servlet.util
Interface PathMapper

All Known Implementing Classes:
DefaultPathMapper

public interface PathMapper

The PathMapper is used to map file patterns to keys, and find an appropriate 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";

This was copied from Atlassian Seraph 1.0

Since:
2.1.0

Method Summary
 java.lang.String get(java.lang.String path)
          Retrieve appropriate key by matching patterns with supplied path.
 java.util.Collection<java.lang.String> getAll(java.lang.String path)
          Retrieve all mappings which match a supplied path.
 void put(java.lang.String key, java.lang.String pattern)
          Add a key and appropriate matching pattern.
 

Method Detail

get

java.lang.String get(java.lang.String path)
Retrieve appropriate key by matching patterns with supplied path.


getAll

java.util.Collection<java.lang.String> getAll(java.lang.String path)
Retrieve all mappings which match a supplied path.


put

void put(java.lang.String key,
         java.lang.String pattern)
Add a key and appropriate matching pattern.



Copyright © 2013 Atlassian. All Rights Reserved.