Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

SLING URL DECOMPOSITION

Avatar

Level 4

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 4

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

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

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

@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