0 Replies Latest reply on Feb 8, 2013 8:09 AM by figwam

    read file (resource) from archive (WAR)

    figwam

      Hi @ll,

       

      i have a development problem, that sounds pretty simple:

       

      Following file structure:

       

      application.war

      |- css

      |-style.css

      |- index.xhtml (refers to css/style.css)

      |-WEB-INF

           |-classes

                x.y.z.ResourceReaderBean.class

       

      Now I try to read the style.css in ResourceReaderBean bean. That seems to be not that

      easy in Jboss 7.

       

      This tries didn't work:

      InputStream is = ResourceReaderBean.class.getResourceAsStream("/css/style.css");

      InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("/css/style.css").getPath();

       

      I tried much more, and googeled at least for 4 hours. But now I gave up. I dont have any idea how

      to read the Resource in the bean.

       

      It works perfect from outside the WAR. But i dont want to duplicate the style.css (DRY Principle). It

      should be possible to read the file from WAR.

       

      Do some of you have any idea?

       

      Thanks

      reagrds

      Alex