|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.ode.utils.URITemplate
public class URITemplate
A partial implementation of URI Template expansion as specified by the URI template specification.
LimitationsUnsupportedOperationException
is thrown.
Escaping Considerations
varSubstitution(String, Object[], java.util.Map)
Field Summary | |
---|---|
static java.lang.String |
EXPANSION_REGEX
|
Constructor Summary | |
---|---|
URITemplate()
|
Method Summary | |
---|---|
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. |
static java.lang.String |
expandLazily(java.lang.String uriTemplate,
java.lang.String... nameValuePairs)
|
static void |
main(java.lang.String[] args)
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String EXPANSION_REGEX
Constructor Detail |
---|
public URITemplate()
Method Detail |
---|
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.URIException
java.lang.UnsupportedOperationException
expand (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 supported
java.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.URIException
java.lang.UnsupportedOperationException
expand(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.URIException
expandLazily(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)
,
URI
public 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
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |