Hi,

Ian Boston schrieb:
> 
> On 3 Jun 2009, at 06:32, Felix Meschberger wrote:
> 
>> Hi Ian,
>>
>> Ian Boston schrieb:
>>> Should a servlet (with sling.servlet.resourceTypes value="x") bind to
>>> JCR nodes where a parent node has a resourceType of x, or will it only
>>> bind to JCR nodes where the node itself has the resourceType x ?
>>
>> I do not exactly understand what you mean by "bind to JCR nodes" ?
>>
> 
> 
> I mean, when I have servlet with
>>   sling.servlet.resourceTypes = "x"
> 
> and send a request for node with a sling:resourceType=x the request will
> get routed to the servlet (assuming it can handle the request method,
> and selector)
> 
> However,
> If I send a request for a child node of the node with
> sling:resourceType=x, the request does not get routed to the servlet.

Correct. Each resource has its own resource type.

> ie there is no resourceType inheritance by default in Sling.

Not in the sense of "inheriting the resource type from the parent node
if none is set".

But: We have a ResourceTypeProvider service interface, which you may
implement. This provider is called by the JcrResourceProvider if a node
has no sling:resourceType property.

In a custom resource provider, you could find a sling:resourceType
property up the ancestors of the node to build inheritance this way.

HTH

Regards
Felix

> 
> Ian
> 
> 
>> Registered servlets are not "bound to JCR nodes" but are added to the
>> resource tree at predefined locations. For example a servlet
>> registered with
>>
>>   sling.servlet.resourceTypes = "x"
>>   sling.servlet.extensions = "html"
>>
>> is added to the resource tree (by default) at
>>
>>   /apps/x/html.servlet
>>
>> This node (a leaf actually) in the resource tree is not backed by a JCR
>> item and is only accessible through the resource resolver and only
>> exists as long as the Servlet Resolver is active and the servlet is
>> registered.
>>
>> Hope this helps.
>>
>> Regards
>> Felix
> 
> 

Reply via email to