Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-624

Regular expression with (?i:...) non-capturing group in @Path annotation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 2.3-RC1
    • 2.3-beta-1, 2.2.3.GA
    • None
    • None

      I wanted to make case/insensitive API, so I had to use regular exception in @Path annotations. This works:

      @Path("/

      {api:[aA][pP][iI]}

      ")
      public class Api {
      @Path("/

      {func:[fF][uU][nN][cC]}

      ")
      public void func()

      { ... }
      }

      I tried to change weird regular exception to clearer one, based on non-capturing group (?:...).

      @Path("/{api:(?i:api)}")
      public class Api {
      @Path("/{func:(?i:func)}")
      public void func() { ... }

      }

      but exception "java.lang.IndexOutOfBoundsException: No group 3" is thrown on any request.
      When I use (i?:...) only on class Api level and not on method func(), it surprisingly works.

              patriot1burke@gmail.com Bill Burke (Inactive)
              mschayna_jira Martin Schayna (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: