com.atlassian.gadgets.util
Class UriTemplate

java.lang.Object
  extended by com.atlassian.gadgets.util.UriTemplate

public class UriTemplate
extends Object

Used to match and extract parameter values from request URIs against a URI template. A URI template is a regular URI, but with "templates" where where parameter values should be. As an example /dashboards/{dashboardId}/gadgets/{gadgetId} is a URI template with 2 parameters, dashboardId and gadgetId.


Constructor Summary
UriTemplate(String uriTemplate)
           
 
Method Summary
 Map<String,String> extractParameters(String uri)
          Returns Map of parameter names and their values.
 boolean matches(String uri)
          Returns true if the URI matches this template, false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UriTemplate

public UriTemplate(String uriTemplate)
Method Detail

matches

public boolean matches(String uri)
Returns true if the URI matches this template, false.

Parameters:
uri - URI to check against the template
Returns:
true if the URI matches this template, false otherwise.

extractParameters

public Map<String,String> extractParameters(String uri)
Returns Map of parameter names and their values.

Parameters:
uri - URI which matches this template
Returns:
Map of parameter names and their values
Throws:
IllegalArgumentException - if uri does not match this template


Copyright © 2009 Atlassian. All Rights Reserved.