URI template: JSP Expression Language

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 UTC