3 Replies Latest reply on Feb 17, 2009 9:26 PM by demetrio812

    To extend seam's Pages component

    Alex Sun Newbie

      i want to load all pages.xml in my module jar s( XXX.jar!/META-INF/pages.xml ),but if i override resources field of the Pages class, seam only load one pages.xml to parse.


      so, would you please add this functionality , that may be like:



      ...
      // TODO:zjsun fix here
           protected void parseJarPagesXml() {
      
           }
      
           // TODO:zjsun fix here
           protected void parsePagesXml(InputStream is) {
                parse(is);
           }
      ...
      public void initialize() {
                pagesByViewId = Collections
                          .synchronizedMap(new HashMap<String, Page>());
                pageStacksByViewId = Collections
                          .synchronizedMap(new HashMap<String, List<Page>>());
                conversations = Collections
                          .synchronizedMap(new HashMap<String, ConversationIdParameter>());
      
                for (String resource : resources) {
                     InputStream stream = ResourceLoader.instance().getResourceAsStream(
                               resource);
                     if (stream == null) {
                          log.info("no pages.xml file found: " + resource);
                     } else {
                          log.debug("reading pages.xml file: " + resource);
                          parse(stream);
                     }
                }
      
                parseJarPagesXml();
      
                parsePages(hotDotPageDotXmlFileNames, dotPageDotXmlFileNames);
      
           }
      ...




      then, i could extend to impl my own pages.xml loading logic, like:



      public class EpstarPages extends Pages {
      
           @Override
           protected void parseJarPagesXml() {
                for (URL url : ResourcesUtils
                          .findClassLoaderResources("META-INF/pages.xml")) {
                     try {
                          InputStream stream = url.openStream();
                          parsePagesXml(stream);
                     } catch (IOException e) {
                     }
                }
           }
      
      }