Version 20

    Serving Static External Files jboss-3.2.3/tomcat-4.1.x

    You can serve external static files from web apps by adding an extern directory content to

    the Tomcat configuration. For example, to serve shared images from a C:/tmp/images

    directory, edit  and add a Context entry to the  descriptor:

     

    Code:

    <server>
    
       <mbean code="org.jboss.web.tomcat.tc4.EmbeddedTomcatService"
          name="jboss.web:service=WebServer">
    ...
          <attribute name="Config">
             <Server>
                <Service name="JBoss-Tomcat">
                   <Engine name="MainEngine" defaultHost="localhost">
                      <Logger className="org.jboss.web.tomcat.Log4jLogger"
                         verbosityLevel="debug" category="org.jboss.web.localhost.Engine"></Logger>
    ...
                      <Host name="localhost">
    ...
                         <!-- Default context parameters -->
                         <DefaultContext cookies="true" crossContext="true" override="true"></DefaultContext>
    
                         <!-- Add a static context /images using directory /tmp/images -->
                         <Context docBase='C:/tmp/images' path='/images' ></Context>
    ...
         
    

     

    Serving Static External Files jboss-3.2.4 until recent versions

    JBoss 3.2.4 no longer uses Tomcat 4.1.x  The default web container is Tomcat5.0.x

     

     

    Note :  The following two steps are a hack till JBoss WebDeployer gets updated with support for static content.

     

    Step 1 : Copy a default web.xml from

    /deploy/jbossweb-tomcat50.sar/server.xml and add a Context element under Host.(Step similar to standalone TC)

    <Host name="localhost" ...>
               <!-- ADD static benchmark DIRECTORY -->
               <Context path="/benchmark" appBase=""
                       docBase="/home/anil/benchmark"
                       debug="99" reloadable="true">
               </Context>
           ...
          </Host>
    

     

    This will enable Tomcat to serve up static content (like html, images etc) from a directory /home/anil/benchmark and the url will be "http://localhost:8080/benchmark"

     

     

    Serving Static External Files in recent 4.x versions of jboss

     

    This works for Jboss 4.2.x and probably other versions as well.

     

    Step 1 (optional): Copy a default web.xml from <JBOSS_HOME>/server/<config-name>/deploy/http-invoker.sar/invoker.war/WEB-INF and place it in your external directory, for example: /home/pgib/images/WEB-INF


    Step 2: Edit <JBOSS_HOME>/server/<config-name>/deploy/jboss-web.deployer/server.xml and add a Context element under Host.(Step similar to standalone TC)

    <Host name="localhost" ...>
            <!-- ADD static images DIRECTORY -->
            <Context path="/images" 
                    docBase="/home/pgib/images"
                    reloadable="true">
            </Context>
            <!-- The rest of your Host entity -->
    </Host>
    

     

    Step 3: Enjoy.  This will enable Tomcat to serve up static content (like html, images etc) from a directory /home/pgib/images and the url will be "http://localhost:8080/images"

     

     

    Serving Static External Files in JBoss 5.x

     

    How to deploy my application in an external directory in JBoss-5

     

    Serving Static External Files in standalone Tomcat Instances (not the Tomcat instance bundled with JBoss)

    If you wish to serve static content from a directory external to webapps, you can add "Context" element to the Host element in the server's "server.xml"

           <Host name="localhost" ...>
               <!-- ADD static benchmark DIRECTORY -->
               <Context path="/benchmark" appBase=""
                       docBase="/home/anil/benchmark"
                       debug="99" reloadable="true">
               </Context>
           ...
          </Host>
    
    

     

    This will enable Tomcat to serve up static content (like html, images etc) from a directory /home/anil/benchmark and the url will be http://localhost:8080/benchmark