1
我寫了下面的控制器使用彈簧MVC。 請求URL/webbroker /被映射到請求GET和POST.For得到它的工作正常,但是對於POST它的拋出錯誤。相同的請求映射獲取和發佈不適用於彈簧
請求方法GET不支持。
任何想法爲什麼它的行爲是這樣的?
@Controller
public class ProxyController {
@Autowired
private RequestHandler reqHandler;
@Autowired
private ResponseHandler responseHandler;
@RequestMapping(value = "/webbroker/**", method = RequestMethod.GET)
public void edgefxGetRequest(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
throws IOException {
HttpURLConnection connection = this.reqHandler.handleRequest(httpRequest, httpResponse, false);
this.responseHandler.sendResponse(connection, httpResponse);
}
@RequestMapping(value = "/webbroker/**", method = RequestMethod.POST)
public void edgefxPostRequest(HttpServletRequest httpRequest,
HttpServletResponse httpResponse) throws IOException, URISyntaxException {
HttpURLConnection connection = this.reqHandler.handleRequest(httpRequest, httpResponse, true);
this.responseHandler.sendResponse(connection, httpResponse);
}
@RequestMapping(value = "/webbroker-strong/**", method = RequestMethod.GET)
public void edgefxStrongGetRequest(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
throws IOException {
HttpURLConnection connection = this.reqHandler.handleRequest(httpRequest, httpResponse, false);
this.responseHandler.sendResponse(connection, httpResponse);
}
@RequestMapping(value = "/webbroker-strong/**", method = RequestMethod.POST)
public void edgefxStrongPostRequest(HttpServletRequest httpRequest,
HttpServletResponse httpResponse) throws IOException, URISyntaxException {
HttpURLConnection connection = this.reqHandler.handleRequest(httpRequest, httpResponse, true);
this.responseHandler.sendResponse(connection, httpResponse);
}
}
不要只是發佈異常消息發佈完整的堆棧跟蹤/日誌記錄... –