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)

    Details

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

      Description

      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.

      Regards,
      Hasan Ceylan

        Activity

        Hide
        Mark Thomas added a comment -

        duplicate with MTOMCAT-45 ?

        Show
        Mark Thomas added a comment - duplicate with MTOMCAT-45 ?
        Hide
        Mark Thomas added a comment -

        Yes the problem seems to be the same. But the workaround there won't work. The patch here is still needed.

        Show
        Mark Thomas added a comment - Yes the problem seems to be the same. But the workaround there won't work. The patch here is still needed.
        Hide
        Mark Thomas added a comment -

        fixed rev 12154

        Show
        Mark Thomas added a comment - fixed rev 12154

          People

          • Assignee:
            Unassigned
            Reporter:
            Hasan Ceylan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development