请在下面找到我的控制器代码。
@RequestMapping(value = "/reconrangesummary", method=RequestMethod.POST, produces=MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public String getReconRangeSummaryReport(@RequestBody RequestData requestData){
logger.info("Inside Interest Service Controller - getReconRangeSummaryReport");
List<ReconRangeSummaryDetails> reconRangeSummaryDetails = new ArrayList<ReconRangeSummaryDetails>();
DashboardRequestDetails requestDetails = AccountUtils.convertRequest(requestData);
reconRangeSummaryDetails = accountService.getReconRangeSummaryDetails(requestDetails);
logger.info("Exit Interest Service Controller - getReconRangeSummaryReport");
return new Gson().toJson(reconRangeSummaryDetails);
}
请求数据类:
public class RequestData {
private String role;
private String branchCode;
private String circle;
private String requestDate;
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getBranchCode() {
return branchCode;
}
public void setBranchCode(String branchCode) {
this.branchCode = branchCode;
}
public String getCircle() {
return circle;
}
public void setCircle(String circle) {
this.circle = circle;
}
public String getRequestDate() {
return requestDate;
}
public void setRequestDate(String requestDate) {
this.requestDate = requestDate;
}
我正在使用POST 方法和 content-type:application/json在邮递员中传递以下请求。
{"role":"makeruser", "branchCode":"00112", "circle":"circlename", "requestDate":"17-12-2018"}
但我收到如下错误响应。
HTTP 状态 415
服务器拒绝此请求,因为请求实体的格式不受所请求方法 () 的请求资源支持。