Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1679

Unable to add same routing path with different methods

    XMLWordPrintable

Details

    Description

      I've seen this reported a couple of times before but the problem still persists. This is related to having no initial slash of the paths.

      Sample snippet to reproduce:

      Handlers.routing()
        .add(HttpString.GET, "code/\{code\}", new FetchHandler())
        .add(HttpString.POST, "code/\{code\}", new CreateHandler());
      

      Note: there's a bug on issues.redhat.com and i cannot embed curly parentheses so I have to add a backslash. The actual code doesn't include it of course.

      This produces an error on start:

      Exception in thread "main" java.lang.IllegalStateException: UT000071: Cannot add path template /code/{code}, matcher already contains an equivalent pattern /code/{code}
      	at io.undertow.util.PathTemplateMatcher.add(PathTemplateMatcher.java:110)
      	at io.undertow.util.PathTemplateMatcher.add(PathTemplateMatcher.java:151)
      	at io.undertow.server.RoutingHandler.add(RoutingHandler.java:129)
      	[redacted]
      

      I'm using the latest and greatest version: 2.0.30-Final.

      Attachments

        Activity

          People

            rhn-cservice-bbaranow Bartosz Baranowski
            orisen Ori Sen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: