HttpServletRequest httpRequest = (HttpServletRequest)request;
HttpServletResponse httpResponse = (HttpServletResponse)response;
- AccelerationWrapper wrapper = new AccelerationWrapper(httpRequest, httpResponse);
+
+ AccelerationWrapper wrapper;
+
+ wrapper = (AccelerationWrapper)request.getAttribute(AcceleratorFilter.RESPONSE_WRAPPER);
+ if (wrapper != null) {
+ if (wrapper.getFilter() == this) {
+ /** Ignore multiple mappings of the same filter-instance */
+ log.warn("Ignoring multiple mappings on same URL: {}", httpRequest.getRequestURI());
+ chain.doFilter(request, response);
+ return;
+ }
+ else {
+ log.error("Only one instance of AcceleratorFilter must be mapped to any URL: {}", httpRequest.getRequestURI());
+ httpResponse.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Only one instance of AcceleratorFilter must be mapped to any URL!");
+ return;
+ }
+ }
+
+ wrapper = new AccelerationWrapper(httpRequest, httpResponse);
httpRequest.setAttribute(RESPONSE_WRAPPER, wrapper);
cacheControl.init(wrapper);
try {
}
+ private AcceleratorFilter getFilter() {
+ return AcceleratorFilter.this;
+ }
+
private void finish() throws IOException {
flushBuffer();
out.close();