I think you disagree.
You have, on the one hand, HttpClient, which make requests, and on the other, HttpServer, which build answers. This is basic, and I suppose you understand it.
The fact is that the body of the @GET read ()method consumes the body of the request, and creates the body of the response.
So you can have:
@GET @Consumes(MediaType.APPLICATION_XML) //client sends also xml @Produces(MediaType.APPLICATION_XML) @Path("{hotelId}") public HotelRESTInfo read(@PathParam("hotelId") long hotelId) { (...) }
Obviously, you want your client to consume web services, so @Consume ultimately makes sense on the client side .
Unfortunately, JaxRS was built on the server side in 2008 or so, without thinking about synergy with the Java client. And @Consumes is finally a server annotation, and I have not seen in the documentation about reusing annotations on the client.
The Jersey client is quite recent, in accordance with the JaxRS 2 specifications. Your questions indicate that these specifications can be difficult to write!
source share