tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject git commit: TAP5-1868: Fix the caching rules so that compressed resources are not sent to clients that don't support compression
Date Mon, 06 Aug 2012 22:50:40 GMT
Updated Branches:
  refs/heads/5.3 09707fb5f -> e070f6376


TAP5-1868: Fix the caching rules so that compressed resources are not sent to clients that
don't support compression

Conflicts:

	tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/SRSCachingInterceptor.java


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

Branch: refs/heads/5.3
Commit: e070f63767fd01471c65e8c0cba9067fababd786
Parents: 09707fb
Author: Howard M. Lewis Ship <hlship@apache.org>
Authored: Mon Aug 6 15:46:43 2012 -0700
Committer: Howard M. Lewis Ship <hlship@apache.org>
Committed: Mon Aug 6 15:50:16 2012 -0700

----------------------------------------------------------------------
 .../services/assets/SRSCachingInterceptor.java     |   14 +++++++++++++-
 .../assets/SRSCompressedCachingInterceptor.java    |    9 +++++++++
 2 files changed, 22 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e070f637/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/SRSCachingInterceptor.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/SRSCachingInterceptor.java
b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/SRSCachingInterceptor.java
index 427c1a7..a9bb9fd 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/SRSCachingInterceptor.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/SRSCachingInterceptor.java
@@ -44,7 +44,7 @@ public class SRSCachingInterceptor implements StreamableResourceSource,
Invalida
     public StreamableResource getStreamableResource(Resource baseResource, StreamableResourceProcessing
processing, ResourceDependencies dependencies)
             throws IOException
     {
-        if (processing == StreamableResourceProcessing.FOR_AGGREGATION)
+        if (!enableCache(processing))
         {
             return delegate.getStreamableResource(baseResource, processing, dependencies);
         }
@@ -81,4 +81,16 @@ public class SRSCachingInterceptor implements StreamableResourceSource,
Invalida
     {
         cache.clear();
     }
+
+    /**
+     * Returns true unless the processing is {@link StreamableResourceProcessing#FOR_AGGREGATION}.
+     * Subclasses may override. When the cache is not enabled, the request is passed on to
the interceptor's
+     * {@link #delegate}, and no attempt is made to read or update this interceptor's cache.
+     *
+     * @since 5.3.5
+     */
+    protected boolean enableCache(StreamableResourceProcessing processing)
+    {
+        return processing != StreamableResourceProcessing.FOR_AGGREGATION;
+    }
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e070f637/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/SRSCompressedCachingInterceptor.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/SRSCompressedCachingInterceptor.java
b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/SRSCompressedCachingInterceptor.java
index f065996..5428c1e 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/SRSCompressedCachingInterceptor.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/SRSCompressedCachingInterceptor.java
@@ -16,6 +16,7 @@ package org.apache.tapestry5.internal.services.assets;
 
 import org.apache.tapestry5.services.assets.CompressionStatus;
 import org.apache.tapestry5.services.assets.StreamableResource;
+import org.apache.tapestry5.services.assets.StreamableResourceProcessing;
 import org.apache.tapestry5.services.assets.StreamableResourceSource;
 
 /**
@@ -38,4 +39,12 @@ public class SRSCompressedCachingInterceptor extends SRSCachingInterceptor
         return resource.getCompression() == CompressionStatus.COMPRESSED;
     }
 
+    /**
+     * Returns true just when the processing enables compression.
+     */
+    @Override
+    protected boolean enableCache(StreamableResourceProcessing processing)
+    {
+        return processing == StreamableResourceProcessing.COMPRESSION_ENABLED;
+    }
 }


Mime
View raw message