0
我試圖使用curl得到以下方法:問題與捲曲GET請求和Spring MVC請求映射
我使用捲曲如下:
curl -i -H Accept:application/json http://localhost:8080/kadjoukor/geolocations?findByPostcodeFirstChars%26postcodeFirstChars=7500
然而,上述捲曲命令總是拿這個方法(從Roo的ITD),而不是上面的一個:
@RequestMapping(headers = "Accept=application/json")
@ResponseBody
public ResponseEntity<String> GeolocationController.listJson() {
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json; charset=utf-8");
List<Geolocation> result = geolocationRepository.findAll();
return new ResponseEntity<String>(Geolocation.toJsonArray(result), headers, HttpStatus.OK);
}
我不知道我得到錯誤的。有人可以幫忙嗎?