You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2013/06/05 02:28:00 UTC

git commit: Set the correct Cache-Control header on module requests to force re-validation on each page

Updated Branches:
  refs/heads/master 7f5767b77 -> 1bb0d1c23


Set the correct Cache-Control header on module requests to force re-validation on each page


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/1bb0d1c2
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/1bb0d1c2
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/1bb0d1c2

Branch: refs/heads/master
Commit: 1bb0d1c238757672f864c79b2cc5d606aa277b75
Parents: 7f5767b
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Tue Jun 4 17:27:54 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Tue Jun 4 17:27:54 2013 -0700

----------------------------------------------------------------------
 .../internal/services/ResourceStreamerImpl.java    |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1bb0d1c2/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ResourceStreamerImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ResourceStreamerImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ResourceStreamerImpl.java
index 6b41cc8..9eff1e8 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ResourceStreamerImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ResourceStreamerImpl.java
@@ -168,6 +168,14 @@ public class ResourceStreamerImpl implements ResourceStreamer
             response.setDateHeader("Expires", lastModified + InternalConstants.TEN_YEARS);
         }
 
+        // This is really for modules, which can not have a content hash code in the URL; therefore, we want
+        // the browser to re-validate the resources on each new page render; because of the ETags, that will
+        // mostly result in quick SC_NOT_MODIFIED responses.
+        if (options.contains(Options.OMIT_EXPIRATION))
+        {
+            response.setHeader("Cache-Control", "max-age=0, must-revalidate");
+        }
+
         response.setContentLength(streamable.getSize());
 
         if (streamable.getCompression() == CompressionStatus.COMPRESSED)