On 25 November 2010 11:18, Aidan Diffey <aidan.dif...@gmail.com> wrote:
> I have embedded the FTP server into a JBoss application. When the > client issues a RETR command, I read a database and get a byte[] which > I the transfer to the client. > > How can I transfer the data to the client with the onDownloadStart > method without opening / closing data connections? > > It sounds like you need to implement your own FilesystemView, FilesystemFactory and FtpFile class, which backends to the database. When FtpServer starts a data transfer, it would request an FtpFile object from the FilesystemView, and call FtpFile's createInputStream(). This InputStream needs to read from your database (or, if you prefer, from a byte[] obtained from a DB read). Configure this with the <filesystem> configuration element, or call setFileSystemManager(). It's possible that an ftplet onDownloadStart() and onDownloadEnd() might do some housekeeping to prepare for the download, and tidy up afterwards, but I think you'll probably find it's not necessary and that that stuff can go in your FtpFile implementation. -- "There is no way to peace; peace is the way"