Class DefaultPathMapper

java.lang.Object
com.atlassian.plugin.servlet.util.DefaultPathMapper
All Implemented Interfaces:
PathMapper, Serializable

public class DefaultPathMapper extends Object implements Serializable, PathMapper
Originally copied from Atlassian Seraph 1.0

Modified to store a list of keys for a mapping rather than a single value. This allows filters to be added that listen on the same path. The get() method will return the first value added if there are multiple keys matching the path, while the getAll() method returns the aggregate matches.

In practice, matching a servlet path should use the get() method and matching filters should use the getAll() method.

Since:
2.1.0
See Also:
  • Constructor Details

    • DefaultPathMapper

      public DefaultPathMapper()
  • Method Details

    • put

      public void put(String key, String pattern)
      Description copied from interface: PathMapper
      Add a key and appropriate matching pattern.
      Specified by:
      put in interface PathMapper
    • get

      public String get(String path)
      Description copied from interface: PathMapper
      Retrieve appropriate key by matching patterns with supplied path.
      Specified by:
      get in interface PathMapper
    • getAll

      public Collection<String> getAll(String path)
      Description copied from interface: PathMapper
      Retrieve all mappings which match a supplied path.
      Specified by:
      getAll in interface PathMapper
    • removeRedundantSlashes

      protected String removeRedundantSlashes(String path)
      Reduces sequences of more than one consecutive forward slash ("/") to a single slash (see: https://studio.atlassian.com/browse/PLUG-597).
      Parameters:
      path - any string, including null (e.g. "foo//bar")
      Returns:
      the input string, with all sequences of more than one consecutive slash removed (e.g. "foo/bar")
    • toString

      public String toString()
      Overrides:
      toString in class Object