After applying the upgrade from 6.5.14 to 6.5.15, com.cognifide.cq (sling-dynamic-include) stopped working as it was before the upgrade. Something in the new upgrade package is affected.
Tell me what could be, please.
It looks like the filters don't work anymore, unfortunately, I can't track down what isn't working right. The bundle is active. We are using the 2.0.4 com.cognifide.cq version.
Thanks.
Solved! Go to Solution.
Views
Replies
Total Likes
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);
}
}
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
@aliaksandr_hvozdzeu can you please let know the reason why you are using different version other than official apache sdi?
https://github.com/apache/sling-org-apache-sling-dynamic-include
This is a very old code that hasn't been changed in a long time. This code is currently only supported. At the moment, we consider the option of making changes as the latest option. Maybe you have an idea what could have affected?
Until 6.5.15 there were no problems.
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);
}
}
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
Many thanks for your help. I kind of figured it out.
Views
Likes
Replies