Here is a snippet from my code that does something similar.
------------------------------
public FtpletResult onUploadStart(FtpSession session, FtpRequest request)
throws FtpException, IOException {
if (isExternalInterface(session) && !
isSecureConnection(session)) {
//security issue, either the control or data port is
unsecure
LOG.error("About to start an upload, but either the
control or data connection is unsecure. Upload aborted.");
FtpReply reply = new DefaultFtpReply(FtpReply.
REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "Session is not secure. Issue PROT P
command first.);
session.write(reply);
return FtpletResult.SKIP;
}
return super.onUploadStart(session, request);
}
Best Regards,
Gary Bell.