Shuyo’s Weblog

About my favorite technical issues

Implementations of URI Templates in various languages

Posted by shuyo on July 24, 2008

Before the URI Templates implementation in C++/Xbyak, I researched implementations of URI Templates.

Python (Joe Gregorio himself’s experimental implementation)
http://code.google.com/p/uri-templates/
Ruby – Addressable
http://addressable.rubyforge.org/
Ruby – uri-templates
http://github.com/juretta/uri-templates/tree/master
Javascript – url_template
http://www.mnot.net/javascript/url_template/
Javascript – Template
http://www.snellspace.com/wp/?p=831
Perl – URI::Template
http://search.cpan.org/~bricas/URI-Template/
.NET – UriTemplate
http://msdn.microsoft.com/en-us/library/system.uritemplate.aspx
PHP – URI_Template
http://pear.php.net/package/URI_Template/download/
Java – Apache Abdera
http://cwiki.apache.org/ABDERA/uri-templates.html
Java – Metanotion URLMapper
http://www.metanotion.net/software/urlmapper/
Erlang – uri-template
http://tfletcher.com/dev/erlang-uri-template
C++ – URITemplates
http://shuyo.wordpress.com/2008/07/17/jit-compiler-for-uri-templates-cxbyak/

Some of them implement “extract” method which isn’t mentioned by URI Templates specifications. Now “extract” means extraction of parameters from URI.
To me, URI Templates is valuable if it implements extend and extract both. Because we often need to generate and parse the same format URIs when our application meets connectivity(connectedness). Of course, we can generate URI by string join and parse by regular expressions, but are prone to mistake in changing format.
So I hope that URI Templates include “extract” specifications. It’ll bring about restriction of templates, however…(e.g. Extraction by template “http://example.com/{foo}{bar}” isn’t well defined.)

Original Japanese article: Implementations of URI Templates in various languages

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>