NimChimpsky
NimChimpsky

Reputation: 47300

spring mvc matching a url and using as variable

@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*/
}

Where I use the asterix my ide is coming back with an error ?

Upvotes: 1

Views: 977

Answers (1)

Marcel Stör
Marcel Stör

Reputation: 23565

If you meant to use regex for matching then I guess what you want is

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

As per the doc the pattern must be {varName:regex}.

Upvotes: 1

Related Questions