PlayFramework 1.2.x 在Controller 中识别JSON提交

链接 http://stackoverflow.com/questions/6132892/consuming-json-in-play-framework-controller

@Global
public class JsonObjectBinder implements TypeBinder<JsonObject> {

    @Override
    public Object bind(String name, Annotation[] annotations, String value, Class actualClass, Type genericType) throws Exception {
        return new JsonParser().parse(value);
    }

}

然后就可以

public static void handleJsonBody(JsonObject body) {
    ...
}

 

posted @ 2014-02-23 16:39  张旋  阅读(831)  评论(0编辑  收藏  举报