W3C home > Mailing lists > Public > uri@w3.org > June 2009

Re: URI Template experience

From: Christophe Lauret <clauret@weborganic.com>
Date: Thu, 4 Jun 2009 16:35:09 +1000
Message-ID: <fb85fac60906032335g735eb519vbd96a239c211edfe@mail.gmail.com>
To: uri@w3.org
A late response to Joe's blog post.

We have written our own implementation of the URI Templates in Java
( http://tyenki.com/projects/uri-templates/  [OpenSource -  artistic
licence])

Use case:
We initially wanted to use them as templates in our web application to
expose a subset of our URIs using REST.
But we found that they worked quite well as patterns too, and helped
minimise the maintenance of URIs patterns.
We have started using the template nature for testing, for allowing some
services to communicate with each other, and for normalising URIs.
They have been in production for several months now and cover most of our
requirements.

Notation/syntax:
We started by implementing the notation in draft 3.
Later, we decided to use a notation similar to that suggested by Roy
Fielding a few months ago on this mailing list, mostly in order to capture
path components or path parameters.

Usage:
About half of our patterns/templates use only the simple {foo} notation.
A large minority use {+foo} which we use to insert paths (to provide/capture
the entire path to files essentially)
A smaller minority use {/foo} which we use for individual path segments.
A growing proportion use {;foo} to provide path parameters when we want to
use a predicate/filter on a part of the path.
We haven't used the query parameters {?foo} for pattern matching much, they
are just passed through. We don't use templates that require parameters.
We are finding that specifying the type of variable could be useful (eg.
int, string, unreserved or system-specific).

Encoding/decoding:
Templates use a strict encoding as outlined in draft 3.
Patterns use a lenient decoding to allow for characters that do not have to
be encoded.
Each operator has some built-in exceptions corresponding to the part of the
URI they work on.
There hasn't been any need to make any other special case so far.

Hope this helps, we would certainly welcome more activity on URI Templates
front.
I am happy to provide more details if that is of any interest to anyone on
this list.

Regards,
Christophe-


1. Are there any real-world uses of the more complex URI Templates, or
>
is {foo} enough?
>

> 2. *If* the syntax is simplified to {foo} there is an opportunity to
>
support the parsing
>
  case, ala http://bitworking.org/projects/1812/wsgidispatcher.html
>
   Is that of interest to anyone?
>

>
Received on Thursday, 4 June 2009 10:30:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 13 January 2011 12:15:42 GMT