Hi,
I am looking into how Sling script resolution works for non-trivial
script-names and I need some help/advice.
( This is possibly a sling-beginner problem. )
Here’s a simple example to illustrate my question/problem. Let’s assume:
- /content/demo = {
“jcr:primaryType”: “nt:unstructured”,
“sling:resourceType”: “myType”
}
Scenario 1:
- /apps/myType/selector.GET.esp - random text file ( this is the only file in
this folder )
- GET http://.../content/demo.selector.myExt request
Scenario 2:
- /apps/myType/myType.GET.esp - random text file ( this is the only file in
this folder )
- GET http://.../content/demo.selector.myExt request
Problem:
- in S1 the script is matched even if the request extension (myExt) is not the
default one (html ).
- in S2 the script is not matched because the myExt != html. Either changing
the request to ext=html or renaming the script to myType.myExt.GET.esp changes
the behavior.
Why is the script matched in S1 and not in S2?
Before bumping into this example I used to think that a script name containing
resourceTypeLabel/selectorPath looks like:
- {resourceTypeLabel}{requestExtension | default_if_missing=html}{method |
default_if_missing=GET}.{scriptExtension} - ex: myType.http.GET.esp
- {selectorPath}{requestExtension | default_if_missing=html}{method |
default_if_missing=GET}.{scriptExtention} - ex: sel1/sel2.http.GET.esp
(There are other possible names without resourceTypeLabel or selectorPath that
are not relevant for this problem. Example: GET.esp or myExt.esp )
Is the example an exception or are my “best-match" rules incorrect? Is the
default=html only for scripts with resourceTypeLabel in the script name?
Thank you,
TeoRosu