abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Calavera" <david.calav...@gmail.com>
Subject Re: URI templates question
Date Wed, 05 Nov 2008 17:43:02 GMT
Sure James, you can change it.
I think the best way to know how our implementation works is taking a look
at the test cases:
dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestTemplate.java

http://svn.apache.org/repos/asf/incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestTemplate.java

Cheers

On Wed, Nov 5, 2008 at 4:49 PM, James Abley <james.abley@gmail.com> wrote:

> 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
>



-- 
David Calavera
http://www.thinkincode.net

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message