我有我的休息的URI如下REST與Spring控制器問題
/leagues
- 列出所有聯賽迄今爲止舉辦/leagues/{leagueName}
- 的細節給leagueName
/leagues/{leagueName}/levels/
- 列出所有級別(例如季後賽,QF,SF等)
控制器
1.
@RequestMapping (value = "/leagues", method = RequestMethod.GET)
public String list(Model model)
{
return "/leagues/list";
}
2.
@RequestMapping (value = "/leagues/{leagueName}", method = RequestMethod.GET)
public String leagues(@PathVariable String leagueName, Model model)
{
return "/leagues/league";
}
3.
@RequestMapping (value = "/leagues/{leagueName}/levels", method = RequestMethod.GET)
public String levels(@PathVariable ("leagueName") String leagueName, Model model)
{
return "/leagues/levels/list";
}
我遇到的問題是正在被調用的(2)/leagues/{leagueName}
控制器方法當我嘗試(2)/leagues/levels/
。如何解決這個問題需要幫助。
可以共享控制器如何聲明 - 它的語法和請求映射 –
@ ArunPJohny添加映射 –
看看你的映射。沒有別的東西可能會將這條路徑映射到。您是否想要訪問「/ leagues/myleague/levels /'也許? – Bart