2 Replies Latest reply on Nov 23, 2015 6:53 PM by j.swiderski

    Do JBoss EAP 6 and WildFly support Virtual Directories?

    j.swiderski

      Hi,

       

      In many servers it is possible to define fake path inside application which with help of the server maps to some folder outside of application context.

      In Tomcat 7 it is possible with aliases, in Tomcat 6 by defining extra context in server.xml, in GlassFish through alternatedocroot, in Weblogic through virtual-directory-mapping element in weblogic.xml, in Jetty by defining extra handler in Jetty.xml.

      In JBoss 6 AS it was possible by defining extra Context in context.xml and usage of mklink.

       

      To give better understanding of what I'm talking about let me present example for Tomcat 8:

      Inside MyApp/META-INF/context.xml I enter:
      <Context antiJARLocking="true" path="/MyApp" reloadable="true" >

          <Resources>

             <PreResources base="C://myimages" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/images" />

         </Resources>

         <Valve className="org.apache.catalina.valves.RemoteAddrValve"  allow=".*" />

      </Context>

      Now, path  MyApp/images will map to C://myimages directory which is outside of application context and even server. I keep uploaded images and files there.

       

      ----

      In JBoss AS7 virtual directories are only possible through custom servlet. It seems to be also the case in WildFly and JBoss EAP. Can anyone confirm/deny?

      Do any of these servers support it?

      Are there any plans to introduce such feature?

       

      Regards,

      James

        • 1. Re: Do JBoss EAP 6 and WildFly support Virtual Directories?
          jaysensharma

          In WildFly it is possible. WildFly’s undertow subsystem provides us a feature to configure the “handler” which can be used to achieve the same goal. please see:

           

          How to store static contents outside WildFly installation and access them via Http ?

          http://middlewaremagic.com/jboss/?p=2718

           

          In JBossAS7/EAP6 you can try putting your static files inside the "$JBOSS_HOME/welcome-content"  (suppose you placed a sile with name "hello.html" in that directory) then it can be accessed as

          http://localhost:8080/hello.html

           

          Also apart from writing your custom Servlet to accomplish the same in JBossAS7/EAP6 you can also try using the "WEB-INF/jboss-web.xml" with the following tag <symbolic-linking-enabled>

           

          Example:

          <jboss-web version="7.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
                     xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee jboss-web_7_0.xsd">
              <symbolic-linking-enabled>true</symbolic-linking-enabled>  
              <overlay>/PATH/TO/myimages</overlay>
          </jboss-web>
          
          

           

           

          For more information on this please see: https://issues.jboss.org/browse/JBPAPP6-1549

          1 of 1 people found this helpful
          • 2. Re: Do JBoss EAP 6 and WildFly support Virtual Directories?
            j.swiderski

            Hi,

             

            Jay SenSharma,  thank you for the excelent answer.

             

            Regards,

            James