-
Bug
-
Resolution: Done
-
Major
-
7.0.0.GA
-
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.