RestEasy 3.x does not allow same path in @Path annotation for sub resource method and sub resource locator.

Solution Verified - Updated -

Issue

  • There are JAX-RS methods having the same @Path but some acting as sub-resource locators and some with @POST as sub-resource methods :
@POST
@Path("items")
public Response create(@MatrixParam("id") final UUID id, @QueryParam("msg") final String msg) {
........
@Path("items")
public ItemCollectionResource locateItems(@MatrixParam("pattern") final String pattern) {
System.out.println("Inside resource locator");

@Path("items/{id:[A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9]-[A-Za-z0-9\\-]+}")
  public SingleItemResource locateItem(@PathParam("id") final UUID id) {
 //...

The problem is that, the URL http://localhost:8888/hello/problem/items fails with 405 in EAP 7.x whereas succeeds in EAP 6.4.x.

Environment

  • Red Hat Enterprise Application Platform (EAP)
    • 7.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In