1 Reply Latest reply on Mar 7, 2005 2:09 PM by timmorrow

    Making files available in an application

    gseel

      I have two applications, both of which allow files to be uploaded by users (via the Jakarta Commons File Upload package). Both are currently running on JBoss 3.2.6.

      In the first the web app is not packaged as a war so there is a directory app.war under server/default/deploy. I store the documents in a subdirectory under this and they are readily accessible (i.e. everything works fine).

      For the other, I have been "more professional" and packaged the web side into a war so app2.war is a file in server/default/deploy and there is no app2.war directory to store the documents. I have tried adding a documents subdirectory to server/default/deploy but JBoss tries to deploy any document added to that directory.

      The obvious workaround is not to package the web side but I'd be interested to know if there is an alternative approach.

      Thanks.

        • 1. Re: Making files available in an application
          timmorrow

          You could store the files in a directory external to the web app (and to the JBoss installation entirely).

          You'll then need to configure the web-app with the path to the external directory. You could define a initialization parameter in your web.xml to specify this.

          Unfortunately this would make your WAR file server-specific. As an alternative you could provide functionality in your web app to capture and store this path (e.g. a configuration screen), and make it a required step after installation to set this up.

          You could also bind a value into the server's JNDI tree and configure access to that JNDI entry in web.xml and jboss-web.xml. We chose to do this; we bound a Properties object to allow us to add multiple server-installtion specific paths that are accessed by a web-app.