CHAPTER 10 INTRODUCTION TO FILTERING 415 Figure (Photo web hosting)
CHAPTER 10 INTRODUCTION TO FILTERING 415 Figure 10-10. The design of the Filter API provides an inherent chaining capability. The container works with each filter to filter and process the request as specified in the deployment descriptor. Here is an explanation of what happens: 1. The container parses the filter mappings defined in the web.xml file of the application. 2. A request arrives, accessing a resource in the application. 3. The container determines the filter chain that will be applied to this request. 4. The container invokes the doFilter()method of the first filter in the chain, passing in the request, a response (holder), and a FilterChainobject reference. The container loads the filter chain information into the FilterChain object that is passed in. 5. The filter performs its doFilter()logic. 6. The filter completes its filter logic and calls the doFilter() method of the FilterChain object reference, passing in the request and response. All filters are required to do this, because all filters are intrinsically chainable. 7. Logic in the doFilter() method of the FilterChain object calls the doFilter() method of the next filter chain to be called. Steps from step 4 are repeated until the last filter in the chain has completed its work. The FilterChain.doFilter() call on the last filter in ce to occur.
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.