Ben Oeyen created SLING-12043:
---------------------------------
Summary: Incorrect virtual include path when passing resource to
data-sly-resource
Key: SLING-12043
URL: https://issues.apache.org/jira/browse/SLING-12043
Project: Sling
Issue Type: Bug
Affects Versions: Dynamic Include 3.3.0
Environment: Adobe Experience Manager On Premise 6.5 with Service Pack
13 or higher
Reporter: Ben Oeyen
When upgrading AEM Service Pack 11 to Service Pack 18 we noticed issues with
Sling Dynamic include. The virtual include paths contained the resourcetype as
a postfix to the path where we did not expect that.
We traced it back to the the includeTagFilter.java thinking the resource is
synthetic in the buildUrl method:
{code:java}
private String buildUrl(Configuration config, SlingHttpServletRequest
request) {
final Resource resource = request.getResource();
final boolean synthetic =
ResourceUtil.isSyntheticResource(request.getResource());
return UrlBuilder.buildUrl(config.getIncludeSelector(),
resource.getResourceType(), synthetic, config, request.getRequestPathInfo());
} {code}
We contacted Adobe Support and they reported that they did make a change in the
responsivegrid.html in Service Pack 13.
Service pack 11 responsivegrid.html
{code:java}
...
<sly data-sly-test="${!isAllowedApplicable}"
data-sly-repeat.child="${api.paragraphs}"
data-sly-resource="${child.path @ decoration='true',
cssClassName=child.cssClass}"></sly>
... {code}
Was changed in Service pack 13 to:
{code:java}
...
<sly data-sly-test="${!isAllowedApplicable}"
data-sly-repeat.child="${api.paragraphs}"
data-sly-resource="${child.resource @ decoration='true',
cssClassName=child.cssClass}"></sly>
... {code}
Because Adobe is not officially supporting Sling Dynamic Includes hence i'm
creating this ticket. As a temporary workaroud we overlayed the
reponsivegrid.html with the SP11 version to mitigate this issue.
*Steps to reproduce this issue:*
1) Install AEM 6.5 with sample content
2) Create a new XF fragment
3) Add an XF component to a page and pick the previously created XF fragment
4) Install Sling Dynamic Include via the OSGI Console
5) Configure Sling Dynamic Include via OSGi Console
{code:java}
Enable = true
resource types = cq/experience-fragments/editor/components/experiencefragment
{code}
6) Confirm we get a virtual include via curl
{code:java}
curl -u admin:admin -H "Server-Agent: Communique-Dispatcher"
http://localhost:4502/content/we-retail/language-masters/en.html {code}
{code:java}
...
<!--#include
virtual="/content/we-retail/language-masters/en/_jcr_content/root/responsivegrid/experiencefragment.nocache.html"
-->
...
{code}
7) Do the change from child.path to child.resource via CRX/DE on
{code:java}
/libs/wcm/foundation/components/responsivegrid/responsivegrid.html line 27
{code}
8) Confirm we get a wrong virtual include path via curl
{code:java}
curl -u admin:admin -H "Server-Agent: Communique-Dispatcher"
http://localhost:4502/content/we-retail/language-masters/en.html {code}
{code:java}
...
<!--#include
virtual="/content/we-retail/language-masters/en/_jcr_content/root/responsivegrid/experiencefragment.nocache.html/cq/experience-fragments/editor/components/experiencefragment"
-->
...
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)