angularjs代码:
$http({
method: 'POST',
url:'/hello/rest/user/test',
data: {user: 'aaaaa'}
});
服务器代码:
@POST
@Path("/test")
public Response merge(@Context HttpServletRequest request) {
System.out.println(request.getParameter("user"));
if (request.getParameter("user") == null) {
return Response.status(Status.BAD_REQUEST).build();
}
return Response.ok().build();
}
request.getParameter("user") 为空。我无法通过这种方式修改参数。