294 CHAPTER 9 STATE (Free web hosting with ftp) NAVIGATION PATTERN public
Wednesday, November 21st, 2007294 CHAPTER 9 STATE NAVIGATION PATTERN public Object initializeRequest() { return null; } public void destroyRequest( Object objData) { } public boolean isTrigger(Object objData, HttpServletRequest request, HttpServletResponse response) { if (_router.IsResource( request)) { return true; } return false; } public void runFilter(Object objData, HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { Rewriter rewriter; try { rewriter = (Rewriter)ResourceEngineFilter.class.getClassLoader(). loadClass(_clsRewriter).newInstance(); } catch( Exception ex) { return; } _router.WriteRedirection( rewriter, request); } } In the example class ResourceEngineFilter, the methods isTrigger and runFilter are implemented, as required by TriggerFilter. The method init is used to initialize the filter and retrieve the filter configuration information, and specifically the base-directory that is used by the class FilterRouter or the Router interface instance. In the implementation of init, the default Router instance _router is instantiated by using the configuration declaration item router. In contrast, in the Permutations pattern implementation, the instantiation of Router was hard-coded. Regardless of how the Router interface instance is instantiated, in the example of ResourceEngineFilter, the Router interface instance must be stateless with respect to the HTTP request. The statelessness is required because the Router instance is associated with the ResourceEngineFilter, which is also stateless. What is not stateless, but is instantiated with every triggered filter request, is the Rewriter interface instance. This is because the implementations of the Rewriter will require multiple calls, and the calls will reference some state generated by the HTTP request. The statelessness results in a modified version of the Routerinterface that is defined as follows:
Check Tomcat Web Hosting services for best quality webspace to host your web application.