chain.doFilter(req, res);
return;
}
SlingHttpServletRequest request = (SlingHttpServletRequest) req;
SlingHttpServletResponse response = (SlingHttpServletResponse) res;
// check for compress header
String enc = request.getHeader("Accept-Encoding");
if (enc == null || enc.length() == 0) {
// assume identity, no wrapping
chain.doFilter(request, response);
return;
}
// get settings
enc = this.getEncoding(enc);
if ("gzip".equals(enc) || "x-gzip".equals(enc)) {
// mark the response encoded
response.setHeader("Content-Encoding", enc);
response = new DeflaterComponentResponse(response, false);
} else if ("deflate".equals(enc)) {
// mark the response encoded
response.setHeader("Content-Encoding", enc);
response = new DeflaterComponentResponse(response, true);
}
// continue filtering
chain.doFilter(request, response);