如何访问请求参数?在我的例子中,我得到@RequestMapping(method = RequestMethod.POST, value= "/updateWebUserProfile", produces="application/json")
public Person update(@RequestBody Person person) //person.firstname is null here
updateWebUserProfile(data: any){
let body = JSON.stringify(data); //{"firstname":"test", "lastname":"test2"}
let headers = new Headers();
headers.append('Content-Type', 'application/json');
let options = new RequestOptions({ headers: headers });
return this._http.post(this.updateUserProfileURL, body, options)
.map(this.extractData)
.catch(this.handleError);
}
private extractData(res: Response) {
let body;
if (res.text()) {
body = res.json();
}
return body || {};
}
Angular 2中的http请求
file_put_contents(ini_get('error_log'), '');
error_log(print_r(, true));