AccelerationWrapper wrapper = new AccelerationWrapper(httpRequest, httpResponse);
httpRequest.setAttribute(RESPONSE_WRAPPER, wrapper);
cacheControl.init(wrapper);
- chain.doFilter(request, wrapper);
- wrapper.finish();
+ try {
+ chain.doFilter(request, wrapper);
+ wrapper.finish();
+ }
+ catch (NotModifiedException nm) {
+ log.trace("Not modified: {}", httpRequest.getRequestURI());
+ }
}
@Override
out().write(buffer);
committed = true;
/** Dekoration nur beim ersten Schreib-Schub anstoßen */
- if (pos == size)
- cacheControl.decorate(request, response);
+ if (pos == size) {
+ if (!cacheControl.decorate(request, response)) {
+ zipped = false;
+ os = null;
+ pos = 0;
+ throw new NotModifiedException();
+ }
+ }
pos = 0;
}
buffer[pos++] = (byte) i;
committed = true;
/** Dekoration nur beim ersten Schreib-Schub anstoßen */
- if (pos == size)
- cacheControl.decorate(request, response);
+ if (pos == size) {
+ if (!cacheControl.decorate(request, response)) {
+ zipped = false;
+ os = null;
+ pos = 0;
+ throw new NotModifiedException();
+ }
+ }
out().write(buffer, 0, pos);
out().flush();
pos = 0;
if (size == 0) {
committed = true;
zipped = false;
- cacheControl.decorate(request, response);
+ if (!cacheControl.decorate(request, response))
+ throw new NotModifiedException();
sos.close();
}
else {
}
}
}
+
+class NotModifiedException extends IOException {}
\ No newline at end of file