spring mvc 4 rest 錯誤:JSPs only permit GET POST or HEAD

 

採用的@Controller,    請求PUT和DELETE拋擲異常,PUT請求代碼以下:java

@RequestMapping(value="/testREST/{id}", method=RequestMethod.PUT)
	public String testRESTPut(@PathVariable Integer id){
		System.out.println("test REST PUT: "+ id);
		return SUCCESS;
	}

如上能夠請求,正常調用方法處理,返回success對應的JSP,狀態異常:app

type Status report.net

message JSPs only permit GET POST or HEADcode

description The specified HTTP method is not allowed for the requested resource.ip

若是把請求變成@ResponseBody則正常。ci

REST風格返回必定是@ResponseBody,不能返回頁面嗎?get

相關文章
相關標籤/搜索