/* * URL_DELETE_ITEM_DELETE = [/city/{id}] * Accept = application/json */ @RequestMapping( value = {"/{id:[0-9]+}"}, method = RequestMethod.DELETE) @ResponseBody public CityCommand deleteCity(@PathVariable int id) { log.info("deleteCity()... id = " + id); CityCommand city = new CityCommand(); city.setId(id); 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; }