public void process(HttpResponse response,
HttpContext context) throws HttpException, IOException {
if (context == null) {
throw new IllegalArgumentException("HTTP context may not be null");
}
HttpRequest request = (HttpRequest)
context.getAttribute(ExecutionContext.HTTP_REQUEST);
Header aeheader = request.getFirstHeader(ACCEPT_ENCODING);
if (aeheader != null) {
HeaderElement[] codecs = aeheader.getElements();
for (int i = 0; i < codecs.length; i++) {
if (codecs[i].getName().equalsIgnoreCase(GZIP_CODEC)) {
response.setEntity(new GzipCompressingEntity(response.getEntity()));
return;
}
}
}
}
|