The Handler component of the filtering system is responsible for reading each web browser request, sending this request to the corresponding web server, reading the reply from the web server, and sending the reply to the web browser. The request read is stored in a Java Request object and its reply is stored in a Java Reply object. Both of these objects provide access to all the HTTP headers and Reply also provides access to the content associated with the request.
The Handler is also responsible for filtering the Request and Reply objects. Once a Request is received, the handler contacts the Filter Manager to obtain a list of Filter objects to be used for filtering the request. The Request object is then passed through each of these filters. A similar process is used for replies. When received, the Reply object is also passed through the list of filters. The Reply can also contain content, such as an HTML document, that needs to be filtered. The Handler uses the ObjectStream component to convert the content from stream of bytes into a stream of Java objects. This stream of objects is passed through the list of filters, converted back into a stream of bytes, and sent to the web browser.
During the filtering process the Handler uses the same list of filters to filter the Request, Reply, and reply content. This allows a single Filter instance to be used for the complete HTTP transaction. Each filter in the list is inspected by the Handler to determine which stage of the transaction the filter would like to process. Inspection is based on examining the filter object to see which interfaces of the Filter API it implements.