前端json post 请求 后端怎么接收
数据类型
{"phone":"222222","code":"333333"}:
前端提交
POST /api/test HTTP/1.1
Host: 192.168.135.69:81
Connection: keep-alive
Content-Length: 18
Origin: http://192.168.135.69:81
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1
Content-Type: application/x-www-form-urlencoded
Accept: */*
Referer: http://192.168.135.69:81/
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
数据类型
{"phone":"222222"}
后台代码
@At
@Ok("json")
@Filters
@POST
@AdaptBy(type= JsonAdaptor.class)
public Object test(@Param("..") NutMap nutMap, HttpServletRequest req) {
System.out.println("nutMap::" + nutMap);
System.out.println("longin ::" + req);
return Result.success("system.success");
}
报错信息
2019-01-05 20:02:20,560 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(portalGlobalsNavService) in AnnotationIocLoader(packages=[com.yunqi])
2019-01-05 20:02:20,560 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:223) DEBUG - >> Make...'portalGlobalsNavService'<class com.yunqi.modules.service.portal.PortalGlobalsNavService>
2019-01-05 20:02:20,560 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:65) DEBUG - Save object 'portalGlobalsNavService' to [app]
2019-01-05 20:02:20,560 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) DEBUG - Get 'dao'<>
2019-01-05 20:02:20,560 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) DEBUG - Load class com.yunqi.modules.service.portal.PortalGlobalsNavService without AOP
2019-01-05 20:02:20,560 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) DEBUG - Get 'dao'<>
2019-01-05 20:02:20,561 org.nutz.service.EntityService.<init>(EntityService.java:41) DEBUG - Get TypeParams for self : com.yunqi.modules.models.portal.Portal_Globals_nav
nutMap::null
longin ::org.apache.shiro.web.servlet.ShiroHttpServletRequest@334e3d74
2019-01-05 20:02:20,572 com.yunqi.common.processor.LogTimeProcessor.process(LogTimeProcessor.java:24) DEBUG - [POST]URI=/app/test 60ms