public class URITemplate
extends java.lang.Object
UnsupportedOperationException is thrown.
Escaping Considerations
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
EXPANSION_REGEX |
| Constructor and Description |
|---|
URITemplate() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
expand(java.lang.String uriTemplate,
java.util.Map<java.lang.String,java.lang.String> nameValuePairs)
A partial implementation of URI Template expansion
as specified by the URI template specification.
|
static java.lang.String |
expand(java.lang.String uriTemplate,
java.lang.String... nameValuePairs)
Simply build a map from nameValuePairs and pass it to
expand(String, java.util.Map) |
static java.lang.String |
expandLazily(java.lang.String uriTemplate,
java.util.Map<java.lang.String,java.lang.String> nameValuePairs)
Same as
expand(String, java.util.Map) but preserve an expansion template if the corresponding variable
is not defined in the nameValuePairs map (i.e. map.contains(var)==false). |
static java.lang.String |
expandLazily(java.lang.String uriTemplate,
java.lang.String... nameValuePairs) |
static java.lang.Object[] |
parseExpansion(java.lang.String expansion)
Implements the function describes in the spec
|
static java.lang.String |
varSubstitution(java.lang.String expansionPattern,
java.lang.Object[] expansionInfo,
java.util.Map<java.lang.String,java.lang.String> nameValuePairs)
An implementation of var substitution as defined by the
URI template specification.
|
static java.lang.String |
varSubstitution(java.lang.String expansionPattern,
java.lang.Object[] expansionInfo,
java.util.Map<java.lang.String,java.lang.String> nameValuePairs,
boolean preserveUndefinedVar)
Same as
varSubstitution(String, Object[], java.util.Map) but the preserveUndefinedVar boolean
argument (if true) allows to preserve an expansion template if the corresponding variable is not defined in the nameValuePairs map (i.e. map.contains(var)==false). |
public static final java.lang.String EXPANSION_REGEX
public static java.lang.Object[] parseExpansion(java.lang.String expansion)
expansion, - an expansion template (with the surrounding braces)public static java.lang.String expand(java.lang.String uriTemplate,
java.lang.String... nameValuePairs)
throws org.apache.commons.httpclient.URIException,
java.lang.UnsupportedOperationException
expand(String, java.util.Map)nameValuePairs - an array containing of name, value, name, value, and so on. Null values are allowed.org.apache.commons.httpclient.URIExceptionjava.lang.UnsupportedOperationExceptionexpand (String, java.util.Map)public static java.lang.String expand(java.lang.String uriTemplate,
java.util.Map<java.lang.String,java.lang.String> nameValuePairs)
throws org.apache.commons.httpclient.URIException,
java.lang.UnsupportedOperationException
UnsupportedOperationException will be thrown.
See varSubstitution(String, Object[], java.util.Map)uriTemplate - the URI templatenameValuePairs - a Map of <name, value>. Null values are allowed.org.apache.commons.httpclient.URIException - if the default protocol charset is not supportedjava.lang.UnsupportedOperationException - if the operation is not supported. Currently only var substitution is supported.varSubstitution(String, Object[], java.util.Map)public static java.lang.String expandLazily(java.lang.String uriTemplate,
java.util.Map<java.lang.String,java.lang.String> nameValuePairs)
throws org.apache.commons.httpclient.URIException,
java.lang.UnsupportedOperationException
expand(String, java.util.Map) but preserve an expansion template if the corresponding variable
is not defined in the nameValuePairs map (i.e. map.contains(var)==false).
preserveUndefinedVar is true:
org.apache.commons.httpclient.URIExceptionjava.lang.UnsupportedOperationExceptionexpand(String, java.util.Map)public static java.lang.String expandLazily(java.lang.String uriTemplate,
java.lang.String... nameValuePairs)
throws org.apache.commons.httpclient.URIException
org.apache.commons.httpclient.URIExceptionexpandLazily(String, java.util.Map)public static java.lang.String varSubstitution(java.lang.String expansionPattern,
java.lang.Object[] expansionInfo,
java.util.Map<java.lang.String,java.lang.String> nameValuePairs)
throws org.apache.commons.httpclient.URIException
expansionPattern - an expansion pattern (not a uri template) e.g. "{foo}"expansionInfo - the result of parseExpansion(String) for the given expansion patternnameValuePairs - the Maporg.apache.commons.httpclient.URIException - if an encoding exception occuredURIUtil.encodeWithinQuery(String),
URIpublic static java.lang.String varSubstitution(java.lang.String expansionPattern,
java.lang.Object[] expansionInfo,
java.util.Map<java.lang.String,java.lang.String> nameValuePairs,
boolean preserveUndefinedVar)
throws org.apache.commons.httpclient.URIException
varSubstitution(String, Object[], java.util.Map) but the preserveUndefinedVar boolean
argument (if true) allows to preserve an expansion template if the corresponding variable is not defined in the nameValuePairs map (i.e. map.contains(var)==false).
preserveUndefinedVar is true:
org.apache.commons.httpclient.URIException