SLING URL DECOMPOSITION | Community
Skip to main content
Level 3
Nov 4, 2022 2:17 PM UTC
Solved

SLING URL DECOMPOSITION

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.

14 replies

joerghoh
Employee
Nov 4, 2022 7:33 PM UTC

Have you already tried it out? 🙂

 

 

Translate
Level 3
Nov 5, 2022 1:18 PM UTC

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

Translate
joerghoh
Employee
Nov 14, 2022 12:53 PM UTC

You will get a 404 if

* you are requesting a non-existing content node

* if a resourcetype is given but does not exist

Translate
Manu_Mathew_
New Participant
Nov 4, 2022 4:32 PM UTC

@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.

 

 

Translate
Level 3
Nov 4, 2022 5:15 PM UTC

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

Translate
Manu_Mathew_
New Participant
Nov 4, 2022 5:33 PM UTC

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

 

Translate
Level 3
Nov 4, 2022 5:16 PM UTC

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

Translate
Level 3
Nov 4, 2022 2:38 PM UTC

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

Translate
manjunathdj
New Participant
Nov 4, 2022 2:49 PM UTC

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

Translate