You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/12/10 00:09:18 UTC
svn commit: r1549704 - in
/tomcat/trunk/java/org/apache/catalina/webresources: Cache.java
CachedResource.java
Author: markt
Date: Mon Dec 9 23:09:18 2013
New Revision: 1549704
URL: http://svn.apache.org/r1549704
Log:
If a file is too big to be cached, return the original resource not the CacheResource instance else the resource content will still be cached.
Modified:
tomcat/trunk/java/org/apache/catalina/webresources/Cache.java
tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java
Modified: tomcat/trunk/java/org/apache/catalina/webresources/Cache.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/webresources/Cache.java?rev=1549704&r1=1549703&r2=1549704&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/webresources/Cache.java (original)
+++ tomcat/trunk/java/org/apache/catalina/webresources/Cache.java Mon Dec 9 23:09:18 2013
@@ -78,10 +78,12 @@ public class Cache {
// newCacheEntry was inserted into the cache - validate it
cacheEntry = newCacheEntry;
cacheEntry.validate(useClassLoaderResources);
- if (newCacheEntry.getContentLength() > getMaxSizeBytes()) {
+ if (cacheEntry.getContentLength() > getMaxSizeBytes()) {
// Cache size has not been updated at this point
removeCacheEntry(path, false);
- return newCacheEntry;
+ // Return the original resource not the one wrapped in the
+ // cache otherwise content will be cached any way.
+ return cacheEntry.getWebResource();
}
// Assume that the cache entry will include the content.
Modified: tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java?rev=1549704&r1=1549703&r2=1549704&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java (original)
+++ tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java Mon Dec 9 23:09:18 2013
@@ -262,4 +262,8 @@ public class CachedResource implements W
public WebResourceRoot getWebResourceRoot() {
return webResource.getWebResourceRoot();
}
+
+ WebResource getWebResource() {
+ return webResource;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org