2017-03-25 68 views
0

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; 

    } 

回答

0

文件獲取網址:

的Java 7+

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

舊版

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