在我的控制,我有以下這些方法運作良好Requestmapping不工作時,有頭
@RequestMapping(value="/searchresults",method = RequestMethod.GET)
public SearchResponse searchResults(
@PathVariable("domain") String domain,
@RequestParam(value="rowCount" , defaultValue="0", required=false) Integer rowCount,
HttpServletRequest req){}
但加入頭時,同樣的事情不工作,
@RequestMapping(value="/searchresults", method = RequestMethod.GET,headers = "application/json;charset=UTF-8")
public SearchResponse searchResults(
@PathVariable("domain") String domain,
@RequestParam(value="rowCount" , defaultValue="0", required=false) Integer rowCount,
HttpServletRequest req){}
例外: 表示形式:null org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException:找不到匹配的處理程序方法 t request:path'/search/searchresults.json',方法'GET',
我試過如下,
@RequestMapping(value="/searchresults", method = RequestMethod.GET,headers = {"content-type=application/json,charset=UTF-8"})
但它拋出, java.lang.IllegalArgumentException異常: 「字符集= UTF-8」 不包含 '/'
如何解決它
我試圖頭= { 「內容類型=應用/ JSON,字符集= UTF-8」},但它拋出的java .lang.IllegalArgumentException:「charset = UTF-8」不包含'/' – tjkmr 2014-09-11 05:37:46