RE: URI Templates - optional variables?

Stefan Eissing wrote:
> > 1.) http://www.example.com/{foo?}/
> >
> > For foo="bar", URL=  http://www.example.com/bar/ For foo="" or 
> > foo=null, URL=  http://www.example.com/  (no double
> > forward-slash)
>
> I think it would make sense to say that a template to uri 
> converter MUST perform path resolution as described in RFC 
> 3986 ch. 5.2.3 and 5.2.4. That will also stop some injections 
> of "." and ".." into URIs while saving the client from 
> worrying to much about double "/" and such. 

I read the spec but am one that still has trouble understanding portions of
a spec that do not include examples such as those. Which of the following
are you saying it should result in?

A.) http://www.example.com/  
B.) http://www.example.com//  

> > 2.) http://www.example.com/?foo={foo?}
> >
> > For foo="bar", URL=  http://www.example.com/?foo=bar For foo="" or 
> > foo=null, URL=  http://www.example.com/  (no question
> > mark)
>
> This alone will not work. There is a difference between an 
> absent and an empty parameter for some applications (e.g. 
> they want to see "http://www.example.com/?foo=" ).

What I was trying to represent was not that foo was equal to two quotes but
that foo was equal to an empty string. Actually, it should be up to the
processing app to determine if foo was 'nothing' (null and/or empty or even
the default value) but this is a critical need if we are to make URLs more
usable. Imagine the following where most of the time all parameters would be
null:

http://www.example.com/?a={a}&b={b}&c={c}&d={d}&e={e}&f={f}&g={g}

Without optional parameters the URLs almost always look like this (<ugh>):

http://www.example.com/?a=&b=&c=&d=&e=&f=&g=

Instead of, more approripately, like this (<smile>):

http://www.example.com/
http://www.example.com/?a=foo  
http://www.example.com/?c=bar
http://www.example.com/?d=foo&f=bar

Clearly the latter is far more usable for users than the former.  We really
do need URI Templates to allow the ommission of parameters on the URL when
the resultant URL would have nothing after the equal sign.  That said, HTML
forms should probably also have a similar feature for empty input field

-- 
-Mike Schinkel
http://www.mikeschinkel.com/blogs/
http://www.welldesignedurls.org
http://atlanta-web.org - http://t.oolicio.us


  


> -----Original Message-----
> From: Stefan Eissing [mailto:stefan@eissing.org] 
> Sent: Tuesday, July 31, 2007 10:03 AM
> To: Mike Schinkel
> Cc: uri@w3.org
> Subject: Re: URI Templates - optional variables?
> 
> 
> Am 30.07.2007 um 19:55 schrieb Mike Schinkel:
> > 1.) http://www.example.com/{foo?}/
> >
> > For foo="bar", URL=  http://www.example.com/bar/ For foo="" or 
> > foo=null, URL=  http://www.example.com/  (no double
> > forward-slash)
> 
> I think it would make sense to say that a template to uri 
> converter MUST perform path resolution as described in RFC 
> 3986 ch. 5.2.3 and 5.2.4. That will also stop some injections 
> of "." and ".." into URIs while saving the client from 
> worrying to much about double "/" and such.
> 
> > 2.) http://www.example.com/?foo={foo?}
> >
> > For foo="bar", URL=  http://www.example.com/?foo=bar For foo="" or 
> > foo=null, URL=  http://www.example.com/  (no question
> > mark)
> 
> This alone will not work. There is a difference between an 
> absent and an empty parameter for some applications (e.g. 
> they want to see "http://www.example.com/?foo=" ).
> 
> Cheers,
> 
> Stefan

Received on Tuesday, 31 July 2007 19:30:21 UTC