This section provides a complete example of a filter based on the Filter API covered in the previous sections. This filter is called CookieMonster and it consists of two parts: the filter factory named CookieMonster and the filter named CookieMonsterFilter. Figures 4.12 and 4.13 show the Java code used to implement the factory and the filter, respectively. The createFilter() method in the CookieMonster factory class is called by the filtering system when a new filter is needed to process a Request and Reply. In this example the factory creates a CookieMonsterFilter object which is both a RequestFilter and ReplyFilter. When given a Request, the CookieMonsterFilter will look for a HTTP Cookie header and remove it if found. Similarly, the HTTP Set-Cookie header is removed from a Reply.