This fails:
@GetMapping("/resource/{*tail}")
public Object statics(@PathVariable String tail) {...}
with
Required URI template variable 'tail' for method parameter type String is not present
In fact what you need is
@GetMapping("/resource/{*tail}")
public Object statics(@PathVariable("*tail") String tail) {...}
This isn't really obvious from either the error message or the docs. Maybe we should support the first variant anyway?
Comment From: poutsma
I can't reproduce this. With the following handler method:
@GetMapping("/resources/{*tail}")
public String handle(@PathVariable String tail) {
return tail;
}
a request for /resources/foo/bar/baz
returns /foo/bar/baz
.
Comment From: poutsma
This issue was probably due to using the default AntPathMatcher
in combination with a capturing pattern ({*foo}
). We should throw an exception when users do so.