AEM - Content Rendering on a Page
1) How the content will be displayed or content rendering happen in a AEM Web Page or HTML page
2) Sling Script Resolution (From User HTTP Request to render the content - process steps)
AEM is built on Sling, SLING is a web application framework based on REST Principles that provides easy development of content-oriented
applications like AEM
Sling is Content centric - for Sling everything is Content, this means, processing is focused on Content
As each HTTP request is mapped to the Content in the form of JCR Resource,
The first target is JCR Node holding the content and second step is representation or a script, which is located from the resource properties
with certain parts of the Request like 'Selector' or 'Extensions'
Content Rendering in AEM will be devided into Four important steps:
1) URL Decomposition
2) Mapping Request to Resources
3) Scripts Resolution
4) Invoking Rendering Chain
======
In Sling processing is driven by the URL of the User request.This defines the content to be displayed by the appropriate scripts.
As soon as the user request through the URL, that URL is devided into various sections
1) Protocal (generally it will be HTTP)
2) Host (youcompany.com / website name / domain name) -- localhost:4502
3) Content path (which is JCR Node path) - which specify the content to be rendered (/content/us/en/products/)
4) Selectors are used for alternative rendering of the content (.country. or .mobile.)
5) Extension specifies the output format (html, json , etc), it also specified the scripts to be used for the rendering process
6) Suffix can be used to specify additional information
7) Parameters are used for Dynamic rendering of the content ( ?country=US)
Once the URL decomposition is complete - Mapping of request to resources is done
within in Sling - scripts can not be called directly -- this will break the Concept of REST - which mix Resources and Representations
Once you have found the content to be rendered - we look for the script, which can render the content
will do that by looking into sling:resourceType Property
Once the content to be rendered found in the repository , the location of the script will found using sling:resourceType property
All sling scripts are stored in subdirectories of /apps or /libs directory
/apps directory has the Higher preference than /libs directory
So the path found in sling:resourceType - will go and search in /apps directory and then go to /lobs directory
If multiple scripts apply for a given request - the script will be selected with the BEST MATCH
we can refer to APACH SLING CHEAT SHEET for more details