android 发送json 到服务器 spring 怎么接收?

来源:互联网 发布:bpa软件 编辑:程序博客网 时间:2024/05/02 11:32

Android 端 :

JsonObject  stu=new JsonObject();
stu.put("id",123);
stu.put("name","XXX");

StringEntity entity=new StringEntity(stu.toString());

post.setEntity(entity);


服务器端 :

@RequestMapping(value="/test2",method=RequestMethod.POST) 
public Stu test2(@RequestBody Stu stu){
System.out.println(stu);
                return stu;
}


android端返回 :

request  entity is in a format not supported by the requested resource for the requested method.

0 0
原创粉丝点击