【发布时间】:2018-08-28 12:53:29
【问题描述】:
我在使用 Apache IO FTPSClient 将文档放在 FTPS 服务器上时遇到问题。我能够连接到服务器。我的状态很好(返回 211)。如果我要求提供目录列表,我会得到空值。
// context is the SSL context
FTPSClient client = new FTPSClient(context);
InputStream stream = null;
try {
// fetching a document from a URL. returning the input stream.
// The stream is not null
ContentDocDO docDo = soapClient.fetchDocument(docURL, contextOpt);
stream = docDo.getStream();
client.connect("someftpserver.com");
client.enterLocalPassiveMode();
client.login("someuser", "somepassword");
client.changeWorkingDirectory("/RIM/test");
System.out.println("client status: "+client.getStatus());
// Changing the name of the document to be stored
String fileName = docNameMap.get(name) + docDo.getContentType();
client.storeFile(fileName,stream);
stream.close();
} catch (IOException e) {
e.printStackTrace();
}
finally {
try{
if(stream != null){
stream.close();
}
client.disconnect();
}catch(IOException e){
e.printStackTrace();
}
}
我没有看到任何错误。我可以通过 FileZilla 连接到服务器。它使用基于 TLS 的显式 FTP。
感谢您的帮助。
【问题讨论】:
标签: java ftp-client