/* * URL_PUT_ITEM_MODIFY = [/city/{id}] * Accept = application/json */ @RequestMapping( value = {"/{id:[0-9]+}"}, method = RequestMethod.PUT) @ResponseBody public CityCommand putCityModify(@PathVariable int id, @RequestBody CityCommand city) { log.info("putCityModify()... id = " + id); log.info("putCityModify()... city.id = " + city.getId()); return city; }
/* * URL_POST_ITEM_APPEND = [/city] or [/city/] * Accept = application/json */ @RequestMapping( value = {"", "/"}, method = RequestMethod.POST) // POST로 요청을 하면 입력으로 응답 @ResponseBody public CityCommand postCityAppend( @RequestBody CityCommand command) { // CityCommand는 웹페이지form에 있는 데이터 log.info("postCityAppend()... city.id = " + command.getId()); command.validate(); if (!command.isValid()) // 에러발생시 ajax에서 errorcallback 호출 { // throw } int id = cityRegisterService.regist(command.getCity()); command.setId(id); return command; }