Hi,
I was trying to use URI templates, which seem a good match for what
I'm trying to accomplish. The implementation that comes with Jersey is
a little incomplete for what I'm trying to do, so I'm using the Abdera
(non-JSR311) implementation instead. I've hit a couple of things which
undoubtedly are a result of my lack of understanding of how URI
templates are supposed to work.
@Test
public void uriTemplateLearningTests() throws Exception {
Template template = new Template("{baseUri}{-prefix|/|datePart}");
System.out.println(template.explain());
Map<String, Object> map = new HashMap<String, Object>();
map.put("baseUri", "/home/feeds");
assertEquals("/home/feeds",
template.expand(map).replaceAll("%2F", "/"));
map.put("datePart", "2008/11/04");
assertEquals("/home/feeds/2008/11/04",
template.expand(map).replaceAll("%2F", "/"));
}
I don't want the result with %2F due to not having a single path
variable in the contents of my map; i.e. "home" rather than
"/home/feeds". Is this possible?
Cheers,
James