|
Apache CXF API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cxf.jaxrs.model.URITemplate
public final class URITemplate
Field Summary | |
---|---|
static String |
FINAL_MATCH_GROUP
|
static String |
LIMITED_REGEX_SUFFIX
|
static String |
TEMPLATE_PARAMETERS
|
Constructor Summary | |
---|---|
URITemplate(String theTemplate)
|
Method Summary | |
---|---|
static int |
compareTemplates(URITemplate t1,
URITemplate t2)
|
static URITemplate |
createTemplate(javax.ws.rs.Path path)
|
static URITemplate |
createTemplate(String pathValue)
|
String |
encodeLiteralCharacters(boolean isQuery)
Encoded literal characters surrounding template variables, ex. |
List<String> |
getCustomVariables()
List of variables with patterns (regexps). |
String |
getLiteralChars()
|
String |
getPatternValue()
|
String |
getValue()
|
List<String> |
getVariables()
List of all variables in order of appearance in template. |
boolean |
match(String uri,
javax.ws.rs.core.MultivaluedMap<String,String> templateVariableToValue)
|
String |
substitute(List<String> values)
Substitutes template variables with listed values. |
String |
substitute(Map<String,? extends Object> valuesMap,
Set<String> encodePathSlashVars,
boolean allowUnresolved)
Substitutes template variables with mapped values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String TEMPLATE_PARAMETERS
public static final String LIMITED_REGEX_SUFFIX
public static final String FINAL_MATCH_GROUP
Constructor Detail |
---|
public URITemplate(String theTemplate)
Method Detail |
---|
public String getLiteralChars()
public String getValue()
public String getPatternValue()
public List<String> getVariables()
public List<String> getCustomVariables()
getVariables()
.
public boolean match(String uri, javax.ws.rs.core.MultivaluedMap<String,String> templateVariableToValue)
public String substitute(List<String> values) throws IllegalArgumentException
list of variables
. When list of value is shorter than variables substitution
is partial. When variable has pattern, value must fit to pattern, otherwise
IllegalArgumentException
is thrown.
Example1: for template "/{a}/{b}/{a}" getVariables()
returns "[a, b, a]"; providing here list
of value "[foo, bar, baz]" results with "/foo/bar/baz".
Example2: for template "/{a}/{b}/{a}" providing list of values "[foo]" results with "/foo/{b}/{a}".
values
- values for variables
IllegalArgumentException
- when values is null, any value does not match pattern etc.public String substitute(Map<String,? extends Object> valuesMap, Set<String> encodePathSlashVars, boolean allowUnresolved) throws IllegalArgumentException
Example: for template "/{a}/{b}/{a}" getVariables()
returns "[a, b, a]"; providing here
mapping "[a: foo, b: bar]" results with "/foo/bar/foo" (full substitution) and for mapping "[b: baz]"
result is "{a}/baz/{a}" (partial substitution).
valuesMap
- map variables to their values; on each value Object.toString() is called.
IllegalArgumentException
public String encodeLiteralCharacters(boolean isQuery)
public static URITemplate createTemplate(javax.ws.rs.Path path)
public static URITemplate createTemplate(String pathValue)
public static int compareTemplates(URITemplate t1, URITemplate t2)
|
Apache CXF API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |