Commits

ltor...@81dbac14-341a-0410-aa85-cbcd92e6f43e  committed 5cc297d

bug only use expires headers for non fragments
hints by fragments added

  • Participants
  • Parent commits 9740545

Comments (0)

Files changed (1)

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

         this.fragment = fragment;
         this.expires = expires;
         
-        // only set the last modified value, if a complete page is cached
+        // only set inital values for last modified and expires, when a complete page is cached
         if (!fragment) {
             // setting a default last modified value based on object creation and remove the millis
             long current = System.currentTimeMillis() / 1000;
         }
 
         // only set the last modified value, if a complete page is cached
-        if ((!fragment) && (CacheFilter.HEADER_LAST_MODIFIED.equalsIgnoreCase(name))) {
-            result.setLastModified(value);
-        }
+        if (CacheFilter.HEADER_LAST_MODIFIED.equalsIgnoreCase(name)) {
+            if (!fragment) {
+                result.setLastModified(value);
+            } // TODO should we return now by fragments to avoid putting the header to the response?
+        } 
 
         // implement RFC 2616 14.21 Expires (without max-age)
         if ((expires != CacheFilter.EXPIRES_OFF) && (CacheFilter.HEADER_EXPIRES.equalsIgnoreCase(name))) {
-            result.setExpires(value);
-        }
+            if (!fragment) {
+                result.setExpires(value);
+            } // TODO should we return now by fragments to avoid putting the header to the response?
+        } 
 
         super.setDateHeader(name, value);
     }
         }
 
         // only set the last modified value, if a complete page is cached
-        if ((!fragment) && (CacheFilter.HEADER_LAST_MODIFIED.equalsIgnoreCase(name))) {
-            result.setLastModified(value);
-        }
+        if (CacheFilter.HEADER_LAST_MODIFIED.equalsIgnoreCase(name)) {
+            if (!fragment) {
+                result.setLastModified(value);
+            } // TODO should we return now by fragments to avoid putting the header to the response?
+        } 
 
         // implement RFC 2616 14.21 Expires (without max-age)
         if ((expires != CacheFilter.EXPIRES_OFF) && (CacheFilter.HEADER_EXPIRES.equalsIgnoreCase(name))) {
-            result.setExpires(value);
-        }
+            if (!fragment) {
+                result.setExpires(value);
+            } // TODO should we return now by fragments to avoid putting the header to the response?
+        } 
 
         super.addDateHeader(name, value);
     }