SampleResource { @PUT @Path("/{id}") @Produces("application/json") @Consumes("application/json") public Response put(@PathParam("id") String id, JsonNode node) { Resource resource; try { resource = store.update(id, node); } catch (Exception e) { return Response.serverError().build(); } return Response.ok(resource).build(); }  @GET @Path("/{id}") @Produces("application/json") Response get(@PathParam("id") String id); @POST @Consumes("application/json") Response post(JsonNode node); @PUT @Path("/{id}") @Produces("application/json") @Consumes("application/json") Response put(@PathParam("id") String id, JsonNode node); @DELETE @Path("/{id}") Response delete(@PathParam("id") String id);  }
@Test public void testPut() { ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.createObjectNode() .put("name", "u3"); Response response = client.target(Main.uri + "u1") .request(MediaType.APPLICATION_JSON) .put(Entity.entity(node, MediaType.APPLICATION_JSON)); assertEquals(200, response.getStatus()); Resource resource = response.readEntity(Resource.class); assertEquals(1, resource.getContents().size()); EObject u1 = resource.getContents().get(0); assertEquals("User", u1.eClass().getName()); assertEquals("u3", u1.eGet(u1.eClass().getEStructuralFeature("name"))); }