나는 쉬는 서비스를 통해 디렉토리 브라우징을 시도한다. 그것과 같이 정의는 : 내가 디렉토리와 같은 정의를 사용하는 경우특정 @RequestMapping에 대해 욕심 많은 @PathVariable을 활성화하는 방법은 무엇입니까?
@RequestMapping(path="ls/{path:.+}", method = RequestMethod.GET)
public List<String> getDirectoryListing(@PathVariable("path") String path) throws IOException {
// ...
}
그러나, PathVariable {path:.+}
는 문제를 소개합니다. 예를 들어,
$ curl http://localhost:8080/fileRepo/ls/dir/subdir
\___ ___/
V
{path:.+}
는
{
"timestamp":1485690489272,
"status":404,"error":"Not Found",
"message":"No message available",
"path":"/dataset/ls/processed/dir1/subdir"
}
결과와 콘솔에 디버그 메시지를해야합니다
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 {}
겠어요 - RequestMappingHandlerMapping에 ls/{path:.+}
이 모두 getDirectoryListing
으로 해결되어야한다고 알리는 방법은 무엇입니까?
'@ RequestParam'과 함께'/'를 포함하는 URL 만 전달할 수 있지만'@ PathVariable'이 아닌 URL을 전달할 수 없습니다. –