Index: components/core/src/main/java/org/hippoecm/hst/core/container/PageInfoRenderingValve.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- components/core/src/main/java/org/hippoecm/hst/core/container/PageInfoRenderingValve.java	(revision 39010)
+++ components/core/src/main/java/org/hippoecm/hst/core/container/PageInfoRenderingValve.java	(revision )
@@ -39,7 +39,7 @@
  */
 public class PageInfoRenderingValve extends AbstractBaseOrderableValve {
 
-    static final String PAGE_INFO = PageInfoRenderingValve.class.getName() + ".pageInfo";
+    public static final String PAGE_INFO = PageInfoRenderingValve.class.getName() + ".pageInfo";
     private static final Logger log = LoggerFactory.getLogger(PageInfoRenderingValve.class);
 
     @Override
Index: components/core/src/main/java/org/hippoecm/hst/core/container/AbstractBaseOrderableValve.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- components/core/src/main/java/org/hippoecm/hst/core/container/AbstractBaseOrderableValve.java	(revision 39010)
+++ components/core/src/main/java/org/hippoecm/hst/core/container/AbstractBaseOrderableValve.java	(revision )
@@ -59,7 +59,7 @@
     
     protected final static Logger log = LoggerFactory.getLogger(AbstractBaseOrderableValve.class);
 
-    private final static String PAGE_INFO_CACHEABLE = PageInfoRenderingValve.class.getName() + ".pageInfoCacheable";
+    public final static String PAGE_INFO_CACHEABLE = PageInfoRenderingValve.class.getName() + ".pageInfoCacheable";
 
     protected ContainerConfiguration containerConfiguration;
     protected HstManager hstManager;
Index: components/core/src/main/java/org/hippoecm/hst/core/container/EsiInfoCacheKeyFragmentCreator.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- components/core/src/main/java/org/hippoecm/hst/core/container/EsiInfoCacheKeyFragmentCreator.java	(revision )
+++ components/core/src/main/java/org/hippoecm/hst/core/container/EsiInfoCacheKeyFragmentCreator.java	(revision )
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2013 Hippo B.V. (http://www.onehippo.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.hippoecm.hst.core.container;
+
+import java.io.Serializable;
+
+import org.hippoecm.hst.core.request.HstRequestContext;
+
+public class EsiInfoCacheKeyFragmentCreator implements RequestInfoCacheKeyFragmentCreator {
+
+    public Serializable create(HstRequestContext requestContext) {
+        // TODO return something including NAMESPACE of component rendering URL for ESI include
+        return requestContext.getBaseURL().getPathInfo();
+    }
+
+}
Index: components/core/src/main/java/org/hippoecm/hst/cache/esi/ESIPageRenderer.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- components/core/src/main/java/org/hippoecm/hst/cache/esi/ESIPageRenderer.java	(revision 39010)
+++ components/core/src/main/java/org/hippoecm/hst/cache/esi/ESIPageRenderer.java	(revision )
@@ -29,15 +29,18 @@
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.james.mime4j.util.MimeUtil;
+import org.hippoecm.hst.cache.HstPageInfo;
 import org.hippoecm.hst.configuration.hosting.MatchException;
 import org.hippoecm.hst.configuration.model.HstManager;
 import org.hippoecm.hst.container.HstContainerConfigImpl;
 import org.hippoecm.hst.container.RequestContextProvider;
+import org.hippoecm.hst.core.container.AbstractBaseOrderableValve;
 import org.hippoecm.hst.core.container.ComponentManager;
 import org.hippoecm.hst.core.container.ComponentManagerAware;
 import org.hippoecm.hst.core.container.ContainerException;
 import org.hippoecm.hst.core.container.HstContainerConfig;
 import org.hippoecm.hst.core.container.HstContainerURL;
+import org.hippoecm.hst.core.container.PageInfoRenderingValve;
 import org.hippoecm.hst.core.container.Pipeline;
 import org.hippoecm.hst.core.container.Pipelines;
 import org.hippoecm.hst.core.internal.HstMutableRequestContext;
@@ -248,6 +251,10 @@
         HttpServletResponse response = requestContext.getServletResponse();
         HstContainerURL baseURL = requestContext.getBaseURL();
 
+        // TODO improve below the hack to set PAGE_INFO and PAGE_INFO_CACHEABLE to null
+        request.setAttribute(PageInfoRenderingValve.PAGE_INFO, null);
+        request.setAttribute(AbstractBaseOrderableValve.PAGE_INFO_CACHEABLE, null);
+
         try {
             ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
 
@@ -281,6 +288,11 @@
                         log.warn("Failed to clean up content window rendering pipeline. {}", e.toString());
                     }
                 }
+            }
+
+            HstPageInfo pageInfo = (HstPageInfo) request.getAttribute(PageInfoRenderingValve.PAGE_INFO);
+            if (pageInfo != null) {
+                pageInfo.writeContent(responseWrapper);
             }
 
             responseWrapper.flush();
Index: components/core/src/main/resources/org/hippoecm/hst/site/container/SpringComponentManager-pipelines.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- components/core/src/main/resources/org/hippoecm/hst/site/container/SpringComponentManager-pipelines.xml	(revision 39010)
+++ components/core/src/main/resources/org/hippoecm/hst/site/container/SpringComponentManager-pipelines.xml	(revision )
@@ -147,12 +147,20 @@
 
   <bean id="requestInfoCacheKeyFragmentCreator" class="org.hippoecm.hst.core.container.DefaultRequestInfoCacheKeyFragmentCreator" />
 
+  <bean id="esiInfoCacheKeyFragmentCreator" class="org.hippoecm.hst.core.container.EsiInfoCacheKeyFragmentCreator" />
+
   <bean id="pageCachingValve" parent="abstractValve" class="org.hippoecm.hst.core.container.PageCachingValve">
     <constructor-arg ref="requestInfoCacheKeyFragmentCreator" />
     <property name="valveName" value="pageCachingValve" />
     <property name="pageCache" ref="pageCache"/>
   </bean>
 
+  <bean id="esiCachingValve" parent="abstractValve" class="org.hippoecm.hst.core.container.PageCachingValve">
+    <constructor-arg ref="esiInfoCacheKeyFragmentCreator" />
+    <property name="valveName" value="esiCachingValve" />
+    <property name="pageCache" ref="pageCache"/>
+  </bean>
+
   <bean id="aggregationValve" parent="abstractValve" class="org.hippoecm.hst.core.container.AggregationValve">
     <property name="valveName" value="aggregationValve" />
     <property name="asynchronousComponentWindowRendererMap" ref="asynchronousComponentWindowRendererMap" />
@@ -227,6 +235,7 @@
               <list>
                 <ref bean="contextResolvingValve" />
                 <ref bean="resourceServingValve" />
+                <ref bean="esiCachingValve"/>
                 <ref bean="componentRenderingValve" />
                 <ref bean="aggregationValve" />
               </list>
