CHAPTER 11 ADVANCED FILTERING TECHNIQUES 439 Figure (Web server application)
CHAPTER 11 ADVANCED FILTERING TECHNIQUES 439 Figure 11-4. This sequence diagram shows how the various VisAudit classes cooperate to filter the response from a web component. Note that you must wrap the response with your own custom version during the request s inbound trip, before you call Chain.doFilter(). In fact, the following happens: 1. The filter supplies a custom wrapped version of the response to downstream filters when it calls the Chain.doFilter() method. 2. This custom wrapped response object hands down a custom OutputStreamor PrintWriter object that is actually a byte array managed in your own code. 3. When downstream filters, or the resource processor, write to your custom OutputStream or PrintWriter, you re buffering all the output. 4. When downstream filters, or the resource processor, flush or close your custom OutputStream or PrintWriter, you examine the buffered output for the closing