Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-4786

RESTEASY002142 warning in tasks-rs quickstart

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.1.0.DR1
    • 7.0.0.GA
    • Quickstarts
    • None

      With the fixes introduced with new version of Resteasy in JBoss EAP 7.0.1, a previously unthrown warning required by EE spec is being produced when multiple methods match resource request.

      In tasks-rs, the following warning is produced by the server when accessing the http://localhost:8080/jboss-tasks-rs/tasks/1 path

      WARN  [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-32) RESTEASY002142: Multiple resource methods match request. Selecting one.
      

      This is caused by ambiguity in matching the tasks/1 path in TasksResource.java. Both of the following methods could match the path:

      @GET
      @Path("tasks/{id}")
      @Produces({ "application/xml" })
      public Task getTaskById(@Context SecurityContext context, @PathParam("id") Long id)
      @GET
      @Path("tasks/{title}")
      @Produces({ "application/xml" })
      public List<Task> getTasksByTitle(@Context SecurityContext context, @PathParam("title") String title)

      Suggested fix
      Change the method header of getTaskById and getTasksByTitle to the following:

      @GET
      @Path("tasks/id/{id}")
      @Produces({ "application/xml" })
      public Task getTaskById(@Context SecurityContext context, @PathParam("id") Long id)
      @GET
      @Path("tasks/title/{title}")
      @Produces({ "application/xml" })
      public List<Task> getTasksByTitle(@Context SecurityContext context, @PathParam("title") String title)

      Once the path mappings are changed, the URLs in readme file of the quickstart will have to be adjusted accordingly.

              sgilda_jira Sande Gilda (Inactive)
              mjurc@redhat.com Michal Jurc
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: