CacheControlInterceptor prüft ETag jetzt auch, wenn If-Modified-Since fehlt
authorKai Moritz <kai@coolibri.de>
Thu, 23 Jun 2011 16:10:18 +0000 (18:10 +0200)
committerKai Moritz <kai@coolibri.de>
Thu, 23 Jun 2011 17:27:13 +0000 (19:27 +0200)
utils/cachecontrol/src/main/java/de/halbekunst/utils/cachecontrol/CacheControlInterceptor.java

index bc2dd3d..088e775 100644 (file)
@@ -114,13 +114,12 @@ public class CacheControlInterceptor implements HandlerInterceptor {
           response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
           return false;
         }
-        else {
-          if (ifNoneMatch.equals(eTag)) {
-            log.debug("ETag {} not changed: 304 {}", ifNoneMatch, request.getRequestURI());
-            response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
-            return false;
-          }
-        }
+      }
+
+      if (ifNoneMatch != null && ifNoneMatch.equals(eTag)) {
+        log.debug("{}: ETag {} not changed -> 304 ", request.getRequestURI(), ifNoneMatch);
+        response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
+        return false;
       }
 
       /** HTTP/1.1-Caching-Header richtig setzen!! */