Hello experts,
Please review the issue that has been recently filed:
http://java.net/jira/browse/JAX_RS_SPEC-359
In summary the user wants to be able take a URI template, e.g. "
http://example.com/name/{name}/age/{age}" and then take a URI, e.g. "
http://example.com/name/Arnold/age/65" (guess who...) and extract the parameter values information into a Map<String, String> instance.
The solution may look like:
UriBuilder builder = UriBuilder.fromUri("
http://example.com/name/{name}/age/{age}");
UriTemplate template = builder.template();
Map<String, String> params = new HashMap<String, String>();
if (template.match("
http://example.com/name/Arnold/age/65", params)) {
params.put("name", "Alois");
URI uri = builder.buildFromMap(params);
...
}
The above requires following API changes:
introduce UriTemplate to represent, well, URI templates...
add ability to get UriTemplate instances from UriBuilder and WebTarget
expose the boolean UriTemplate.match(URI, Map<String, String>) method as part of the UriTemplate API.
Now, finally, my question is:
Q1. Do you think the above API would be useful?
Q2. Is it something we should still try to add into JAX-RS 2.0, given where we are?
Thanks,
Marek