Hi

Am 02.09.2014 um 13:31 schrieb Sandro Boehme <sandro.boe...@gmx.de>:

> Hello,
> 
> I would really appreciate if someone with a good understanding of the script 
> resolution process with the default servlet could explain something to me and 
> point me to the corresponding documentation that I didn't find.
> 
> For the Sling JCRBrowser I have the selector "jcrbrowser" that specifies that 
> I would like to use my script to render an arbitrary resource of the Sling 
> resource tree. Even if this resource already has a resource type with a 
> corresponding script.
> This means to see the /mynode node in the JCRBrowser I use this URL:
> http://localhost/mynode.jcrbrowser.html
> This triggers the script below the selector folder of the default servlet to 
> render the resource:
> /libs/sling/servlet/default/jcrbrowser/html.jsp
> 
> It leaves me puzzled because [1] says "As explained in the Resolution Process 
> section above, a default Servlet is selected if no servlet (or script) for 
> the current resource type can be found."
> but the JCRBrowser also renders nodes that have corresponding 
> scripts/servlets.

Resource Types form a hierarchy much like Java Classes form a type hierarchy. 
And same as java.lang.Object being the mostly implicit root type, the implicit 
root resource type is sling/servlets/default. So for each request for which 
there is no better matching resource type-based script/servlet, the 
script/servlet registered for the sling/servlets/default resource type is 
selected.

> Can someone please give me a hint why my html.jsp script gets called and not 
> the script corresponding to the resource type of the node?

because sling/servlet/default/jcrbrowser/html.jsp is registered for the 
sling/servlet/default resource type but more importantly and stronger binding 
for the jcrbrowser selector *and* the html extension. This combination is a 
quite strong binding and overrules and html extension binding for any better 
matching resource type. In this particular case the selector indeed makes the 
difference.

I think this is better described on [2]

Regards
Felix

[2] 
http://sling.apache.org/documentation/the-sling-engine/url-to-script-resolution.html#priority

> 
> 
> [1] - 
> http://sling.apache.org/documentation/the-sling-engine/servlets.html#default-servlets
> 
> 
> Thanks,
> 
> Sandro

Reply via email to