@RequestBody

来源:互联网 发布:淘宝子账号干嘛的 编辑:程序博客网 时间:2024/06/08 16:29

@RequestBody annotated parameters get linked to the HTTP request body. Parameter values are converted to the declared method argument type using HttpMessageConverters. This annotation indicates a method parameter should be bound to the body of the web request.

For example Angular request for Spring RequestBody would look like that:

$scope.user = {            username: "foo",            auth: true,            password: "bar"        };    $http.post('http://localhost:7777/scan/l/register', $scope.user).                        success(function (data, status, headers, config) {                            ...                        })@RequestMapping(method = RequestMethod.POST, produces = "application/json", value = "/register")public Map<String, String> register(Model uiModel,                                    @RequestBody User user,                                    HttpServletRequest httpServletRequest) {... 
0 0
原创粉丝点击