@POST public Response doDeed( @FormParam("altruist") String altruist, @FormParam("recipient") String recipient) { Deed deed = goodStuff.doGoodDeed(altruist, recipient); try { return Response.created(new URI("http://localhost:8080/deed/" + deed.getId())).build(); } catch (URISyntaxException ex) { return Response.serverError().build(); } }
@POST @Path("/good") public Response doGoodDeed() { goodStuff.doSomethingGood(); try { return Response.created(new URI("http://www.lifeasageek.com")).build(); } catch (URISyntaxException ex) { return Response.serverError().build(); } }
@GET public List<Deed> getDeeds() { return goodStuff.getDeeds(); }
@GET @Path("/{id}") public Deed getDeed(@PathParam("id") Integer id) { return goodStuff.getDeed(id); }