SampleResource { @POST @Consumes("application/json") public Response post(JsonNode node) { Resource resource; try { resource = store.create(node); } catch (Exception e) { return Response.serverError().build(); } final URI uri = UriBuilder.fromPath(resource.getURI().path()).build(); return Response.created(uri).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 testPost() { ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.createObjectNode() .put("name", "u2"); Response response = client.target(Main.uri) .request(MediaType.APPLICATION_JSON) .post(Entity.entity(node, MediaType.APPLICATION_JSON)); assertEquals(201, response.getStatus()); assertEquals("http: WebTarget target = client.target(Main.uri + "u2"); Resource resource = target.request(MediaType.APPLICATION_JSON).get(Resource.class); assertEquals(1, resource.getContents().size()); EObject u1 = resource.getContents().get(0); assertEquals("User", u1.eClass().getName()); assertEquals("u2", u1.eGet(u1.eClass().getEStructuralFeature("name"))); }