Hi Felix, On Dec 4, 2007 8:34 AM, Felix Meschberger <[EMAIL PROTECTED]> wrote:
> > ...Here's a proposal for a different way of resolving scripts, with three > > possible cases: > > > > a) Node has a valid sling:resourceType property > > The resource type is the value of this property, which, to be valid, > > must not be empty and must start with a /. > > I think, we should allow for relative paths, so no leading slash > requirement. But: If there is a leading slash, the resourceType path > would be taken as absolute. Sounds reasonable... I was going to ask "relative to what", but you mention a search path below, and I'm ok with that. For microsling, the search path might be fixed to "/apps". > > ...To map to a script, the resource type is converted to a valid path, > > and prefixed with "/apps/sling". > > Why not just /apps ?... I thought that if the nodetype is used for script resolution (because the nodetype is the resource type in some cases, agreed), it would be cleaner to find all "nodetype-related" scripts under /apps/sling. But having them under /apps/nt or /apps/mynamespace is fine. > >... c) Script not found using either a) or b) rules > > As a catch-all default (useful mostly for tutorials and simple example > > apps), microsling looks for scripts named > > /apps/sling/default/<method>.<ext> > > I do not like this catch all script. We have the default servlet to > catch all. If we have the catch all script, the default servlet will > probably never be called :-)... That's only if the catch-all script is present. I don't really have a use case for that though, for tutorials we'll probably work with nt:unstructured nodes, and the scripts will be found under /apps/nt/unstructured, that's fine with me. > ...As a closing statement: I think it is important to clearly define > concerns. The first concern is "every resource has a resource type", the > second one is "the script path is derived from the resource type".... Agreed. > ... What > is really important to me, is that the resource type is resolved before > the script is being resolved. The ScriptResolver only cares for the > Resoure.getResourceType.... Sure, that's how things work now, fine with me. > ...So the first question is: How is the resource type defined ? I think it > is (a) the string value of the resource type property. This may be an > absolute or relative path or a namespaced name (e.g. nt:file, just like > a node type). (b) if there is no resource type property, the primary > node type name is used as the resource type.... ok > ..The second question is: How to get the path from the resource type ? I > think it is the possibly modified resource type.... By "modified" you mean "cleaned up to be usable as a path", right? > ... If the resource type is > a namespaced name (that is contains one colon and no slash, such as > nt:file but not pref:name/other:name), the colon is replaced by a slash. > Otherwise the resource type is taken as a path as is.... ok > ...Finally, the script is looked up below the resource type path if that > path is absolute. If the resoure type path is relative a search path > (compare to PATH environment variable) is applied. For microsling, this > may be fixed, for Sling this will be configurable.... ok -Bertrand
