Adding a simple Wrapper to the design

Let’s enhance Rachel’s first pseudo-code by adding a wrapper.

Compression filter design, version 2 (pseudocode)

image with no caption
image with no caption

1 The filter passes the request object and a custom response object to the servlet.

2 Since we didn’t override any methods in the Wrapper, the output stream isn’t affected... yet.

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.