Ejemplo n.º 1
0
 @Override
 public void execute(ChannelHandlerContext ctx, FtpSessionHandler fs, String param) {
   Logger logger = fs.getLogger();
   String message = fs.getFtpMessage("214_Command_Recognized");
   message += "\r\n";
   try {
     message += Utility.getAllSupportingCommand();
     if (!message.endsWith("\r\n")) message += "\r\n";
     message += fs.getFtpMessage("214_Ok");
     Utility.sendMessageToClient(ctx.channel(), logger, fs.getClientIp(), message);
   } catch (ClassNotFoundException e) {
     Utility.sendMessageToClient(ctx.channel(), logger, fs.getClientIp(), e.getMessage());
   }
 }
Ejemplo n.º 2
0
 /**
  * It perform both security test and file existence test;<br>
  * if one of these tests fail, it will return error message.
  */
 @Override
 public void execute(ChannelHandlerContext ctx, FtpSessionHandler fs, String inPath) {
   Logger logger = fs.getLogger();
   FtpServerConfig serverConfig = fs.getServerConfig();
   FileManager fm = serverConfig.getFileManager();
   logger.debug("param=" + inPath + "|");
   try {
     fm.deleteFile(fs, inPath);
     Utility.sendMessageToClient(
         ctx.channel(), logger, fs.getClientIp(), fs.getFtpMessage("250_Delete_Ok"));
   } catch (IOException | AccessDeniedException | NotAFileException err) {
     Utility.sendMessageToClient(ctx.channel(), logger, fs.getClientIp(), err.getMessage());
   } catch (PathNotFoundException | InvalidPathException err) {
     Utility.sendMessageToClient(
         ctx.channel(),
         logger,
         fs.getClientIp(),
         fs.getFtpMessage("550_File_Delete_Failure") + ":" + err.getMessage());
   }
 }
Ejemplo n.º 3
0
 public void execute(ChannelHandlerContext ctx, FtpSessionHandler fs, String param) {
   Utility.sendMessageToClient(
       ctx.channel(), fs.getLogger(), fs.getClientIp(), fs.getFtpMessage("200_Opt_Response"));
 }