Das Caching darf erst für cache-seconds < 0 vollständig unterdrückt werden
[percentcodec] / cachecontrol / src / main / java / de / halbekunst / juplo / cachecontrol / CacheControl.java
index 6ded011..c3e7c99 100644 (file)
@@ -120,7 +120,7 @@ public class CacheControl {
     }
 
     int cacheSeconds = handle.getCacheSeconds(request);
-    if (cacheSeconds < 1) {
+    if (cacheSeconds < 0) {
       log.debug("{}: caching disabled!", url);
       response.setDateHeader(Headers.HEADER_DATE, handle.getTimestamp());
       response.setDateHeader(Headers.HEADER_EXPIRES, 0);
@@ -130,6 +130,8 @@ public class CacheControl {
       response.addHeader(Headers.HEADER_CACHE_CONTROL, "no-store");
       response.addHeader(Headers.HEADER_CACHE_CONTROL, "max-age=0");
       response.addHeader(Headers.HEADER_CACHE_CONTROL, "s-max-age=0");
+      if (handle.isZipped())
+        response.addHeader(Headers.HEADER_CONTENT_ENCODING, "gzip");
       return true;
     }
 
@@ -326,7 +328,6 @@ public class CacheControl {
 
       cacheSeconds = CacheControl.this.defaultCacheSeconds;
       lastModified = CacheControl.this.defaultLastModified;
-      eTag = "";
 
       /** Class-Level-Annotations auslesen */
       for (Annotation annotation : handler.getClass().getAnnotations()) {