我有一個使用Spring 3.2.2的應用程序。我在Tomcat上運行它。我可以在URL路徑中使用頂級域名嗎?
在應用程序中,我有一個返回JSON的控制器。
如果控制器請求映射包含字符串「.com
」,「.org
」,「.talk
」,我得到HTTP錯誤406
由該請求所標識的資源僅能夠生成具有不能接受的特性 響應的根據請求 「接受」標題。
例子:
這工作得很好:
@RequestMapping(method = RequestMethod.GET, value = "/test.test")
public @ResponseBody Map<String, String> test() {
Map<String, String> stringMap = new HashMap<String, String>();
stringMap.put("test", "test");
return stringMap;
}
這會導致HTTP錯誤406:
@RequestMapping(method = RequestMethod.GET, value = "/test.talk")
public @ResponseBody Map<String, String> test() {
Map<String, String> stringMap = new HashMap<String, String>();
stringMap.put("test", "test");
return stringMap;
}
問題不在於與我嘗試了所有的域名轉載。例如「.net
」工作正常。
你應該動態地得到它@運行時間和武官它。 – Ketan
您是否使用瀏覽器?如果是這樣,什麼版本? – DaveRlz
我在Win 7上使用Chrome 29.0.1547.66 m版本。此問題也在Firefox 12 –