0 Replies Latest reply on Jan 15, 2013 10:35 AM by william ma

    Seam2.2.2+MyResourceLoader

    william ma Newbie

      Hi All,

       

      I faced a problem under seam2.2.2 + My extended ResourceLoader, My ResourceLoader can only process pages.xml during the application startup

       

      My scenario is that I want to have my personal ResourceLoader to load different book.page.xml in different projects.

      Like I have such book.page.xml

      -view/book.page.xml

      -view/sale/book.page.xml

       

      In common case, I want to load the book.page.xml. If the project name was set as "sale", I shall load the view/sale/book.page.xml instead.

      I realized such logic basing on seam2.1.0, and it was working. But after upgrade to seam2.2.2, it wasn't working any more and only pages.xml under test_ear/test_war/WEB-INF/ was processed, and all book.page.xml  under test_ear/test_war/ or test_ear/test_war/sale/ directory wasn't processed by My ResourceLoader.

       

      Is there anyone can help me on this problem? Is there any special change on ResourceLoader page from seam2.1.0 to seam2.2.2.

      Very appreciated.

       

       

      Thanks and regards.

      ---------------------------------------

      @Scope(ScopeType.STATELESS)

      @BypassInterceptors

      @Install(precedence = 11, classDependencies = { "javax.faces.context.FacesContext" })

      @Name("org.jboss.seam.core.resourceLoader")

      public class MyResourceLoader extends ResourceLoader {

       

       

                private String productName;

                private String projectName;

                private String customerName;

                protected static final Logger log = Logger.getLogger("MyResourceLoader");

       

       

                public MyResourceLoader() {

                          super();

                          productName = SPSConfig.getSubComponentName().toLowerCase();

                          projectName = SPSConfig.getProjectName().toLowerCase();

                          customerName = SPSConfig.getCustomerName().toLowerCase();

                }

       

       

                @Override

                public InputStream getResourceAsStream(String paramResource) {

                          System.out.println("TEST:" + paramResource);

                          if (!paramResource.endsWith("page.xml"))

                                    return super.getResourceAsStream(paramResource);

         }

      }