Hi @aliaksandr_hvozdzeu,
Please find answer for your question below.
Why SDI 2.0.4 is not working after upgrade from AEM 6.5.14 to AEM 6.5.15?
It is because value of javax.servlet.include.servlet_path request attribute has changed. In AEM 6.5.14 you get empty string as value, in 6.5.15 it is null. Above request attribute is used in accepts(SlingHttpServletRequest request) method from com.cognifide.cq.includefilter.processor.IncludeTagWritingProcessor class. Looking into code you can see that in case above attribute is null, accepts method will always return false, so request processing will never end up successfully on SDI level.
public boolean accepts(SlingHttpServletRequest request) {
Object servletPath = request.getAttribute("javax.servlet.include.servlet_path");
Enumeration<?> params = request.getParameterNames();
if (params.hasMoreElements()) {
return false;
} else if (servletPath == null) {
return false;
} else {
String resourceType = request.getResource().getResourceType();
return this.config.isSupportedResourceType(resourceType, request);
}
}
https://github.com/wttech/Sling-Dynamic-Include/blob/052b530cac64a1cbcb335103fdb68d56e50cebee/src/main/java/com/cognifide/cq/includefilter/processor/IncludeTagWritingProcessor.java#L41
What is the reason of above behavior after upgrade from AEM 6.5.14 to AEM 6.5.15?
Long story short, Apache Felix Http Jetty (org.apache.felix.http.jetty) version has changed from 4.1.12 on AEM 6.5.14 to 4.2.2 on AEM 6.5.15.
Solutions
- workaround will be to downgraded version of Apache Felix Http Jetty (org.apache.felix.http.jetty) to 4.1.12 on AEM 6.5.15. This will make SDI work, of course this is not recommended approach, because you will end up with AEM version that is not supported. Nevertheless technically this is possible. For education purposes I did this change on my local machine and it worked. In case you would like to verify this on your own, remember to restart AEM after you install Apache Felix Http Jetty (org.apache.felix.http.jetty) older version. Once again, I will point out that this is not recommended way, and if you will decide go that way you're doing it on your own risk.
- proper way, will be to upgrade SDI version. I understand that in case system is only in support mode, you would like to reduce amount of effort. In that case you can experiment with older versions of SDI, e.g. version 2.1.0 is not rely on javax.servlet.include.servlet_path request attribute, so maybe that will work. However I would consider to upgrade to the latest one, most likely this will eliminate potentially issues after future upgrades of AEM. Last but not least, SDI upgrade does not seem to be difficult, and with new version you will also get new features like regular expression support etc.
https://sling.apache.org/documentation/bundles/dynamic-includes.html
https://github.com/apache/sling-org-apache-sling-dynamic-include