Java 获取文件名';使用SpringRestTemplate列出

Java 获取文件名';使用SpringRestTemplate列出,java,spring,resttemplate,Java,Spring,Resttemplate,首次使用SpringRestTemplate。使用SpringRestTemplate,是否有一种简单的方法来获取远程目录中包含的文件名列表 为了得到一个特定的文件名,我想 @Autowired private RestTemplate restTemplate; (...) String fileUrl = "https://myrepo.com/filename.xml"; HttpHeaders httpHeaders = restTemplate.headForHeaders(fileU

首次使用Spring
RestTemplate
。使用Spring
RestTemplate
,是否有一种简单的方法来获取远程目录中包含的文件名列表

为了得到一个特定的文件名,我想

@Autowired
private RestTemplate restTemplate;
(...)
String fileUrl = "https://myrepo.com/filename.xml";
HttpHeaders httpHeaders = restTemplate.headForHeaders(fileUrl);
FileDTO fileDTO = parseHttpHeaders(httpHeaders);
但这一次,我只是希望目录url“”中包含的文件名列表。
restemplate
API中的哪些方法允许我这样做

我用过

  ResponseEntity<String> response = restTemplate.getForEntity(
                    dirPath, String.class);
ResponseEntity response=restemplate.getForEntity(
dirPath,String.class);
然后从中提取文件名
response.getBody()

如果我只有dir url,我将如何获得其中包含的文件列表?只是我正在使用的文件名列表,而不是我尝试过的javax.net.httpsurlconnection。它没有给出文件名列表。请提供更多资料