abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Abley" <james.ab...@gmail.com>
Subject Re: URI templates question
Date Wed, 05 Nov 2008 20:26:23 GMT
Hi David,

That's what I've been using. Very nice, pretty comprehensive test
fixture. I might work towards submitting a patch that has
intention-revealing names. test1, test2, etc, don't tell me much. But
I guess it forces me to read all of them to find what I'm looking for.

My interpretation is that you're suggesting I change the
implementation by adding some sort of mode / method overload that
doesn't escape / characters (and maybe others). Is that correct?
That's a possibility. What I was hoping for was for someone to beat me
with an RFC draft or something pointing out where I'm going wrong, but
if it's valid to process URI Templates in that fashion, then maybe
I'll take a look.

Cheers,

James

2008/11/5 David Calavera <david.calavera@gmail.com>:
> 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
View raw message