2 Replies Latest reply on May 12, 2004 11:38 AM by gz2jbt

    Serving Static content

    Jonathon Roberts Newbie

      I've figured out how to serve static content, like a ton of images, that you don't want to put into a war file.

      I've seen partial answers to this but noone really put it all together.

      So, here's what you do:

      --Create a directory on the server for the pictures or static content.
      --In this directory create another directory with a .war at the end of the name.

      Example: /opt/static_content/static_content.war
      


      --Place all pictures and static content jpgs in this the .war directory.

      --In your .war directory create a WEB-INF directory and place a property
      web.xml file in it. This is an basicly exploded war file. There doesn't
      have to be anything special in the web.xml, just valid web-app tags.

      --Add new module in application.xml with your .war directory.
       example:
       <module>
       <web>
       <web-uri>static_content.war</web-uri>
       <context-root>/mypictures</context-root>
       </web>
       </module>
      

      --edit /server/default/conf/jboss-service.xml and add the directory you
      added for the static content to URLS attribute tag inside
      the org.jboss.deployment.scanner.URLDeploymentScanner mbean
       example:
       <attribute name="URLs">
       deploy/, file:/opt/static_content/
       </attribute>
      

      This will let jboss scan that directory for any changes in that directory.

      This needs to be the directory above the .war dir

      Now you should be able to access your content by browing to the context
      Example :<img src=" /mypictures/pic1.jpg"/>
      



      Hope this helps some people out.