5 Replies Latest reply on Apr 3, 2007 11:49 AM by pmuir

    Local page.xml navigation rules

    artur.chyzy

      Hello.
      I have a problem with auto refreshing page.xml (without server restart).
      When the navigation is defined in pages.xml (global file) it is refreshed correctly but when i define rules in some.page.xml (local file) it is not refreshed.

      Is this a bug or i'm doing sth wrong ?
      I'm using latest Seam version.
      Anyone have similar problem ?

      Artur

        • 1. Re: Local page.xml navigation rules
          gavin.king

          This should *definitely* work. Look at the code in HotDeployFilter.

          • 2. Re: Local page.xml navigation rules
            artur.chyzy

            Yes it should but it doesn't for me for sure.
            Also i decided you get seam code and put some additional logs for filter.
            Here are my results:


            following statememnt always returns false

            if ( init!=null && init.hasHotDeployableComponents() )
            

            init != null returns true (because it exists in ServletContext) but has not got any hot deployable components
            The for loop is never executed and the scan method also.

            When running on debug mode i also found in logs sth like this:

            DEBUG [Pages] reading pages.xml
            DEBUG [DTDEntityResolver] trying to resolve system-id http://jboss.com/products/seam/pages-1.2.dtd]
            DEBUG [DTDEntityResolver] recognized Seam namespace; attempting to resolve on classpath under org/jboss/seam/
            DEBUG [DTDEntityResolver] located http://jboss.com/products/seam/pages-1.2.dtd] in classpath
            


            This comes from initialize method from Pages class

            @Create
             public void initialize()
             {
             InputStream stream = Resources.getResourceAsStream("/WEB-INF/pages.xml");
             if (stream==null)
             {
             log.debug("no pages.xml file found");
             }
             else
             {
             log.debug("reading pages.xml");
             parse(stream);
             }
             }
            

            So this method always is looking only for pages.xml.

            Because the filter is never executed and Pages class looks only for pages.xml in WEB-INF it does not refresh other page.xml files.

            When starting app the setter method from Init class
            public void setHotDeployPaths(File[] hotDeployJars)
            

            is executed. The problem is that the array is always null. Thats why statement init.hasHotDeployableComponents() return false

            Also my config in components.xml for debug mode looks like this
            <core:init debug="true" jndi-pattern="@jndiPattern@" />
            

            jndiPattern is replaced by ant script

            I don't know why but for me the filter does absolutly nothing (for loop searching for refresh is never executed)

            Anyone has similar problem ?

            • 3. Re: Local page.xml navigation rules
              gavin.king

              Sorry, your analysis is way off. The line which supports hot deployment of pages.xml files is this one:

              getServletContext().removeAttribute( Seam.getComponentName(Pages.class) );


              Which is not inside that if block.

              • 4. Re: Local page.xml navigation rules
                artur.chyzy

                Then I really don't know why it doesn't work for me.
                I put local page.xml files to WEB-INF/classes of war file (which is inside ear file).

                The structure of folders is exactly the same like jspx files.
                Example

                if my web module (war) is colled Project1 then my files are in userFiles folder

                f.e. /Project1/userFiles/edit.jspx.
                So the local page.xml file is located in /Project/WEB-INF/classes/userFiles/edit.page.xml.

                For me it is correct beacuse app works fine.

                The pages.xml file is located in /Project1/WEB-INF/pages.xml and is refreshed correctly.

                The local files (like edit.page.xml) is not refreshed.

                Anyone had similar situation or maybe i made mistake which i'm not aware of.

                Artur

                • 5. Re: Local page.xml navigation rules
                  pmuir

                  Follow the examples/seam-gen for packaging.

                  /path/to/foo.xhtml
                  /path/to/foo.page.xml


                  is correct