Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

SLING URL DECOMPOSITION

Avatar

Level 3

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?

 

 

1 Accepted Solution

Avatar

Correct answer by
Level 5
14 Replies

Avatar

Level 3

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

Avatar

Correct answer by
Level 5

Avatar

Level 5

@Prashanth_02a -

https://experienceleague.adobe.com/docs/experience-manager-65/developing/introduction/the-basics.htm...

 

  • various script engines are supported:

    • HTL (HTML Template Language - Adobe Experience Manager’s preferred and recommended server-side template system for HTML): .html
    • ECMAScript (JavaScript) Pages (server-side execution): .esp, .ecma
    • Java Server Pages (server-side execution): .jsp
    • Java Servlet Compiler (server-side execution): .java
    • JavaScript templates (client-side execution): .jst

Avatar

Employee

@Prashanth_02a Please see below link for an example. Ideally combination of selector and extensions takes the highest priority. Same has been explained in this link:
https://aemgeeks.wordpress.com/2017/07/31/sling-resource-resolution-sling-request-processing/#:~:tex...).

Avatar

Level 3

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

Avatar

Community Advisor

@Prashanth_02a 

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

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

 

Hope this helps.

 

 

Avatar

Level 3

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

Avatar

Community Advisor

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

 

Avatar

Employee Advisor

Have you already tried it out? 🙂

 

 

Avatar

Employee Advisor

You will get a 404 if

* you are requesting a non-existing content node

* if a resourcetype is given but does not exist