Is there an easy way NOT to compress the returned bytes, if the page returned is of type pdf? I cannot think of any entry in web.xml that will make it happen. The only approach I can think of is modifying the code of Sean Owen. I can think of 2 ways: 1) Putting relevant packages in url-pattern in web.xml and I do not want to do it. 2) Modify Sean Owne's code so that it does not compress the result if the content type is of type pdf.