446 CHAPTER 11 ADVANCED FILTERING TECHNIQUES Next,
446 CHAPTER 11 ADVANCED FILTERING TECHNIQUES Next, you ll try a servlet resource instead. Open http://localhost:8080/filters2/servlet/ findprod (note that findprodis lowercase). Figure 11-6 shows that the output is once again intercepted and the auditing information is appended. Figure 11-6. Filters can act upon any web resource including static HTML pages, JSP pages, and, as shown here, servlets. If you re creating filters that must work across many types of resources, you must test against each type of resource. This is necessary because each type of resource is passed through a different resource processor, each of which potentially has different assumptions and behavior from the others (servlets are passed to Catalina, JSP pages are passed to Jasper first, and so on). Filter 2: An Authorization Filter A filter can generate its own output and deprive the downstream filters and resource processor of a chance to see the request altogether. Obviously, there s very little application for a filter that does this all the time, but a filter that does this based on some dynamic criterion can be useful. One example is a filter that blocks resource access based on the time of day. You ll create such a filter in this section. Generating Your Own Response The filter you re going to create falls into the authorization filter application domain. More specifically, it allows or disallows an incoming request to reach its destined resource processor depending on the time of day. The application is intended to stop users from accessing game- playing resources during certain hours. Figure 11-7 illustrates the filter action. If a request arrives during the allotted time window, the user is allowed through to the resource processor to play games. If a request arrives outside of the allotted time window, the filter generates a response of its own, depriving the downstream resource processor of a chance to see the request. This effectively blocks the use of the game resources.
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.