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

It is not possible to match an empty route in Untertow

    XMLWordPrintable

Details

    • Bug
    • Resolution: Obsolete
    • Minor
    • None
    • 2.0.13.Final
    • Core
    • None

    Description

      The following does not work:

      Handlers.path()
              .addPrefixPath("/test", Handlers.routing().get("", ...).post("", ...)
      

      You have to imagine I would supply the RoutingHandler from a function, and I just want to match whatever prefix it was put under.

      The example crashes with "UT000071: Cannot add path template /, matcher already contains an equivalent pattern /".

      It seems from the error message that an empty route "" is intepreted as "/". Weirdly, it seems possible to define two routes for "/":

      Handlers.path()
              .addPrefixPath("/test", Handlers.routing().get("/", ...).post("/", ...)
      

      This does not produce UT000071.

      I'm not sure if this is a bug or not, but it does make my use case impossible. I want to have 'Controllers' defining their own routes. The are then to be 'mounted' under a prefix. It works if I resister them at "/", but then the URLs are a bit ugly, like POST /test/ instead of POST /test.

      Attachments

        Activity

          People

            rhn-cservice-bbaranow Bartosz Baranowski
            alondolev Alon Dolev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: