2 Replies Latest reply on May 20, 2008 3:16 PM by pieter.martin

    Potential Bug, HotDeployFilter AND Pages

    pieter.martin

      Hi


      I am working on a svn trunk of Seam 2.1.0.


      We have multiple wars in the ear file. When navigating from one page to another the navigation rule does not get applied.


      After some investigation it appears that the HotDeployFilter is the culprit. On line 59 it refreshes Pages.


            Pages pages = (Pages) getServletContext().getAttribute(Seam.getComponentName(Pages.class));
            if (pages!= null) {
                pages.initialize();
            }
      



      The problem is that the context have not been initialized. So then during pages.initialize() when the pages file is being loaded using the ResourceLoader


         public static ResourceLoader instance()
         {
             if (!Contexts.isApplicationContextActive()) {
                 return new ResourceLoader();
             } else {
                 return (ResourceLoader) Component.getInstance(ResourceLoader.class, ScopeType.STATELESS);
             }
         }
      




      Contexts.isApplicationContextActive() returns false


      The new ResourceLoader() then uses the incorrect pages file. It does not use the pages file for the war file that is currently the context.


      If Contexts.isApplicationContextActive() returned true then


      return (ResourceLoader) Component.getInstance(ResourceLoader.class, ScopeType.STATELESS);



      would return the faces resource loader 

      org.jboss.seam.faces.ResourceLoader

      which would find the correct pages file.


      This problem is not in Seam 2.0.1 as The HotDeployFilter does not call pages.initialize();


      I think Pages gets initialized via the SeamPhaseListener which would have restored the contexts before initializing Pages.


      I changed the HotDeployFilter back to like Seam 2.0.1 and then the page navigation works fine.


      Cheers
      Pieter