您好我需要修改现有的Rest界面。旧的Rest界面只接一个电话号码然后查找记录。电话号码过去对表是唯一的。现在是手机和号码(batchid)的组合。所以我需要修改服务impl和调用它的客户端。这是旧控制器:
@RequestMapping(value="/{phone}", method = RequestMethod.GET)
@ResponseBody
public BatchDetail findByPhone(@PathVariable String phone) {
return batchDetailService.findByPhone(phone);
}
以下是旧客户端访问它的方式:
private static final String URL_GET_BATCHDETAIL_PHONE = "http://localhost:8080/Web2Ivr/restful/batchdetail/{phone}";
batchdetail = restTemplate.getForObject(URL_GET_BATCHDETAIL_PHONE, BatchDetail.class, phone);
batchdetail.setStatus("OK");
restTemplate.put(URL_TO_UPDATE_BATCHDETAIL, batchdetail, batchdetail.getId())
所以我的问题是如何修改控制器和restemplate的客户端调用以支持两个变量,phone和number(batchid)之类的东西:
http://localhost:8080/Web2Ivr/restful/batchdetail/{batchid}/{phone}
答案 0 :(得分:1)
@RequestMapping(value="/{batchid}/{phone}", method = RequestMethod.GET)
@ResponseBody
public BatchDetail findByPhone(@PathVariable String phone, @PathVariable String batchid) {
return batchDetailService.findByPhone(phone);
}