From 5f8def1103a2a408579d1b6ae29e447a272a9558 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Thu, 31 May 2012 22:42:43 +0200 Subject: [PATCH] =?utf8?q?Unn=C3=B6tige=20decorate()-Aufrufe=20durch=20Acc?= =?utf8?q?eleratorFilter=20verhindert?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../juplo/cachecontrol/AcceleratorFilter.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cachecontrol/src/main/java/de/halbekunst/juplo/cachecontrol/AcceleratorFilter.java b/cachecontrol/src/main/java/de/halbekunst/juplo/cachecontrol/AcceleratorFilter.java index ffafddc7..f9cd886f 100644 --- a/cachecontrol/src/main/java/de/halbekunst/juplo/cachecontrol/AcceleratorFilter.java +++ b/cachecontrol/src/main/java/de/halbekunst/juplo/cachecontrol/AcceleratorFilter.java @@ -333,6 +333,7 @@ public class AcceleratorFilter implements Filter { */ response.reset(); pos = 0; + size = 0; stream = null; writer = null; } @@ -649,9 +650,11 @@ public class AcceleratorFilter implements Filter { public void write(int i) throws IOException { if (pos == bufferSize) { out().write(buffer); - pos = 0; committed = true; - cacheControl.decorate(request, response); + /** Dekoration nur beim ersten Schreib-Schub anstoßen */ + if (pos == size) + cacheControl.decorate(request, response); + pos = 0; } buffer[pos++] = (byte) i; size++; @@ -663,7 +666,9 @@ public class AcceleratorFilter implements Filter { return; committed = true; - cacheControl.decorate(request, response); + /** Dekoration nur beim ersten Schreib-Schub anstoßen */ + if (pos == size) + cacheControl.decorate(request, response); out().write(buffer, 0, pos); out().flush(); pos = 0; -- 2.20.1