On Wed, Apr 16, 2008 at 5:11 PM, Felix Meschberger <[EMAIL PROTECTED]> wrote:

>  ...The generic script name would
>  then be:
>
>      
> {pathPrefix}/{resourceTypePath}/{resourceTypeLabel}.{selectorString}.{extension}.*
> ...

I like the idea but I'd express it slightly differently:

{scriptPathPrefix}/{resourceTypePath}/{resourceTypeLabel}.{selectorString}.{requestMethod}.{requestExtension}.{scriptExtension}.

And, to cover the most common cases, define that

1) If {requestMethod}.{requestExtension}.== "GET.html", use and empty
string instead (in all cases - not optional):

To have scripts named

/app/foo/bar/bar.esp

instead of

/app/foo/bar/bar.GET.html.esp

for the common GET.html case.

2) If {requestMethod} is not GET or HEAD, {requestExtension} can
optionally be dropped from the script name

To have scripts named

/app/foo/bar/bar.POST.esp

instead of

/app/foo/bar/bar.POST.html.esp

As usually a POST or other method does not care about the request
extension, except maybe to select a different rendering of the result,
in which case POST.html.esp or POST.xml.esp can still be used.

3) {selectorString} is not necessarily the whole string of selectors,
Sling does a longest string match on this part, so that the first of
the following scripts that exists will be used for a request where
resourceType = foo/bar and selectors = "print.a4.color":

/apps/foo/bar/bar.print.a4.color.esp
/apps/foo/bar/bar.print.a4.esp
/apps/foo/bar/bar.print.esp
/apps/foo/bar/bar.esp

- o -

3) Is what we're doing already, and means that we cannot use a longest
string match on the whole thing anyway, so I think it's not much more
complicated to implement 1) and 2) as well. Those make the common
cases much nicer.

Note also that, if needed, it would be trivial to cache the result of
those decisions, by just keeping them around and invalidating the
whole cache when anything changes under /apps, based on JCR
observation. So it's not that bad if the selection algorithm is a bit
more complex. That's also something that's easy to add to our
automated tests, so it will be robust.

WDYT?

-Bertrand

Reply via email to