Commit 3ec64cf0 authored by Ard Schrijvers's avatar Ard Schrijvers

HSTTWO-4232 Check whether there is a component for the matched sitemap item

If there is no component, for example for a rest request, just return
whether the sitemap item is configured to cache or not
parent 9cf22869
......@@ -31,6 +31,7 @@ import org.hippoecm.hst.configuration.components.DelegatingHstComponentInfo;
import org.hippoecm.hst.configuration.components.HstComponentInfo;
import org.hippoecm.hst.configuration.hosting.Mount;
import org.hippoecm.hst.configuration.model.HstManager;
import org.hippoecm.hst.configuration.sitemap.HstSiteMapItem;
import org.hippoecm.hst.container.valves.AbstractOrderableValve;
import org.hippoecm.hst.content.tool.ContentBeansTool;
import org.hippoecm.hst.core.component.HstComponentException;
......@@ -478,12 +479,19 @@ public abstract class AbstractBaseOrderableValve extends AbstractOrderableValve
private boolean isSiteMapItemAndComponentConfigCacheable(final ResolvedSiteMapItem resolvedSitemapItem,
final ValveContext context) throws ContainerException {
if (!resolvedSitemapItem.getHstSiteMapItem().isCacheable()) {
final HstSiteMapItem hstSiteMapItem = resolvedSitemapItem.getHstSiteMapItem();
if (!hstSiteMapItem.isCacheable()) {
log.debug("'{}' is not cacheable because hst sitemapitem '{}' is not cacheable.", context
.getServletRequest(), resolvedSitemapItem.getHstSiteMapItem().getId());
.getServletRequest(), hstSiteMapItem.getId());
return false;
}
if (resolvedSitemapItem.getHstComponentConfiguration() == null) {
log.debug("Matched sitemap item '{}' does not have a (resolvable) component configuration (for example because " +
"the request might be a rest request). Return if the sitemap item is cacheable.", hstSiteMapItem.getId());
return hstSiteMapItem.isCacheable();
}
// check whether component rendering is true: For component rendering, we need to check whether the specific sub
// component (tree) is cacheable
String componentRenderingWindowReferenceNamespace = context.getRequestContext().getBaseURL()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment