Re: URI and IRI Templating (What did I get myself into?)

Good analysis Joe, thanks.

On Dec 27, 2006, at 2:49 PM, James M Snell wrote:
>
> Ugh. I'd rather we not go down the path of embedding encoding
> information into the template.  Let's just pick a reasonable  
> default and
> leave it at that.
>
+1, Joe's "default" below looks good to me.

Marc.

> Extensions that affect the selection and validation of the replacement
> value are fine.
>
> - James
>
> Joe Gregorio wrote:
>> [snip]
>> Allow a ':' at the end of a variable name to separate out options,  
>> and then
>> add an option 'enc=<enc>'  where
>> 'enc' could be:
>>
>> enc="strict"
>>   All characters outside (iprivate | iunreserved) are % encoded
>>
>> enc="sub"
>>   Characters outside (iprivate | iunreserved | sub-delims) are %  
>> encoded
>>
>> enc="none"
>>   No characters are % encoded
>>
>> enc="default"
>>   Or if '=<enc>' isn't provided then the default encoding is used:
>>
>>   Characters outside ( iprivate | iunreserved | '@' | ':' | '/' ) are
>> % encoded.
>>
>> So back to the example, if we have:
>>
>>    http://bitworking.org/{path:enc=strict}
>>
>> and
>>
>>  path = "projects/httplib2/"
>>
>> then that gets interpreted as:
>>
>>  http://bitworking.org/projects%2Fhttplib2%2F
>>
>> and
>>
>>    http://bitworking.org/{path:enc=default}
>>
>> gets interpreted as:
>>
>>  http://bitworking.org/projects/httplib2/
>>
>> Note that
>>
>>    http://bitworking.org/{path:enc=default}
>>
>> and
>>
>>    http://bitworking.org/{path}
>>
>> will give equivalent values.
>>
>> Again, with this I worry about complexity and surprising behavior:
>>
>>    http://example.org?a={b:enc=strict}
>>    b = "a=test"
>>
>> gives:
>>
>>   http://example.org?a=a%3Dtest
>>
>> while
>>
>>   http://example.org{b:enc=none}
>>   b = "?a=test"
>>
>> gives:
>>
>>   http://example.org?a=test
>>
>>   -joe
>>
>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.

Received on Tuesday, 2 January 2007 19:23:21 UTC