This helper class is a Decorator on the ServletOutputStream abstract class which delegates the real work of compressing the generated content using a standard GZIP output stream.
There is only one abstract method in the ServletOutputStream that this Decorator must implement: write(int). This is where all of the delegation magic occurs!
Sharpen your pencil
ANSWERS
Write down the sequence in which the filters will be executed for each request path. Assume Filter1 - Filter5 have been properly declared.
<filter-mapping> <filter-name>Filter1</filter-name> <url-pattern>/Recipes/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Filter2</filter-name> <servlet-name>/Recipes/HopsList.do</servlet-name> </filter-mapping> <filter-mapping> <filter-name>Filter3</filter-name> <url-pattern>/Recipes/Add/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Filter4</filter-name> <servlet-name>/Recipes/Modify/ModRecipes.do</servlet-name> </filter-mapping> <filter-mapping> <filter-name>Filter5</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
Request path | Filter Sequence |
---|---|
| Filters: 1, 5 |
| Filters: 1, 5, 2 |
| Filters: 1, 5, 4 |
| Filters:5 |
| Filters:1, 3, 5 |