I try to enable directory browsing in via a rest service. Its defined like this:
@RequestMapping(path="ls/{path:.+}", method = RequestMethod.GET)
public List<String> getDirectoryListing(@PathVariable("path") String path) throws IOException {
// ...
}
However, the PathVariable {path:.+}
introduces problems, if i use a directory-like definition. For example,
$ curl http://localhost:8080/fileRepo/ls/dir/subdir
\___ ___/
V
{path:.+}
will result in
{
"timestamp":1485690489272,
"status":404,"error":"Not Found",
"message":"No message available",
"path":"/dataset/ls/processed/dir1/subdir"
}
and have the debug messages on the console
s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /files/ls/dir1/subdir
s.w.s.m.m.a.RequestMappingHandlerMapping : Did not find handler method for [/files/ls/dir1/subdir]
o.s.w.s.handler.SimpleUrlHandlerMapping : Matching patterns for request [/files/ls/dir1/subdir] are [/**]
o.s.w.s.handler.SimpleUrlHandlerMapping : URI Template variables for request [/files/ls/dir1/subdir] are {}
So. how to tell the RequestMappingHandlerMapping that ls/{path:.+}
should all resolve to getDirectoryListing
?