// stream for ftp-client errors
final ByteArrayOutputStream berr = new ByteArrayOutputStream();
// create new ftp client
final FTPClient ftpClient = new FTPClient();
// get a connection
if (openConnection(ftpClient, entryUrl)) {
// test if the specified file is a directory
if (file.length() > 0) {
ftpClient.exec("cd \"" + path + "\"", false);
final boolean isFolder = ftpClient.isFolder(file);
if (isFolder) {
path = fullPath + "/";
file = "";
}
}
if (file.length() == 0) {
// directory -> get list of files
final RequestHeader requestHeader = new RequestHeader();
if (request.referrerhash() != null) {
final DigestURI u = this.sb.getURL(Segments.Process.LOCALCRAWLING, request.referrerhash());
if (u != null) requestHeader.put(RequestHeader.REFERER, u.toNormalform(true, false));
}
final StringBuilder dirList = ftpClient.dirhtml(path);
if (dirList == null) {
response = null;
} else {
final ResponseHeader responseHeader = new ResponseHeader();