Lines resolution script call order

I was looking at how sling would call the script based on url. In the case of a selector, this seems like a good thing, but if I don't use a selector it confuses my understanding:

I have a page /content/AEMProject/English/test.html

that has resourceType AEMProject/components/page/basepage

basic resouce page has 4 file script: basepage.html.jsp , basepage.jsp , html.jsp, GET.jsp

. I color in the Sling Best Match concept. So, I have two strange cases.

1) Fulfills mine basepage.html.jsp

, as I consider it the best match. In case I delete this file html.jsp

but consider it basepage.jsp

as the second best case.

2) In case of deleting basepage.html.jsp , basepage.jsp , html.jsp

files, mine GET.jsp

does not display.

I am considering the base page here as a selector, or IS is not.

thank

+3


source to share


1 answer


Quoting from the sling docs , the rules for script path definition are defined as follows:

  • The more query selectors are matched, the better.

(Note that a script with more than one selector is not selectable, i.e. if you have script xyjsp where x and y are your selectors, it is ignored by sling. Select the script y.jsp

that is in the folder x

, that is, if the request for test.xyhtml, then

-basepage
 |_x
   |_y.jsp (selected)
 |_x.y.jsp (ignored)
 |_x.jsp (selected in case x/y.jsp is not present. The script containing the first selector is chosen in such cases.)

      



  • A script including request extension matches more than one without request extension (html only)

  • A script previously found matches are better than script found later in the processing order. This means that the script is closer to the original resource type in the resource type hierarchy discussed earlier.

So now, to answer your questions,

  • Your html.jsp will always give preference to your .jsp component and not the other way around.

  • Your GET.jsp should execute in the worst case, i.e. when none of the other files are present, unless you inherited this from some other component.

+3


source







All Articles