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

    read file (resource) from archive (WAR)

    Alex Ander Newbie

      Hi @ll,


      i have a development problem, that sounds pretty simple:


      Following file structure:



      |- css


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





      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?