On Nov 20, 2007 12:27 AM, Jukka Zitting <[EMAIL PROTECTED]> wrote:

> ...My main concern is that we are currently splitting the URIs four ways
> (resource path, selectors, extension, suffix) when I think we could do
> just as well with two parts (resource path, suffix)....

I'm not sure how you envision resolving scripts using just those two
parts, so let me describe how things work now, and you can then
suggest changes.

 - o -

Currently the URI to script or servlet mapping works as follows:

1. The URI is split in four parts (resource path, selectors,
extension, suffix), where "resource path" is the longest part of the
request path that matches a Node in the repository

2. A "resource type" is computed: if the node has a
"slingResourceType" Property (or is that sling:resourceType, now?
doesn't matter much for this discussion) its value is used, otherwise
the node type is converted to a valid JCR path, and used as the
resource type.

3. The ServletResolver looks for a Servlet that is configured to
handle this resource type (hardcoded in microsling to serve default
nt:file Nodes for example, OSGi-dynamic in Sling)

4. If no Servlet is found, the ScriptResolver looks for a script,
building its path as follows:

    /sling/scripts/RT/ME.EXT

Where

  RT is the resource type computed in 2, filtered to make sure it is a
valid JCR path

  ME is the HTTP request method name (POST, PUT) uppercased, or, for the GET
  method, the extension found in the request (html, xml, etc.), lowercase.

  (actually it's the content-type, not extension, but I think we just
agreed to use
  the extension)

  EXT is a script extension that is acceptable for one of our script engines
  (esp, js, vlt, ...)

 - o -

I agree that this is a bit involved, but it is flexible, standardizes
the way scripts are resolved, and the concept of a "resource type" is
fairly unique and very useful I think .

The test coverage of this parsing and mapping is also good in
microsling, so the implementation is solid.

Let's see how you'd do that, if there's a simple way that still leads
to clear conventions I'm all ears.

-Bertrand

Reply via email to