2014-11-20 5 views
0

REST PUT 메소드를 작성하려고하는데 요청자가 전송하는 본문을 가져 오는 방법이 확실하지 않습니다. 예를 들어, 그는 JSON에 직렬화 된 Person 객체를 보내려고하고 JSON을 다시 Person 객체로 직렬화하려고합니다. 내가 여기에 봄 PUT에 많이 찾을 수 있지만 수Spring MVC - PUT - JSON을 Java 객체로 serialize

내가 무엇을 가지고 :

@RequestMapping(method = RequestMethod.PUT) 
    public Person registerPerson(@PathVariable String siteId, @ModelAttribute("personForm") Person user) throws Exception { 

     //some Logic 

    } 

내가 제대로이 일을하고 있다고 생각하지 않습니다. @ModelAttribute가 자동으로 직렬화됩니까?

+0

_body. –

+0

@SotiriosDelimanolis 내가 요청 매핑 아래에서 맨 위에 놓을 곳은 어디입니까? – Alan

+1

http://stackoverflow.com/questions/11291933/requestbody-and-reponsebody-spring –

답변

0

이를 시도해보십시오가 RequestBody` @`확인 requestor_ 것을

@RequestMapping(method = RequestMethod.PUT) 
    public Person registerPerson(@RequestBody Person user) throws Exception { 

     //some Logic 

    } 
관련 문제