3 Replies Latest reply on Mar 16, 2009 8:46 PM by eriksson.viktor

    Reading files from another archive

    eriksson.viktor

      I have this web-application which is distributed to different end users. The application consists of servlet, classfiles and xsl files.
      The xsl-files are end-user specific. As it looks now I have to package my application for each end user and that is a bit of a pain in the bum.

      What I would like to do is to divide the application in two parts. The servlet/classes part and an xsl-part. So when bugfixes and such has been made and a new version is about to be sent out, I only need to sent out the servlet/classes-part.

      My problem is that I don't know how to use the xsl-files from the servlet/classes application which are located in the other "application".
      I think this is the way to do it when the files are in the current application:
      getServletContext().getResourceAsStream("/WEB-INF/myresource");
      But how do I read files from another archive/application ?

      Another question I have is how should I package the xsl-files, jar file ? war-file ? other ?

        • 1. Re: Reading files from another archive
          peterj

          For one of our applications what we did was created a subdirectory under the server/xxx/conf directory and placed various configuration and customization files there. Then to look them up, we used the jboss.server.config.url system property to locate the conf directory. For example, to access server/xxx/conf/mystuff/desired.xsl, use:

          String confUrl = System.getProperty("jboss.server.config.url");
          File f = new File(confUrl + "mystuff/desired.xsl");

          • 2. Re: Reading files from another archive
            eriksson.viktor

            Thank you.

            But it is not possible to read from other archives or ?
            Is this maybe a more correct way to do things ?

            • 3. Re: Reading files from another archive
              eriksson.viktor

              Think I found out how to do it.
              I compiled my configuration stuff into a jar with 1 dummy sourcefile.

              I then import this sourcefile in my real application and type:

              DummyFile.class.getResourceAsStream("/xsl/hello.xsl").read(bytes);