Reputation: 290
Hy, I have a problem using resteasy client method with a PathParam. I explain :
I have an interface used on client side and server side :
@Path("/1.0/user")
@Consumes({"application/json"})
@Produces({"application/json"})
public interface UserApi {
@GET
@Path("/{userid}/followers")
@PrivateApi
public List<DXUser> getUserFollowers(@PathParam("userid") long userId);
}
On the server side, this worked as expected, I have a concrete class implementing this interface and my API is online. No problem. I can call this API method from the URL: http://myapi.dev/1.0/user/1234/followers
But, on the client side, I use the interface to call the API easily with the following code :
ResteasyClient client = new ResteasyClientBuilder().build();
ResteasyWebTarget target = client.target("http://myapi.dev");
UserApi api = target.proxy(UserApi.class);
List<DXUser> users = api.getUserFollowers(1234);
And I receive an exception : java.lang.IllegalArgumentException: You did not supply enough values to fill path parameters
I try with @POST in place of @GET method. I have the same error. I try with @QueryParam and it works ! So the problem seams to concern only @PathParam.
I can't understand what I'm doing wrong in this case. Do you have any idea how can I fix that ?
Thank you Seb
Upvotes: 0
Views: 5206
Reputation: 290
I'm sorry, I made a mistake.
I have imported the javax.websocket.server.PathParam annotation in place of the javax.ws.rs.PathParam.
So, the Resteasy ClientProxy could not create the good PathParamProcessor.
Sorry for this mistake.
Upvotes: 1