0

我尝试使用JCIFS (SmbFile)概念在受保护的共享文件夹上写入文件。以下是我尝试并成功在受保护文件夹上写入文件的代码片段:

String username = "username";
String password = "password";
String protectedFolder = "smb://machineName/protectedFolderName";
String fileName = "SampleFile.xls";
String filePath = protectedFolder + fileName;
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(username  + ":" +   
password);
SmbFile protectedFile = new SmbFile(strTemplate, auth);
SmbFileOutputStream fileOut = new SmbFileOutputStream(protectedFile);
wb.write(fileOut);
fileOut.close();

The above code successfully creates 'SampleFile.xls' in the protected folder.

如果我想通过单击链接(href)从 jsp 页面打开该文件,我如何执行上述 JCIFS 身份验证?对此的任何想法都是可观的。

谢谢。

4

0 回答 0