Reputation: 4063
I am currently working with Resteasy 2.3.6.Final and want to upgrade to Resteasy 3.0.4.Final. However, the API doc indicates that the class is now deprecated. So my questions are:
Thanks for any help.
Edit 1
Here is an example of what I am talking about.
I currently some code like this:
@GET
@Path("matrixParam")
@Produces("application/json")
ClientResponse<Matrix> getMatrix(@MatrixParam("param")String param);
ClientResponse takes in a generic parameter. If I use Response instead, then it would become:
@GET
@Path("matrixParam")
@Produces("application/json")
Response getMatrix(@MatrixParam("param")String param);
And the generic parameter is removed. This would be inconvenient because the caller needs to know what type the returned object is.
Edit 2
The answer from Pascal and the book Restful Java with JAX-RS 2.0
both say that the generic parameter is no longer needed because the interface methods can return the desired type directly. Thanks Pascal for answering.
Upvotes: 3
Views: 2102
Reputation: 1091
You don't need the generic parameter anymore as you can directly use your own type in the client interface method like this:
@GET
@Path("matrixParam")
@Produces("application/json")
Matrix getMatrix(@MatrixParam("param")String param);
And to query the remote service you can use the resteasy client proxy framework:
Client client = ClientBuilder.newClient();
WebTarget target = client.target("http://host/path");
ResteasyWebTarget rsWebTarget = (ResteasyWebTarget)target;
SimpleMatrixClient simple = rsWebTarget.proxy(SimpleMatrixClient.class);
Matrix m = simple.getMatrix("myMatrixParamValue");
Upvotes: 2