@Test public void testGet() throws Exception { WebTarget target = client.target(Main.uri + "u1"); 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("u1", u1.eGet(u1.eClass().getEStructuralFeature("name"))); }
@GET @Path("/{id}") @Produces("application/json") public Response get(@PathParam("id") String id) { Resource resource; try { resource = store.get(id); } catch (IOException e) { return Response.status(Response.Status.NOT_FOUND).build(); } return Response.ok(resource).build(); }
SampleResource { @GET @Path("/{id}") @Produces("application/json") public Response get(@PathParam("id") String id) { Resource resource; try { resource = store.get(id); } catch (IOException e) { return Response.status(Response.Status.NOT_FOUND).build(); } return Response.ok(resource).build(); } }
SampleResource { @GET @Path("/{id}") @Produces("application/json") public Response get(@PathParam("id") String id) { Resource resource; try { resource = store.get(id); } catch (IOException e) { return Response.status(Response.Status.NOT_FOUND).build(); } return Response.ok(resource).build(); }  }
SampleResource { @GET @Path("/{id}") @Produces("application/json") public Response get(@PathParam("id") String id) { Resource resource; try { resource = store.get(id); } catch (IOException e) { return Response.status(Response.Status.NOT_FOUND).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); }
SampleResource { @GET @Path("/{id}") @Produces("application/json") public Response get(@PathParam("id") String id) { Resource resource; try { resource = store.get(id); } catch (IOException e) { return Response.status(Response.Status.NOT_FOUND).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);  }