But is it really that simple?

Does compressing the response really involve nothing more than waiting for the servlet to finish, then compressing the servlet’s response output? After all, the filter’s doFilter() method has a reference to the same response object that went to the servlet, so in theory, the filter should have access to the response output...

image with no caption
image with no caption

Get Head First Servlets and JSP, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.