1 Reply Latest reply on Jan 21, 2010 5:24 AM by jaikiran pai

    wrong context path when WAR file name starts with number(s)

    Sebastian Weber Newbie

      Hello,

       

      I have a problem with deployment of a WAR file which has a file name starting with a number, e.g. "5live.war". When the file is deployed the context path of the application is the file name without the numbers at the beginning, "live" in the example. This happens with JBoss AS 4.2.2.GA and JBoss 4.2.3.GA. Tomcat Standalone 6.0.18 works as expected. Does anyone know whether this is expected behaviour or a bug? I know about the option of replacing the number by the appropriate word or adding a jboss-web.xml the the WAR file.

       

      Thx.

      Sincerely,

      sweber

        • 1. Re: wrong context path when WAR file name starts with number(s)
          jaikiran pai Master

          sweber2010 wrote:

           

          Hello,

           

          I have a problem with deployment of a WAR file which has a file name starting with a number, e.g. "5live.war". When the file is deployed the context path of the application is the file name without the numbers at the beginning, "live" in the example. This happens with JBoss AS 4.2.2.GA and JBoss 4.2.3.GA.


           

          I can see this happening even with the latest AS versions and the AS trunk. There's this specific code http://anonsvn.jboss.org/repos/jbossas/trunk/server/src/main/java/org/jboss/web/deployers/AbstractWarDeployer.java with comments which does this:

           

          // Strip any '<int-value>.' prefix
                   int index = 0;
                   for (; index < webContext.length(); index++)
                   {
                      char c = webContext.charAt(index);
                      if (Character.isDigit(c) == false && c != '.')
                         break;
                   }
                   webContext = webContext.substring(index);
          

           

          Based on those comments, it looks intentional. Although I don't know of a reason why the context name should not start with a digit.