4 Replies Latest reply on Aug 6, 2006 10:50 PM by hindibhai

    serving static content in Jboss 4 onwards

    monisha

      Hi,
      I was using Jboss3.2.3 until recently and the way we serverd static content was to add the path to the jboss-service.xml in the jbosswebtomcat.sar/META-INF in the tag.
      Migrating over to jboss 4+ looks like this tag is no longer supported. The alternate way suggested is to have the static content copied below in ROOT.war and since this is the default context, files will be accessible.

      Is there any way similar to the earlier 3.2.3 configuration where a path could be specified and there is no need to copy files within the appserver directory structure?

      Thanks in advance

        • 1. Re: serving static content in Jboss 4 onwards
          jaikiran

          I havent done this before, but have you tried creating a file like myapp.xml containing something like:


          <Context
          docBase="C:/mydir/images/" debug="9" crossContext="false" privileged="false" reloadable="true"
          path="/yourwebapp/images"/>



          Place this myapp.xml file in %JBOSS_HOME%/server/default/deploy/jbossweb-tomcat55.sar directory and try it out.

          Let us know if this works.







          • 2. Re: serving static content in Jboss 4 onwards
            hindibhai

            I tried and the static content is served on the context specified under the Context tag. I have 2 questions.

            My static content directory is outside the JBOSS deploy but is under the JBOSS_HOME directory.

            1. I need to make the docBase work for Linux also/ Pls can you show how I can make a relative path to reach my jboss_home path thru which I will access the static content directory. I have tried "../././" pattern to reach my content path but have not been successfull.

            2. Also when I form a http link to my static content's sub directory , I dont see the content on the brower. I see a error message that "Requested Resource not present". Do we have to map the sub directories separately. Will they not have access from the same context.

            Thanks In advance.

            • 3. Re: serving static content in Jboss 4 onwards
              peterj
              • 4. Re: serving static content in Jboss 4 onwards
                hindibhai

                Thanks Peter for the reply

                However I donot see any post that helps me with my relative pathing problem.

                I would appreciate if you can point me to a post if you have seen one which talks about relative pathing on docBase and also on sub-directories context

                Thanks