On Sun, Nov 20, 2011 at 8:54 PM, Florent Georges <li...@fgeorges.org> wrote: > Niklas Gustavsson wrote: >> On Thu, Nov 17, 2011 at 4:18 PM, Florent Georges wrote: >>> I'd like to have an FTPlet that controls the login of users >>> programmatically. That is, having a method that looks >>> something like (with any complex custom processing in >>> isValidLogin(...)): > >> I would propose to use a custom UserManager rather than an >> Ftplet for this purpose. Would that work for your case? > > Thanks for your response! Unfortunately I had a look at having > a custom user manager (and made some tests), but this is not well > documented (or I did not find the appropriate bits in the doc), > and it's a bit hard to understand how to implement one. > > So for the moment, I stick to a properties file, in order to > investigate a bit more whether FTPlets is really suitable for me. > So now, I try to intercept a STOR command and to implement it > myself. That is, I want to display the content of the file to the > console (just for evaluation purpose) and respond "226 Transfer > complete", instead of having FTP Server handling it. > > But I don't understand how I am supposed to do. If I am right, > the beforeCommand() method is called first on the FTPlet, then > FTP Server itself handles the command, then afterCommand() is > called. But I did not find any way to handle the request myself > and return myself the FtpReply I want to.
This page should describe the basics: http://mina.apache.org/ftpserver/ftplet.html You'll need to implement the handling in your Ftplet (feel free to steal from the command implementations) and return SKIP to the container in order to ignore the default command handler. /niklas