Exemplo n.º 1
0
  /*
   *	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;
  }
Exemplo n.º 2
0
  /*
   *	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;
  }
Exemplo n.º 3
0
  /*
   *	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;
  }