1 Reply Latest reply on Jan 11, 2016 6:07 AM by Tomaz Cerar

    Static resources not served with handler and webapp on "/"

    slowdive- Newbie



      I'm trying to serve static resources with a handler. I can't use the DefaultServlet since the files are not in the deployment's directory.

      The handler's location is "/". My webapp is deployed on the context-root "/" and this seems to interfere with the handler because the static content is not served anymore.



      <host name="app1" alias="domain1.com" default-web-module="app1.war">
           <location name="/" handler="app1-wwwroot"/>
            <file name="app1-wwwroot" path=".../app1/wwwroot"/>


      jboss-web.xml of app1 deployment

      <?xml version="1.0" encoding="UTF-8"?>


      I'm guessing this behaviour is normal but what am I supposed to do if I need static and dynamic content on the websites root? What I'm trying right now is to use my own version of the DefaultServlet with another ResourceManager. It kind of works but I really hope there is an easier solution.

        • 1. Re: Static resources not served with handler and webapp on "/"
          Tomaz Cerar Master

          No matter how you look, only one handler can handle certain context root.

          in this case "/" context is either served by static file handler or by your war deployment.

          You can't have it both at least not easy.


          If you need static content from / than use file handler and deploy your war different one.


          or you can go with different virtual hosts.

          maybe serve static content from domain "static.my-domain.com" and application from "www.my-domain.com" that way you can have two root contexts.