W3C home > Mailing lists > Public > uri@w3.org > November 2007

URI template: JSP Expression Language

From: Manger, James H <James.H.Manger@team.telstra.com>
Date: Fri, 9 Nov 2007 11:15:03 +1100
Message-ID: <6215401E01247448A306C54F499111F20374D48F@WSMSG2103V.srv.dir.telstra.com>
To: "URI" <uri@w3.org>
Has anyone considered using the JSP Expression Language (EL) for URI templates?
[jsp-2_1-fr-spec-el.pdf from http://jcp.org/aboutJava/communityprocess/final/jsr245/]

The Expression Language evolved for JavaServer Pages (JSP), JSP Standard Tag Library (JSTL), and JavaServer Faces but use beyond these specs became a specific design criteria.

Examples:
${foo}
${date.year}
${foo[3]}
${foo?"hi":"bye"}
${(a+b)*c}
${fn:substring(foo,1,2)}
${fn:replace(fn:escapeXml(foo),"cat","dog")}

EL allows variables to be strings, integers, arrays, lists, maps, booleans… (defining all the conversions).
Variable names are Java identifiers (which differs from <unreserved> chars).
Functions can be defined, with namespace prefixes. Prefix->namespace mapping have to be defined externally (outside the EL).
Typical programming language operators are available: + - * / () < >= && ?: not …


I don’t think EL is well suited to URI templates. However, if functionality like {-sub…} is required then EL (or EL-like) offers a better syntax. Functions can be combined, nested, and *user-defined* (much like variables).

My gut feel is to omit the substring function, and produce a simpler syntax that uses built-in knowledge of the specific URI format.
Received on Friday, 9 November 2007 00:15:28 GMT

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