How to send and receive a PUT request containing JSON with jersey?
问题 Here is what I have for server: @PUT @Path("/put") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.TEXT_PLAIN }) public Response insertMessage(Message m) { return Response.ok(m.toString(), MediaType.TEXT_PLAIN).build(); } for client: ClientConfig config = new DefaultClientConfig(); config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE); Client client = Client.create(config); WebResource service = client.resource(getBaseURI()); ObjectMapper mapper = new