嗯,我在Spring中執行「DELETE」HTTP請求時出現了一個奇怪的問題。Spring - 405 Http方法此URL不支持DELETE
我有我制訂一個DELETE請求到一個控制器方法:
@RequestMapping(value = "/{authorizationUrl}",method=DELETE)
public void deleteAuthorizationServer(
@RequestHeader(value="Authorization") String authorization,
@PathVariable("authorizationUrl") String authorizationUrl)
throws IOException {
System.out.println("TEST");
}
控制器使用@RequestMapping("/authorization_servers");
當我通過我的DEV HTTP客戶端發送一個請求,我收到響應映射:405 Http method DELETE is not supported by this URL
。
的要求是這樣的:
DELETE localhost:8080/authorization_servers/asxas
Headers:
Authorization: "test:<stuff>"
如果有人來調查此事,並幫助我,我將不勝感激
你對控制器類本身有什麼映射?你有沒有設置@ApplicationPath? – jgitter
謝謝!我有這個'@RequestMapping(「/ authorization_servers」)' –
按照建議將它移動到註釋中。該方法由Ajax調用,對嗎? – geoand