I am getting following for two completely different URLs and I cannot explain why:
RESTEASY002142:
Multiple resource methods match request "GET /devices/distinctValues/3".
Selecting one.
Matching methods:
[public javax.ws.rs.core.Response
mypackage.DevService.getDistinctValues(int) throws java.lang.Exception,
public javax.ws.rs.core.Response
mypackage.DevRESTService.getDevice(int,java.lang.String)
throws java.lang.Exception]
This warning should not come up, since the URLS are completely different. If anybody knows why this is happening:
URLs for both methods:
getDevice
:
@GET
@Path("devices/{customerId}/{deviceIds}")
@Produces({ "application/json" })
getDistinctValues
:
@GET
@Path("devices/distinctValues/{customerId}")
@Consumes("application/json")
@Produces("application/json")
The warning happens because your request string can match both path templates. The request "devices/distinctValues/3"
devices/distinctValues/{customerId}
in that customerId = "3"
devices/{customerId}/{deviceIds}
in that customerId = "distinctValues"
and deviceIds = "3"
.There is no type resolution and since your request is a String
there is no way to tell customerId
that it cannot accept "distinctValues"
.
As a workaround, you can either specify a regex as shown in the linked question, or use the RESTEasy proxy framework which is basically a shared interface that both server (your JAX-RS resource) and client use, and then you have a common language with type resolution. Note that there is a typo in the example of the docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With