[ 
https://issues.apache.org/jira/browse/SLING-10706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17395256#comment-17395256
 ] 

Konrad Windszus edited comment on SLING-10706 at 8/7/21, 3:56 PM:
------------------------------------------------------------------

I think we have a broader issue to solve here than just same name selectors:

resourceTypes don't necessarily need a script which is registered to the 
resourceLabel, default extension (html) or default method (GET) as defined in 
https://github.com/apache/sling-scriptingbundle-maven-plugin/blob/76bf25f23fd3ce3d5381db7423a6c01909dcd075/src/main/java/org/apache/sling/scriptingbundle/plugin/processor/ResourceTypeFolderPredicate.java#L70.
 In general every script in arbitrary folders may define its own resource types 
(potentially only for a specific selector) as well as selectors for parent 
folders till root, e.g. {{/apps/foo/bar/test.html}} defines

1. a script for resource type {{/apps/foo/bar}} and selector {{test}}
2. a script for resource type {{/apps/foo}} and selectors {{bar.test}} and even
3. a script for resource type {{/apps}} and selectors {{foo.bar.test}}

I am not sure whether the amount of resource types we would need to register 
leads to issues with the capability registry in OSGi, but that is the current 
logic for resource scripts.


was (Author: kwin):
I think we have a broader issue to solve here than just same name selectors:

resourceTypes don't necessarily need a script which is registered to the 
resourceLabel, default extension (html) or default method (GET) as defined in 
https://github.com/apache/sling-scriptingbundle-maven-plugin/blob/76bf25f23fd3ce3d5381db7423a6c01909dcd075/src/main/java/org/apache/sling/scriptingbundle/plugin/processor/ResourceTypeFolderPredicate.java#L70.
 In general every script in arbitrary folders may define its own resource types 
(potentially only for a specific selector) as well as selectors for parent 
folders till root, e.g. {{/apps/foo/bar/test.html}} defines

1. a script for resource type {{/apps/foo/bar}} and selector {{test}}
2. a script for resource type {{/apps/foo}} and selectors {{bar.test}} and even
3. a script for resource type {{/apps}} and selectors {{foo.bar.test}}

I am not sure whether the amount of resource types we would need to register 
lead to issues with the capability registry in OSGi, but that is the current 
logic for resource scripts.

> Order of selectors not kept
> ---------------------------
>
>                 Key: SLING-10706
>                 URL: https://issues.apache.org/jira/browse/SLING-10706
>             Project: Sling
>          Issue Type: Bug
>          Components: Maven Plugins and Archetypes
>    Affects Versions: Scripting Bundle Maven Plugin 0.3.0
>            Reporter: Konrad Windszus
>            Priority: Major
>             Fix For: Scripting Bundle Maven Plugin 0.4.0
>
>
> The selectors used for registration of script/servlets have an order: Only if 
> they appear in the given order the script/servlet matches 
> (https://sling.apache.org/documentation/the-sling-engine/servlets.html#servlet-registration).
> The order is potentially lost, though during the generation of the 
> capabilities headers as the code is using Sets internally.
> Also it is totally valid to register a script to "myselector.myselector" 
> which cannot be expressed with Sets either.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to