I am trying to create a simple application that allows me to create, read, update and delete different users. I have a UI-based look, controller and model that work, but want to be more advanced than that and provide a RESTful json interface.
However, despite reading everything that I can find in the Play 2 documentation, in the Google Play 2 groups and on the stackoverflow website, I still can't get this to work.
I updated my controller based on previous reviews, and now I believe that it is based on documentation.
Here is my updated controller:
package controllers; import models.Member; import play.*; import play.mvc.*; import play.libs.Json; import play.data.Form; public class Api extends Controller { public static Result member(Long id){ ObjectNode result = Json.newObject(); Member member = Member.byid(id); result.put("id", member.id); result.put("email", member.email); result.put("name", member.name); return ok(result); }
But when I run this, I get the following error:
incompatible types [found: java.lang.Class<play.libs.Json>] [required: java.lang.Class<?extends play.mvc.BodyParser>] In /Users/Mark/Development/EclipseWorkspace/ms-loyally/loyally/app/controllers/Api.java at line 42. 41
As far as I can tell, I copied from the documentation , so I would appreciate any help in its work.
source share