Re: URI templates: comma-separated variable lists

On Aug 24, 2011, at 5:08 PM, Manger, James H wrote:

> On Wed, Aug 24, 2011 at 9:50 AM, James Manger <James@manger.com.au> wrote:
>>> draft-gregorio-uritemplate-06.txt allows a comma-separated list of variables in any expression, regardless of the expression operator.
>>> 
>>> However, a list should not be used with 5 of the 8 operators (+ # . / and no operator) because an expansion will be ambiguous if any variable in the list is undefined. The server cannot tell which value goes with which variable.
> 
> Joe Gregorio responded
>> URI Templates are for expansion and not parsing, so the use case of
>> trying to figure out which value goes with which variable is not a
>> supported use case.
> 
> The server will almost always want to parse a URI built from a template.

An origin server will always parse a URI, whether it is built from
a template or not.  There are many resources for which {x,y} is the
template.

In fact, the original server-side imagemaps were map?{x,y}.
Likewise, resources in Apache Sling are all name{.selectors*}
where the selectors are only distinguished by name (not by
order of appearance in the URI).

> That doesn't mean the template has to provide *instructions* on how to parse.
> The spec correctly notes that regular expressions are generally better
> suited as parsing instructions.
> 
> The problem with {alpha,beta,gamma} as a template is that NOTHING
> (not even a regex) can be used to parse the expansion.

That simply isn't true.

> That should be a huge warning sign that this construct is not useful.

Or that you have created a paper tiger.  If the values are provided
by the server, they can be parsed.  If the values are unique, they
can be parsed.  If the values are never undefined, they can be parsed.
In short, your argument is false.

If a server has no use for a given template construct, that construct
will not be published by that server.  Each expression does not need
to handle all possible cases -- only the ones that matter to that
resource.  If, for any reason, the server needs to distinguish each
variable syntactically, then it is free to use only those URI Template
expressions that do exactly that.

....Roy

Received on Thursday, 25 August 2011 00:56:51 UTC