SLING URL DECOMPOSITION | Community
Skip to main content
Level 3
November 4, 2022
Solved

SLING URL DECOMPOSITION

  • November 4, 2022
  • 4 replies
  • 3642 views

When the request url is lets say /content/myapp.html and sling:resourceType of myapp is /apps/myapp/components/myappcomponent.

 

Scenario 1: under myappcomponent, lets say there are  following files myappcomponent.html, myappcomponent.esp

 

In this case myappcomponent.html will be rendered.

 

Scenario 2: under myappcomponent, lets say there are  following files myappcomponent.esp

 

In this case myappcomponent.esp will be rendered.

 

Scenario 3: under myappcomponent, lets say there are  following files myappcomponent.json,myappcomponent.js,myappcomponent.txt

 

what will be rendered in this case????????

 

Question: is there any other fallback extensions which are supported in Sling if there is no applicable extension which is requested?

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

4 replies

Level 3
November 4, 2022

@manjunathdj I searched SLING and ADOBE Documentations as well, not found it anywhere. 

manjunathdj
November 4, 2022

@prashanthal  - Are you looking to render Json or JS files? 

krati_garg
Adobe Employee
Adobe Employee
November 4, 2022
Level 3
November 4, 2022

@krati_garg This example is demonstrating only .html and .esp as I mentioned in my query, not others.

Manu_Mathew_
Community Advisor
Community Advisor
November 4, 2022

@prashanthal 

selectors have maximum priority and the more selectors are matched the highest the priority. If selectors are not matched then the extension gets priority.

 

It follows the below pattern:

{resourceTypeLabel}.{selectorString}.{requestMethod}.{requestExtension}.{scriptExtension}

 

https://experienceleague.adobe.com/docs/experience-manager-65/developing/platform/sling-cheatsheet.html?lang=en

for more details ref. https://issues.apache.org/jira/browse/SLING-387

 

Hope this helps.

 

 

Level 3
November 4, 2022

@manu_mathew_ @This example is demonstrating only .html and .esp as I mentioned in my query, not others

Manu_Mathew_
Community Advisor
Community Advisor
November 4, 2022

For Scenario 3: I believe none of them will render.

As far as I remember jsp,esp,html are suppported.

for all other than html - the suffix is added to the script name

eg: 

 /myappcomponent.js.esp

 /myappcomponent.json.esp

 /myappcomponent.txt.esp

 

joerghoh
Adobe Employee
Adobe Employee
November 4, 2022

Have you already tried it out? 🙂

 

 

Level 3
November 5, 2022

@joerghoh Yup, I already tried it, getting 404.

joerghoh
Adobe Employee
Adobe Employee
November 14, 2022

You will get a 404 if

* you are requesting a non-existing content node

* if a resourcetype is given but does not exist