5 Replies Latest reply on Jan 13, 2004 4:01 PM by akshat

    Images outside war

    Mike Shoemaker Newbie

       

      "javamac" wrote:
      "javamac" wrote:
      "javamac" wrote:
      "javamac" wrote:
      Im trying to refer to images outside of my war file. Is there a way to specify that the path doesn't start with the application root /?

      Thanks


        • 1. 3858359
          akshat Newbie

          You need to define the NukesDS datasource.

          For that, create a nukes-ds.xml file in your deploy directory with the following lines:

          <?xml version="1.0" encoding="UTF-8"?>
           <datasources>
           <local-tx-datasource>
           <jndi-name>NukesDS</jndi-name>
           <connection-url>jdbc:mysql://localhost:3306/nukes</connection-url>
           <driver-class>org.gjt.mm.mysql.Driver</driver-class>
           <user-name>nukes</user-name>
           <password>nukes</password>
           </local-tx-datasource>
          </datasources>
          


          • 2. Re: Images outside war
            Mike Shoemaker Newbie

             

            "javamac" wrote:
            "javamac" wrote:
            Found it in the JBoss FAQ.

            I want to serve content from outside a war
            -------------------------------------------------

            To serve external content, you can step outside the J2EE way of doing
            things and use Jetty's proprietary configuration mechanism to tell it
            to serve pages from anywhere on your disc.

            Add something like this to the ConfigurationElement in
            jbossweb.sar/META-INF/jboss-service.xml, to serve static pages:

            <Call name="addContext">
            <Arg>/documents/*</Arg>
            <Set name="ResourceBase">/docroot/</Set>
            <Set name="ServingResources">TRUE</Set>
            </Call>

            This example maps the context /documents to the directory /docroot, so
            to retrieve e.g. /docroot/myfile.html you would hit
            http://localhost:8080/documents/myfile.html.


            • 3. Re: Images outside war
              Dmitry Namiot Newbie

               

              "coldbeans" wrote:
              See for example Image view servlet in JSOS:
              http://www.servletsuite.com/servlets.htm


              "javamac" wrote:
              "javamac" wrote:
              "javamac" wrote:
              Im trying to refer to images outside of my war file. Is there a way to specify that the path doesn't start with the application root /?

              Thanks


              • 4. Re: Images outside war
                akshat Newbie

                In your Jboss\server\all\ conf\jboss-service.xml
                add the following. Hope this would solve ur problem.

                The dirname should contain a web-inf folder with the appropriate xmls if necessary.


                 <mbean code="org.jboss.deployment.scanner.URLDirectoryScanner"
                 name="jboss.deployment:type=DeploymentScanner2,flavor=URL">
                
                 <depends optional-attribute-name="Deployer">jboss.system:service=MainDeployer</depends>
                 <attribute name="URLComparator">org.jboss.deployment.DeploymentSorter</attribute>
                 <attribute name="Filter">org.jboss.deployment.scanner.DeploymentFilter</attribute>
                 <attribute name="ScanPeriod">100000</attribute>
                
                 <attribute name="URLs">
                 <urls>
                 <dir name="DirName" />
                 </urls>
                 </attribute>
                 </mbean>


                • 5. Re: Images outside war
                  akshat Newbie

                  Sorry about the previous post.

                  In your Jboss\server\all\ conf\jboss-service.xml
                  add the following. Hope this would solve ur problem.

                  The dirname should contain a web-inf folder with the appropriate xmls if necessary.

                  -----------


                  <depends optional-attribute-name="Deployer">jboss.system:service=MainDeployer
                  org.jboss.deployment.DeploymentSorter
                  org.jboss.deployment.scanner.DeploymentFilter
                  100000







                  ----------