public class

DefaultPathMapper

extends Object
implements PathMapper Serializable
java.lang.Object
   ↳ com.atlassian.plugin.servlet.util.DefaultPathMapper

Class Overview

Originally opied 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.

Summary

Public Constructors
DefaultPathMapper()
Public Methods
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.
String toString()
Protected Methods
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).

[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.plugin.servlet.util.PathMapper

Public Constructors

public DefaultPathMapper ()

Public Methods

public String get (String path)

Retrieve appropriate key by matching patterns with supplied path.

public Collection<String> getAll (String path)

Retrieve all mappings which match a supplied path.

public void put (String key, String pattern)

Add a key and appropriate matching pattern.

public String toString ()

Protected Methods

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")