You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2012/08/07 00:47:12 UTC
git commit: TAP5-1868: Fix the caching rules so that compressed
resources are not sent to clients that don't support compression
Updated Branches:
refs/heads/5.4-js-rewrite dd9ff941e -> 3679e3edb
TAP5-1868: Fix the caching rules so that compressed resources are not sent to clients that don't support compression
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/3679e3ed
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/3679e3ed
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/3679e3ed
Branch: refs/heads/5.4-js-rewrite
Commit: 3679e3edb891b51e1242e0842063b9517027eeee
Parents: dd9ff94
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Aug 6 15:46:43 2012 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Aug 6 15:46:43 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/3679e3ed/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 cf37808..b4cc161 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
@@ -43,7 +43,7 @@ public class SRSCachingInterceptor extends DelegatingSRS
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);
}
@@ -75,4 +75,16 @@ public class SRSCachingInterceptor extends DelegatingSRS
{
return true;
}
+
+ /**
+ * 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/3679e3ed/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 ce95a39..4e13877 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;
+ }
}