如何在Spring Boot中访问请求参数(JSON对象)

时间:2016-06-28 08:22:16

标签: java spring-boot

如何访问请求参数?在我的例子中,我得到@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));

0 个答案:

没有答案
相关问题