4 Replies Latest reply on Oct 21, 2005 12:03 PM by akhopkar

    how do you map multiple context paths to the same web app in

    akhopkar

      Hi guys,

      Does anybody know how I would map multiple context paths to a single web application inside of an ear file? For example, if my app's name is sample.war inside of the .ear file, what I would like to do is map multiple context path's, say:

      /COMPANY1/SAMPLE
      /COMPANY2/SAMPLE
      /COMPANY3/SAMPLE
      /COMPANY4/SAMPLE
      ...

      to this same .war file inside of this ear. The web module (inside of an app.xml) doesn't allow more than one root url. In addition, since it's just one application, I would prefer that each of these not have their own memory space and class loaders, but instead really just refer to the same .war file.

      Is there a way to configure the .ear, tomcat55.sar or jboss in order to achieve this?

      Amarish

        • 1. Re: how do you map multiple context paths to the same web ap
          neelixx

          Use virtual hosts:

          http://wiki.jboss.org/wiki/Wiki.jsp?page=VirtualHosts

          Also, for mapping the virtual hosts to a single web app, this was taken from the above URL


          Also, a single war can be deployed to mulitple virtual hosts through the jboss-web.xml virtual-host element. To make the jmx-console available on localhost, vhost1 and vhost2, edit the jmx-console.war/WEB-INF/jboss-web.xml

          <jboss-web>
          <!-- Uncomment the security-domain to enable security. You will
          need to edit the htmladaptor login configuration to setup the
          login modules used to authentication users.
          <security-domain>java:/jaas/jmx-console</security-domain>
          -->
          <virtual-host>localhost</virtual-host>
          <virtual-host>vhost1.mydot.com</virtual-host>
          <virtual-host>vhost2-alias</virtual-host>
          </jboss-web>


          • 2. Re: how do you map multiple context paths to the same web ap
            akhopkar

            Thank you very much for your reply.

            I had actually already investigated virtual hosts. The problem here is that it is a requirement for us that we need to be able to actually see the:

            https://www.mysite.com/company1/myapp

            https://www.mysite.com/company2/myapp

            https://www.mysite.com/company3/myapp

            in the URL of the browser for this and all subsequent requests, and the www.mysite.com cannot change because we are using SSL and we do not wish to purchase an SSL certificate for each company that we use. Hence, what we really need is for this web app to be referenced by company1/app or company2/app or company3/app without changing any part of https://www.mysite.com

            So really what I'm asking is is there any way to alias the webapp lets say test_webapp by the names company1/test_webapp, company2/test_webapp?

            Is this possible to do?

            Amarish

            • 3. Re: how do you map multiple context paths to the same web ap
              gmoh

              the servlet specification allows mapping like that (i.e., /*/myapp) in web.xml.
              on the other hand, it does support the syntax /myapp/*, would that work for you?

              • 4. Re: how do you map multiple context paths to the same web ap
                akhopkar

                Hi, Thanks for your reply.

                The thing is that I'm aware, there there's a way to manipulate servlet mapping URL's and other things to accomplish this. However, we've got like 4 applications already written that have been running for a while, and they need to be migrated so that they do this, and there are a lot of servlets, struts pages, etc. So what I'm trying to do is find a global way to do this without actually modifying the individual applications themselves.

                That's why I'm searching for some type of global configuration option.

                Amarish