在我的文件系统,Web服务中为文件创建url

时间:2017-03-25 04:12:36

标签: java web-services soap url-routing java-ee-7

my file system

我试图将这些csv文件显示为url,但我失败了

我如何在文件系统中获取文件的URL?

 public DownloadFileResponse downloadFile(DownloadFileRequest req) {

      //TODO: create and set ImportMarketResponse object and return the following as response data
      // "EventSet Id: " + req.eventSetId;

        String txt ="EventSet Id: " + req.eventSetId;
        DownloadFileResponse res = new DownloadFileResponse();
        res.setReturnDate(txt);

        return res;

    }

1 个答案:

答案 0 :(得分:0)

获取文件的网址:

Java 7 +

Paths.get("path","to","file").toUri().toURL()

旧版本

new File(path).toURI().toURL();