There are many ways to use this library. The simplest way is to create a template from a URI template expression string:
UriTemplate template = UriTemplate.fromExpression("http://example.com/search{?q,lang}");
Replacement values are added by calling the {@link #set(String,Object)} method on the template:
template.set("q","cat") .set("lang","en"); String uri = template.expand();
The {@link #expand()} method will replace the variable names with the supplied valuesand return the following URI:
http://example.com/search?q=cat&lang=en@author Ryan J. McDonough @version $Revision: 1.1 $ @since 1.0
|
|
|
|