Anonymous avatar Anonymous committed df31858

fix for CACHE-297 max-age parameter not set on ResponseContent object returned from cache when using MAX_AGE_NO_INIT

Comments (0)

Files changed (1)

src/java/com/opensymphony/oscache/web/filter/CacheHttpServletResponseWrapper.java

             // setting a default last modified value based on object creation and remove the millis
             if (lastModified == CacheFilter.LAST_MODIFIED_INITIAL) {
                 long current = System.currentTimeMillis();
-    			current = current - (current % 1000);
+                current = current - (current % 1000);
                 result.setLastModified(current);
                 super.setDateHeader(CacheFilter.HEADER_LAST_MODIFIED, result.getLastModified());
             }
             }
             // setting the cache control with max-age 
             if (this.cacheControl == CacheFilter.MAX_AGE_TIME) {
-            	// set the count down
+                // set the count down
                 long maxAge = System.currentTimeMillis();
                 maxAge = maxAge - (maxAge % 1000) + time;
                 result.setMaxAge(maxAge);
             } else if (this.cacheControl != CacheFilter.MAX_AGE_NO_INIT) {
                 result.setMaxAge(this.cacheControl);
                 super.addHeader(CacheFilter.HEADER_CACHE_CONTROL, "max-age=" + (-this.cacheControl));
+            } else if (this.cacheControl == CacheFilter.MAX_AGE_NO_INIT ) {
+                result.setMaxAge(this.cacheControl);
             }
         }
     }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.