Uploaded image for project: 'Apache Tomcat Maven Plugin'
  1. Apache Tomcat Maven Plugin
  2. MTOMCAT-54

If context path is '/' then emty string must be passed to embedded.createContext(String path, String docBase)


    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.0-beta-1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:


      The project I am currently working must be the ROOT application in tomcat. Therefore 'path' is set to '/'.

      It also uses the server side redirects internally through tuckey's URLRewriteFilter, but this bug should be valid for any stack that uses serverside redirects that is based on Tomcat internal (re)dispatcher.

      Bug occurs as a serverside redirect ie: '/myOriginalPath' is redispatched to '/myDestinedPath' ends up as '//myDestinedPath' which has the illegal '/' in the beginning which breaks our application and supposedly an illegal url as well.

      In case this configuration used Maven Tomcat Plugin passes '/' as the context path which conflicts with createContext(String path, String docBase) which specifically says "Context path of this application ("" for the default application for this host, must start with a slash otherwise) @param docBase Absolute pathname to the document base directory for this web application"

      It is impossible to set the context path to "" in the pom as this then yields to maven setting it to default which is "/"

      If the context path is set to "/" then it is passed as it is which is illegal according to the Tomcat Docs.

      The attached patch resolves the issue by simple passing "" in case of "/" is set as the path.

      No documentation or pom interface change therefore change is transparent and does not break.

      Hasan Ceylan




            • Assignee:
              hceylan@batoo.org Hasan Ceylan
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: