1
@RequestMapping(value = "/Foo/{id}/{friendlyUrl:*}", method = RequestMethod.GET)
public ModelAndView getFoo(@PathVariable final Long id, @PathVariable final String friendlyUrl, final Principal principal) {
/* then match friendlyUrl, 
 * if it doesn't match use redirect 
 * view to send to correct place*/
}

アスタリスクを使用する場所で、IDE がエラーで戻ってきますか?

4

1 に答える 1

1

マッチングに正規表現を使用するつもりなら、あなたが望むのは

"/Foo/{id}/{friendlyUrl:.*}"

ドキュメントによると、パターンは{varName:regex}.

于 2012-12-29T16:59:01.783 に答える