Re: behavior of the script resolution with the default servlet

2014-09-03 Thread Alexander Klimetschek
On 03.09.2014, at 04:39, Sandro Boehme sandro.boe...@gmx.de wrote:

 Both scripts are bound to the html extension and `my_resource_type` is more 
 detailed in the resource type hierarchy than `sling/servlet/default`.
 But as I use the .jcrbrowser selector this gives my script a higher priority 
 than the other one anyways.
 Is that correct?
 
 This is a more concrete scenario description than in my first email:
 
 URL: http://localhost/mynode.jcrbrowser.html
 
 ++ original ++
 sling:resourceType: my_resource_type
 script: /apps/my_resource_type/html.jsp
 
 ++ overwritten by Sling JCRBrowser ++
 resource type: sling/servlet/default
 script: /libs/sling/servlet/default/jcrbrowser/html.jsp

Yes, if you have a selector, than that is very specific and it should take the 
bottom one (sling/servlet/default), since there is no selector specific script 
in your /apps.

Cheers,
Alex


Re: behavior of the script resolution with the default servlet

2014-09-03 Thread Sandro Boehme

Am 03.09.14 21:43, schrieb Alexander Klimetschek:

On 03.09.2014, at 04:39, Sandro Boehme sandro.boe...@gmx.de wrote:


Both scripts are bound to the html extension and `my_resource_type` is more 
detailed in the resource type hierarchy than `sling/servlet/default`.
But as I use the .jcrbrowser selector this gives my script a higher priority 
than the other one anyways.
Is that correct?

This is a more concrete scenario description than in my first email:

URL: http://localhost/mynode.jcrbrowser.html

++ original ++
sling:resourceType: my_resource_type
script: /apps/my_resource_type/html.jsp

++ overwritten by Sling JCRBrowser ++
resource type: sling/servlet/default
script: /libs/sling/servlet/default/jcrbrowser/html.jsp


Yes, if you have a selector, than that is very specific and it should take the 
bottom one (sling/servlet/default), since there is no selector specific script 
in your /apps.

Cheers,
Alex



Thanks for the confirmation Alex!


Re: behavior of the script resolution with the default servlet

2014-09-02 Thread Felix Meschberger
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