I want to match all requests with a PathVariable which are not start with 'api'. I test following RequestMapping. spring could match request but could not get value for PathVariable. How I solve this?
@RequestMapping(value = "/{name:(?!api).+}", method = RequestMethod.GET)
public void getNotApi(@PathVariable String name, HttpServletResponse response) {
...
}
I get following message for some request like localhost:8080/resource
.
Error 500 Missing URI template variable 'name' for method parameter of type String
@RequestMapping(value = "/{name:^(?!api).+}", method = RequestMethod.GET)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With