From e608524cacfb0e5faa8bb58f0921e188e0aa40b6 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Fri, 23 Dec 2011 13:33:25 +0100 Subject: [PATCH] =?utf8?q?Verwirrenden=20Variable-Name=20"controller"=20in?= =?utf8?q?=20CacheControl=20in=20"handle"=20ge=C3=A4ndert?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../juplo/cachecontrol/CacheControl.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/cachecontrol/src/main/java/de/halbekunst/juplo/cachecontrol/CacheControl.java b/cachecontrol/src/main/java/de/halbekunst/juplo/cachecontrol/CacheControl.java index b2482277..2c909e81 100644 --- a/cachecontrol/src/main/java/de/halbekunst/juplo/cachecontrol/CacheControl.java +++ b/cachecontrol/src/main/java/de/halbekunst/juplo/cachecontrol/CacheControl.java @@ -49,10 +49,10 @@ public class CacheControl { ) { try { - CacheMethodHandle controller = CacheControl.tl.get(); + CacheMethodHandle handle = CacheControl.tl.get(); /** Doppelte Ausführung verhindern... */ - if (controller == null) { + if (handle == null) { /** Dekoration wurde bereits durchgeführt! */ return true; } @@ -62,10 +62,10 @@ public class CacheControl { * http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.18 RFC 2616, * Abschnitt 14.18} einen Date-Header enthalten */ - response.setDateHeader(Headers.HEADER_DATE, controller.getTimestamp()); + response.setDateHeader(Headers.HEADER_DATE, handle.getTimestamp()); /** Besondere Maßnahmen für besondere HTTP-Status-Codes ?!? */ - int status = controller.accepts(request); + int status = handle.accepts(request); switch (status) { case HttpServletResponse.SC_OK: // 200 case HttpServletResponse.SC_NO_CONTENT: // 204 @@ -102,7 +102,7 @@ public class CacheControl { return false; } - Map headers = controller.getAdditionalHeaders(request); + Map headers = handle.getAdditionalHeaders(request); for (String name : headers.keySet()) response.addHeader(name, headers.get(name)); @@ -120,10 +120,10 @@ public class CacheControl { } } - int cacheSeconds = controller.getCacheSeconds(request); + int cacheSeconds = handle.getCacheSeconds(request); if (cacheSeconds < 1) { log.debug("{}: caching disabled!", url); - response.setDateHeader(Headers.HEADER_DATE, controller.getTimestamp()); + response.setDateHeader(Headers.HEADER_DATE, handle.getTimestamp()); response.setDateHeader(Headers.HEADER_EXPIRES, 0); response.addHeader(Headers.HEADER_PRAGMA, "no-cache"); response.addHeader(Headers.HEADER_CACHE_CONTROL, "private"); @@ -142,7 +142,7 @@ public class CacheControl { log.error("Exception while fetching If-Modified-Since: {}", e); } - long lastModified = controller.getLastModified(request); + long lastModified = handle.getLastModified(request); /** * Sicherstellen, dass der Wert keine Millisekunden enthält, da die @@ -152,7 +152,7 @@ public class CacheControl { lastModified = lastModified - (lastModified % 1000); String ifNoneMatch = request.getHeader(Headers.HEADER_IF_NONE_MATCH); - String eTag = controller.getETag(request); + String eTag = handle.getETag(request); /** * 304-Antworten sollen nach dem {@plainlink @@ -162,7 +162,7 @@ public class CacheControl { */ if (eTag != null) { StringBuilder builder = new StringBuilder(); - if (controller.isETagWeak()) + if (handle.isETagWeak()) builder.append("W/"); builder.append('"'); builder.append(eTag); @@ -207,7 +207,7 @@ public class CacheControl { * Antwort stark sind (starke Gleichheit!), oder wenn die Antwort nur * schwache Gleichheit fordert... */ - if (ifNoneMatch.equals(eTag) && (controller.isETagWeak() || !weak)) { + if (ifNoneMatch.equals(eTag) && (handle.isETagWeak() || !weak)) { log.debug("{}: ETag {} not changed -> 304 ", url, ifNoneMatch); response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); return false; @@ -245,11 +245,11 @@ public class CacheControl { * Expires-Header für HTTP/1.0-Clients setzen. */ cacheControl.put("max-age", Integer.toString(cacheSeconds)); - response.setDateHeader(Headers.HEADER_EXPIRES, (controller.getTimestamp() + (long) cacheSeconds * 1000)); + response.setDateHeader(Headers.HEADER_EXPIRES, (handle.getTimestamp() + (long) cacheSeconds * 1000)); } /** Dem Handler die Gelegenheit geben, den Cache-Controll-Header anzupassen */ - controller.cacheControl(request, cacheControl); + handle.cacheControl(request, cacheControl); if (cacheControl.containsKey("private")) { -- 2.20.1