Created
January 5, 2012 22:12
-
-
Save Peksa/1567606 to your computer and use it in GitHub Desktop.
Revisions
-
Peksa revised this gist
Jan 29, 2012 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,8 +16,7 @@ public Object bind(String name, Class clazz, Type type, Annotation[] annotations { if (name.equals("json")) { return new Gson().fromJson(Scope.Params.current().get("body"), clazz); } } return null; -
Peksa created this gist
Jan 5, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ package misc; import play.*; import play.mvc.*; import com.google.gson.*; import java.util.*; import java.lang.reflect.*; import java.lang.annotation.*; public class BinderPlugin extends PlayPlugin { public Object bind(String name, Class clazz, Type type, Annotation[] annotations, Map<String, String[]> params) { if (Http.Request.current().contentType.equals("application/json")) { if (name.equals("json")) { JsonObject json = new JsonParser().parse(Scope.Params.current().get("body")).getAsJsonObject(); return new Gson().fromJson(json, clazz); } } return null; } }