赞
踩
排查了下原因
造成错误的原因:controller层请求 是标识 RequestMethod.POST的请求
@RequestMapping(value = "/downloadFile", method = RequestMethod.POST)
public void downloadFile(HttpServletRequest request, HttpServletResponse response,
@RequestParam(value = "service_name", required = false) String serviceName,
@RequestParam("operator_code") String operatorCode)
throws UnsupportedEncodingException {
然而在执行:内部发起请求的时候
ResponseEntity<String> res = restTemplate.postForEntity(fileTransferBO.getFlmServerAddress(), ExcelUtils.createFileHttpParam(fileTransferBO), String.class);
请求所调用的接口方式是:method = RequestMethod.GET
@RequestMapping(value = "/getFileInfo", method = RequestMethod.GET)
@ResponseBody
public ApiResult getFileInfo(@RequestBody() FileTransferBO fileTransferBO) {
所以报这个错误。
解决:
这里把内部所调用的请求方式和controller层的调成一致即可解决该问题。
@RequestMapping(value = "/getFileInfo", method = RequestMethod.POST)
@ResponseBody
public ApiResult getFileInfo(@RequestBody() FileTransferBO fileTransferBO) {
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。