incubator-ftpserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r497189 [1/2] - in /incubator/ftpserver/trunk: core/src/java/org/apache/ftpserver/command/ core/src/java/org/apache/ftpserver/listener/ ftplet-api/src/java/org/apache/ftpserver/ftplet/
Date Wed, 17 Jan 2007 21:47:18 GMT
Author: ngn
Date: Wed Jan 17 13:47:14 2007
New Revision: 497189

URL: http://svn.apache.org/viewvc?view=rev&rev=497189
Log:
Replacing reply codes with constants for readability

Modified:
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/ABOR.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/ACCT.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/APPE.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/AUTH.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/CDUP.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/CWD.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/DELE.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/EPRT.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/EPSV.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/FEAT.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/HELP.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/LANG.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/LIST.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MD5.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MDTM.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MKD.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MLSD.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MLST.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MODE.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/NLST.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/NOOP.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/OPTS.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/OPTS_MLST.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/OPTS_UTF8.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASS.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASV.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PBSZ.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PORT.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PROT.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PWD.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/QUIT.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/REIN.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/REST.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RETR.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RMD.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RNFR.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RNTO.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_DESCUSER.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_HELP.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_STAT.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_WHO.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_ZONE.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SIZE.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/STAT.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/STOR.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/STOU.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/STRU.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SYST.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/TYPE.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/USER.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/FtpProtocolHandler.java
    incubator/ftpserver/trunk/ftplet-api/src/java/org/apache/ftpserver/ftplet/FtpResponse.java

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/ABOR.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/ABOR.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/ABOR.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/ABOR.java Wed Jan 17 13:47:14 2007
@@ -24,6 +24,7 @@
 import org.apache.ftpserver.FtpSessionImpl;
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -56,6 +57,6 @@
         
         // and abort any data connection
         session.getFtpDataConnection().closeDataSocket();
-        out.send(226, "ABOR", null);
+        out.send(FtpResponse.REPLY_226_CLOSING_DATA_CONNECTION, "ABOR", null);
     }   
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/ACCT.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/ACCT.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/ACCT.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/ACCT.java Wed Jan 17 13:47:14 2007
@@ -24,6 +24,7 @@
 import org.apache.ftpserver.FtpSessionImpl;
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -49,7 +50,7 @@
         session.resetState();
         
         // and abort any data connection
-        out.send(202, "ACCT", null);
+        out.send(FtpResponse.REPLY_202_COMMAND_NOT_IMPLEMENTED, "ACCT", null);
     }   
 }
 

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/APPE.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/APPE.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/APPE.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/APPE.java Wed Jan 17 13:47:14 2007
@@ -31,6 +31,7 @@
 import org.apache.ftpserver.ftplet.FileObject;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.ftplet.Ftplet;
 import org.apache.ftpserver.ftplet.FtpletEnum;
 import org.apache.ftpserver.interfaces.FtpServerContext;
@@ -71,7 +72,7 @@
             // argument check
             String fileName = request.getArgument();
             if(fileName == null) {
-                out.send(501, "APPE", null);
+                out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "APPE", null);
                 return;  
             }
             
@@ -101,32 +102,32 @@
                 log.debug("File system threw exception", e);
             }
             if(file == null) {
-                out.send(550, "APPE.invalid", fileName);
+                out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "APPE.invalid", fileName);
                 return;
             }
             fileName = file.getFullName();
             
             // check file existance
             if(file.doesExist() && !file.isFile()) {
-                out.send(550, "APPE.invalid", fileName);
+                out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "APPE.invalid", fileName);
                 return;
             }
             
             // check permission
             if( !file.hasWritePermission()) {
-                out.send(550, "APPE.permission", fileName);
+                out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "APPE.permission", fileName);
                 return;
             }
             
             // get data connection
-            out.send(150, "APPE", fileName);
+            out.send(FtpResponse.REPLY_150_FILE_STATUS_OKAY, "APPE", fileName);
             InputStream is = null;
             try {
                 is = session.getDataInputStream();
             }
             catch(IOException e) {
                 log.debug("Exception when getting data input stream", e);
-                out.send(425, "APPE", fileName);
+                out.send(FtpResponse.REPLY_425_CANT_OPEN_DATA_CONNECTION, "APPE", fileName);
                 return;
             }
              
@@ -170,12 +171,12 @@
             catch(SocketException e) {
                 log.debug("SocketException during file upload", e);
                 failure = true;
-                out.send(426, "APPE", fileName);
+                out.send(FtpResponse.REPLY_426_CONNECTION_CLOSED_TRANSFER_ABORTED, "APPE", fileName);
             }
             catch(IOException e) {
                 log.debug("IOException during file upload", e);
                 failure = true;
-                out.send(551, "APPE", fileName);
+                out.send(FtpResponse.REPLY_551_REQUESTED_ACTION_ABORTED_PAGE_TYPE_UNKNOWN, "APPE", fileName);
             }
             finally {
                 IoUtils.close(bis);
@@ -184,7 +185,7 @@
             
             // if data transfer ok - send transfer complete message
             if(!failure) {
-                out.send(226, "APPE", fileName);
+                out.send(FtpResponse.REPLY_226_CLOSING_DATA_CONNECTION, "APPE", fileName);
                 
                 // call Ftplet.onAppendEnd() method
                 try {

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/AUTH.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/AUTH.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/AUTH.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/AUTH.java Wed Jan 17 13:47:14 2007
@@ -26,6 +26,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.interfaces.FtpServerContext;
 import org.apache.ftpserver.listener.Connection;
 
@@ -51,7 +52,7 @@
         
         // argument check
         if(!request.hasArgument()) {
-            out.send(501, "AUTH", null);
+            out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "AUTH", null);
             return;  
         }
         
@@ -90,7 +91,7 @@
             }
         }
         else {
-            out.send(502, "AUTH", null);
+            out.send(FtpResponse.REPLY_502_COMMAND_NOT_IMPLEMENTED, "AUTH", null);
         }
     }
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/CDUP.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/CDUP.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/CDUP.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/CDUP.java Wed Jan 17 13:47:14 2007
@@ -26,6 +26,7 @@
 import org.apache.ftpserver.ftplet.FileSystemView;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -64,10 +65,10 @@
         }
         if(success) {
             String dirName = fsview.getCurrentDirectory().getFullName();
-            out.send(250, "CDUP", dirName);
+            out.send(FtpResponse.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "CDUP", dirName);
         }
         else {
-            out.send(550, "CDUP", null);
+            out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "CDUP", null);
         }
     }
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/CWD.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/CWD.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/CWD.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/CWD.java Wed Jan 17 13:47:14 2007
@@ -26,6 +26,7 @@
 import org.apache.ftpserver.ftplet.FileSystemView;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -70,10 +71,10 @@
         }
         if(success) {
             dirName = fsview.getCurrentDirectory().getFullName();
-            out.send(250, "CWD", dirName);
+            out.send(FtpResponse.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "CWD", dirName);
         }
         else {
-            out.send(550, "CWD", null);
+            out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "CWD", null);
         }
     }
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/DELE.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/DELE.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/DELE.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/DELE.java Wed Jan 17 13:47:14 2007
@@ -27,6 +27,7 @@
 import org.apache.ftpserver.ftplet.FileObject;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.ftplet.Ftplet;
 import org.apache.ftpserver.ftplet.FtpletEnum;
 import org.apache.ftpserver.interfaces.FtpServerContext;
@@ -60,7 +61,7 @@
         // argument check
         String fileName = request.getArgument();
         if(fileName == null) {
-            out.send(501, "DELE", null);
+            out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "DELE", null);
             return;  
         }
         
@@ -74,7 +75,7 @@
             ftpletRet = FtpletEnum.RET_DISCONNECT;
         }
         if(ftpletRet == FtpletEnum.RET_SKIP) {
-            out.send(450, "DELE", fileName);
+            out.send(FtpResponse.REPLY_450_REQUESTED_FILE_ACTION_NOT_TAKEN, "DELE", fileName);
             return;
         }
         else if(ftpletRet == FtpletEnum.RET_DISCONNECT) {
@@ -92,7 +93,7 @@
             log.debug("Could not get file " + fileName, ex);
         }
         if(file == null) {
-            out.send(550, "DELE.invalid", fileName);
+            out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "DELE.invalid", fileName);
             return;
         }
 
@@ -100,13 +101,13 @@
         fileName = file.getFullName();
 
         if( !file.hasDeletePermission() ) {
-            out.send(450, "DELE.permission", fileName);
+            out.send(FtpResponse.REPLY_450_REQUESTED_FILE_ACTION_NOT_TAKEN, "DELE.permission", fileName);
             return;
         }
         
         // now delete
         if(file.delete()) {
-            out.send(250, "DELE", fileName); 
+            out.send(FtpResponse.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "DELE", fileName); 
             
             // log message
             String userName = session.getUser().getName();
@@ -131,7 +132,7 @@
 
         }
         else {
-            out.send(450, "DELE", fileName);
+            out.send(FtpResponse.REPLY_450_REQUESTED_FILE_ACTION_NOT_TAKEN, "DELE", fileName);
         }
     }
 

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/EPRT.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/EPRT.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/EPRT.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/EPRT.java Wed Jan 17 13:47:14 2007
@@ -26,6 +26,7 @@
 import org.apache.ftpserver.FtpSessionImpl;
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.interfaces.DataConnectionConfig;
 import org.apache.ftpserver.listener.Connection;
 
@@ -56,7 +57,7 @@
         // argument check
         String arg = request.getArgument();
         if(arg == null) {
-            out.send(501, "EPRT", null);
+            out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "EPRT", null);
             return;  
         }
         
@@ -89,7 +90,7 @@
         }
         catch(UnknownHostException ex) {
             log.debug("Unknown host: " + host, ex);
-            out.send(553, "EPRT.host", null);
+            out.send(FtpResponse.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED, "EPRT.host", null);
             return;
         }
         
@@ -109,11 +110,11 @@
         }
         catch(NumberFormatException ex) {
             log.debug("Invalid port: " + port, ex);
-            out.send(552, "EPRT.invalid", null); 
+            out.send(FtpResponse.REPLY_552_REQUESTED_FILE_ACTION_ABORTED_EXCEEDED_STORAGE, "EPRT.invalid", null); 
             return; 
         }
         
         session.getFtpDataConnection().setPortCommand(dataAddr, dataPort);
-        out.send(200, "EPRT", null);
+        out.send(FtpResponse.REPLY_200_COMMAND_OKAY, "EPRT", null);
     }
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/EPSV.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/EPSV.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/EPSV.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/EPSV.java Wed Jan 17 13:47:14 2007
@@ -25,6 +25,7 @@
 import org.apache.ftpserver.FtpSessionImpl;
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -58,7 +59,7 @@
         // set data connection
         FtpDataConnection dataCon = session.getFtpDataConnection();
         if (!dataCon.setPasvCommand()) {
-            out.send(425, "EPSV", null);
+            out.send(FtpResponse.REPLY_425_CANT_OPEN_DATA_CONNECTION, "EPSV", null);
             return;   
         }
         

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/FEAT.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/FEAT.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/FEAT.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/FEAT.java Wed Jan 17 13:47:14 2007
@@ -25,6 +25,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -46,6 +47,6 @@
         // reset state variables
         session.resetState();
         
-        out.send(211, "FEAT", null);
+        out.send(FtpResponse.REPLY_211_SYSTEM_STATUS_REPLY, "FEAT", null);
     }
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/HELP.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/HELP.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/HELP.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/HELP.java Wed Jan 17 13:47:14 2007
@@ -24,6 +24,7 @@
 import org.apache.ftpserver.FtpSessionImpl;
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.interfaces.MessageResource;
 import org.apache.ftpserver.listener.Connection;
 
@@ -54,16 +55,16 @@
         
         // print global help
         if(!request.hasArgument()) {
-            out.send(214, null, null);
+            out.send(FtpResponse.REPLY_214_HELP_MESSAGE, null, null);
             return;
         }
         
         // print command specific help if available
         String ftpCmd = request.getArgument().toUpperCase();
         MessageResource resource = connection.getServerContext().getMessageResource();
-        if(resource.getMessage(214, ftpCmd, session.getLanguage()) == null) {
+        if(resource.getMessage(FtpResponse.REPLY_214_HELP_MESSAGE, ftpCmd, session.getLanguage()) == null) {
             ftpCmd = null;
         }
-        out.send(214, ftpCmd, null);
+        out.send(FtpResponse.REPLY_214_HELP_MESSAGE, ftpCmd, null);
     }
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/LANG.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/LANG.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/LANG.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/LANG.java Wed Jan 17 13:47:14 2007
@@ -25,6 +25,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.interfaces.MessageResource;
 import org.apache.ftpserver.listener.Connection;
 
@@ -53,7 +54,7 @@
         String language = request.getArgument();
         if(language == null) {
             session.setLanguage(null);
-            out.send(200, "LANG", null);
+            out.send(FtpResponse.REPLY_200_COMMAND_OKAY, "LANG", null);
             return;
         }
         
@@ -65,13 +66,13 @@
             for(int i=0; i<availableLanguages.length; ++i) {
                 if(availableLanguages[i].equals(language)) {
                     session.setLanguage(language);
-                    out.send(200, "LANG", null);
+                    out.send(FtpResponse.REPLY_200_COMMAND_OKAY, "LANG", null);
                     return;
                 }
             }
         }
         
         // not found - send error message
-        out.send(504, "LANG", null);
+        out.send(FtpResponse.REPLY_504_COMMAND_NOT_IMPLEMENTED_FOR_THAT_PARAMETER, "LANG", null);
     }
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/LIST.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/LIST.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/LIST.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/LIST.java Wed Jan 17 13:47:14 2007
@@ -29,6 +29,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 import org.apache.ftpserver.listing.DirectoryLister;
 import org.apache.ftpserver.listing.LISTFileFormater;
@@ -70,14 +71,14 @@
             session.resetState();
             
             // get data connection
-            out.send(150, "LIST", null);
+            out.send(FtpResponse.REPLY_150_FILE_STATUS_OKAY, "LIST", null);
             OutputStream os = null;
             try {
                 os = session.getDataOutputStream();
             }
             catch(IOException ex) {
                 log.debug("Exception getting the output data stream", ex);
-                out.send(425, "LIST", null);
+                out.send(FtpResponse.REPLY_425_CANT_OPEN_DATA_CONNECTION, "LIST", null);
                 return;
             }
             
@@ -97,16 +98,16 @@
             catch(SocketException ex) {
                 log.debug("Socket exception during list transfer", ex);
                 failure = true;
-                out.send(426, "LIST", null);
+                out.send(FtpResponse.REPLY_426_CONNECTION_CLOSED_TRANSFER_ABORTED, "LIST", null);
             }
             catch(IOException ex) {
                 log.debug("IOException during list transfer", ex);
                 failure = true;
-                out.send(551, "LIST", null);
+                out.send(FtpResponse.REPLY_551_REQUESTED_ACTION_ABORTED_PAGE_TYPE_UNKNOWN, "LIST", null);
             } catch(IllegalArgumentException e) {
                 log.debug("Illegal list syntax: " + request.getArgument(), e);
                 // if listing syntax error - send message
-                out.send(501, "LIST", null);
+                out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "LIST", null);
             } finally {
                 writer.flush();
                 IoUtils.close(writer);
@@ -114,7 +115,7 @@
             
             // if data transfer ok - send transfer complete message
             if(!failure) {
-                out.send(226, "LIST", null);
+                out.send(FtpResponse.REPLY_226_CLOSING_DATA_CONNECTION, "LIST", null);
             }
         }
         finally {

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MD5.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MD5.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MD5.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MD5.java Wed Jan 17 13:47:14 2007
@@ -29,6 +29,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FileObject;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 import org.apache.ftpserver.util.IoUtils;
 
@@ -64,7 +65,7 @@
         String argument = request.getArgument();
         
         if(argument == null || argument.trim().length() == 0) {
-            out.send(504, "MD5.invalid", null);
+            out.send(FtpResponse.REPLY_504_COMMAND_NOT_IMPLEMENTED_FOR_THAT_PARAMETER, "MD5.invalid", null);
             return;
         }
 
@@ -90,13 +91,13 @@
             }
             
             if(file == null) {
-                out.send(504, "MD5.invalid", fileName);
+                out.send(FtpResponse.REPLY_504_COMMAND_NOT_IMPLEMENTED_FOR_THAT_PARAMETER, "MD5.invalid", fileName);
                 return;
             }
     
             // check file
             if(!file.isFile()) {
-                out.send(504, "MD5.invalid", fileName);
+                out.send(FtpResponse.REPLY_504_COMMAND_NOT_IMPLEMENTED_FOR_THAT_PARAMETER, "MD5.invalid", fileName);
                 return;
             }
             
@@ -115,7 +116,7 @@
                 
             } catch(NoSuchAlgorithmException e) {
                 log.debug("MD5 algorithm not available", e);
-                out.send(502, "MD5.notimplemened", null);
+                out.send(FtpResponse.REPLY_502_COMMAND_NOT_IMPLEMENTED, "MD5.notimplemened", null);
             } finally {
                 IoUtils.close(is);
             }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MDTM.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MDTM.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MDTM.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MDTM.java Wed Jan 17 13:47:14 2007
@@ -26,6 +26,7 @@
 import org.apache.ftpserver.ftplet.FileObject;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 import org.apache.ftpserver.util.DateUtils;
 
@@ -53,7 +54,7 @@
         // argument check
         String fileName = request.getArgument();
         if(fileName == null) {
-            out.send(501, "MDTM", null);
+            out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "MDTM", null);
             return;  
         }
         
@@ -66,7 +67,7 @@
             log.debug("Exception getting file object", ex);
         }
         if(file == null) {
-            out.send(550, "MDTM", fileName);
+            out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "MDTM", fileName);
             return;
         }
         
@@ -74,10 +75,10 @@
         fileName = file.getFullName();
         if(file.doesExist()) {
             String dateStr = DateUtils.getFtpDate( file.getLastModified() );
-            out.send(213, "MDTM", dateStr);
+            out.send(FtpResponse.REPLY_213_FILE_STATUS, "MDTM", dateStr);
         }
         else {
-            out.send(550, "MDTM", fileName);
+            out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "MDTM", fileName);
         }
     } 
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MKD.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MKD.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MKD.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MKD.java Wed Jan 17 13:47:14 2007
@@ -27,6 +27,7 @@
 import org.apache.ftpserver.ftplet.FileObject;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.ftplet.Ftplet;
 import org.apache.ftpserver.ftplet.FtpletEnum;
 import org.apache.ftpserver.interfaces.FtpServerContext;
@@ -62,7 +63,7 @@
         // argument check
         String fileName = request.getArgument();
         if(fileName == null) {
-            out.send(501, "MKD", null);
+            out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "MKD", null);
             return;  
         }
         
@@ -92,26 +93,26 @@
             log.debug("Exception getting file object", ex);
         }
         if(file == null) {
-            out.send(550, "MKD.invalid", fileName);
+            out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "MKD.invalid", fileName);
             return;
         }
         
         // check permission
         fileName = file.getFullName();
         if( !file.hasWritePermission() ) {
-            out.send(550, "MKD.permission", fileName);
+            out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "MKD.permission", fileName);
             return;
         }
         
         // check file existance
         if(file.doesExist()) {
-            out.send(550, "MKD.exists", fileName);
+            out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "MKD.exists", fileName);
             return;
         }
         
         // now create directory
         if(file.mkdir()) {
-            out.send(250, "MKD", fileName);
+            out.send(FtpResponse.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "MKD", fileName);
             
             // write log message
             String userName = session.getUser().getName();
@@ -136,7 +137,7 @@
 
         }
         else {
-            out.send(550, "MKD", fileName);
+            out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "MKD", fileName);
         }
     }
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MLSD.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MLSD.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MLSD.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MLSD.java Wed Jan 17 13:47:14 2007
@@ -29,6 +29,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 import org.apache.ftpserver.listing.DirectoryLister;
 import org.apache.ftpserver.listing.FileFormater;
@@ -67,14 +68,14 @@
             session.resetState();
             
             // get data connection
-            out.send(150, "MLSD", null);
+            out.send(FtpResponse.REPLY_150_FILE_STATUS_OKAY, "MLSD", null);
             OutputStream os = null;
             try {
                 os = session.getDataOutputStream();
             }
             catch(IOException ex) {
                 log.debug("Exception getting the output data stream", ex);
-                out.send(425, "MLSD", null);
+                out.send(FtpResponse.REPLY_425_CANT_OPEN_DATA_CONNECTION, "MLSD", null);
                 return;
             }
             
@@ -95,16 +96,16 @@
             catch(SocketException ex) {
                 log.debug("Socket exception during data transfer", ex);
                 failure = true;
-                out.send(426, "MLSD", null);
+                out.send(FtpResponse.REPLY_426_CONNECTION_CLOSED_TRANSFER_ABORTED, "MLSD", null);
             }
             catch(IOException ex) {
                 log.debug("IOException during data transfer", ex);
                 failure = true;
-                out.send(551, "MLSD", null);
+                out.send(FtpResponse.REPLY_551_REQUESTED_ACTION_ABORTED_PAGE_TYPE_UNKNOWN, "MLSD", null);
             } catch(IllegalArgumentException e) {
                 log.debug("Illegal listing syntax: " + request.getArgument(), e);
                 // if listing syntax error - send message
-                out.send(501, "MLSD", null);
+                out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "MLSD", null);
             }
             finally {
                 writer.flush();
@@ -113,7 +114,7 @@
             
             // if data transfer ok - send transfer complete message
             if(!failure) {
-                out.send(226, "MLSD", null);
+                out.send(FtpResponse.REPLY_226_CLOSING_DATA_CONNECTION, "MLSD", null);
             }
         }
         finally {

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MLST.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MLST.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MLST.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MLST.java Wed Jan 17 13:47:14 2007
@@ -26,6 +26,7 @@
 import org.apache.ftpserver.ftplet.FileObject;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 import org.apache.ftpserver.listing.FileFormater;
 import org.apache.ftpserver.listing.ListArgument;
@@ -61,14 +62,14 @@
             file = session.getFileSystemView().getFileObject(parsedArg.getFile());
             if(file != null && file.doesExist()) {
                 FileFormater formater = new MLSTFileFormater((String[])session.getAttribute("MLST.types"));
-                out.send(250, "MLST", formater.format(file));
+                out.send(FtpResponse.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "MLST", formater.format(file));
             } else {            
-                out.send(501, "MLST", null);
+                out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "MLST", null);
             }
         }
         catch(FtpException ex) {
             log.debug("Exception sending the file listing", ex);
-            out.send(501, "MLST", null);
+            out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "MLST", null);
         }     
     }   
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MODE.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MODE.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MODE.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/MODE.java Wed Jan 17 13:47:14 2007
@@ -24,6 +24,7 @@
 import org.apache.ftpserver.FtpSessionImpl;
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -51,7 +52,7 @@
         
         // argument check
         if(!request.hasArgument()) {
-            out.send(501, "MODE", null);
+            out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "MODE", null);
             return;  
         }
         
@@ -60,14 +61,14 @@
         md = Character.toUpperCase(md);
         if(md == 'S') {
             session.getFtpDataConnection().setZipMode(false);
-            out.send(200, "MODE", "S");
+            out.send(FtpResponse.REPLY_200_COMMAND_OKAY, "MODE", "S");
         }
         else if(md == 'Z') {
             session.getFtpDataConnection().setZipMode(true);
-            out.send(200, "MODE", "Z");
+            out.send(FtpResponse.REPLY_200_COMMAND_OKAY, "MODE", "Z");
         }
         else {
-            out.send(504, "MODE", null);
+            out.send(FtpResponse.REPLY_504_COMMAND_NOT_IMPLEMENTED_FOR_THAT_PARAMETER, "MODE", null);
         }
     }
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/NLST.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/NLST.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/NLST.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/NLST.java Wed Jan 17 13:47:14 2007
@@ -29,6 +29,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 import org.apache.ftpserver.listing.DirectoryLister;
 import org.apache.ftpserver.listing.FileFormater;
@@ -71,14 +72,14 @@
             session.resetState();
             
             // get data connection
-            out.send(150, "NLST", null);
+            out.send(FtpResponse.REPLY_150_FILE_STATUS_OKAY, "NLST", null);
             OutputStream os = null;
             try {
                 os = session.getDataOutputStream();
             }
             catch(IOException ex) {
                 log.debug("Exception getting the output data stream", ex);
-                out.send(425, "NLST", null);
+                out.send(FtpResponse.REPLY_425_CANT_OPEN_DATA_CONNECTION, "NLST", null);
                 return;
             }
             
@@ -105,16 +106,16 @@
             catch(SocketException ex) {
                 log.debug("Socket exception during data transfer", ex);
                 failure = true;
-                out.send(426, "NLST", null);
+                out.send(FtpResponse.REPLY_426_CONNECTION_CLOSED_TRANSFER_ABORTED, "NLST", null);
             }
             catch(IOException ex) {
                 log.debug("IOException during data transfer", ex);
                 failure = true;
-                out.send(551, "NLST", null);
+                out.send(FtpResponse.REPLY_551_REQUESTED_ACTION_ABORTED_PAGE_TYPE_UNKNOWN, "NLST", null);
             } catch(IllegalArgumentException e) {
                 log.debug("Illegal listing syntax: " + request.getArgument(), e);
                 // if listing syntax error - send message
-                out.send(501, "LIST", null);
+                out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "LIST", null);
             } finally {
                 writer.flush();
                 IoUtils.close(writer);
@@ -122,7 +123,7 @@
             
             // if data transfer ok - send transfer complete message
             if(!failure) {
-                out.send(226, "NLST", null);
+                out.send(FtpResponse.REPLY_226_CLOSING_DATA_CONNECTION, "NLST", null);
             }
         }
         finally {

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/NOOP.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/NOOP.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/NOOP.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/NOOP.java Wed Jan 17 13:47:14 2007
@@ -25,6 +25,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -48,6 +49,6 @@
                         FtpWriter out) throws IOException, FtpException {
         
         session.resetState();
-        out.send(200, "NOOP", null);
+        out.send(FtpResponse.REPLY_200_COMMAND_OKAY, "NOOP", null);
     }
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/OPTS.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/OPTS.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/OPTS.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/OPTS.java Wed Jan 17 13:47:14 2007
@@ -26,6 +26,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.interfaces.Command;
 import org.apache.ftpserver.listener.Connection;
 
@@ -58,7 +59,7 @@
         // no params
         String argument = request.getArgument();
         if(argument == null) {
-            out.send(501, "OPTS", null);
+            out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "OPTS", null);
             return;
         }
         
@@ -78,13 +79,13 @@
             }
             else {
                 session.resetState();
-                out.send(502, "OPTS.not.implemented", argument);
+                out.send(FtpResponse.REPLY_502_COMMAND_NOT_IMPLEMENTED, "OPTS.not.implemented", argument);
             }
         }
         catch(Exception ex) {
             log.warn("OPTS.execute()", ex);
             session.resetState();
-            out.send(500, "OPTS", null);
+            out.send(FtpResponse.REPLY_500_SYNTAX_ERROR_COMMAND_UNRECOGNIZED, "OPTS", null);
         }
     }
     

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/OPTS_MLST.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/OPTS_MLST.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/OPTS_MLST.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/OPTS_MLST.java Wed Jan 17 13:47:14 2007
@@ -26,6 +26,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -60,7 +61,7 @@
         String argument = request.getArgument();
         int spIndex = argument.indexOf(' ');
         if(spIndex == -1) {
-            out.send(503, "OPTS.MLST", null);
+            out.send(FtpResponse.REPLY_503_BAD_SEQUENCE_OF_COMMANDS, "OPTS.MLST", null);
             return;
         }
         String listTypes = argument.substring(spIndex + 1);
@@ -76,10 +77,10 @@
         String[] validatedTypes = validateSelectedTypes(types);
         if(validatedTypes != null) {
             session.setAttribute("MLST.types", validatedTypes);
-            out.send(200, "OPTS.MLST", listTypes);
+            out.send(FtpResponse.REPLY_200_COMMAND_OKAY, "OPTS.MLST", listTypes);
         }
         else {
-            out.send(501, "OPTS.MLST", listTypes);
+            out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "OPTS.MLST", listTypes);
         }
     }
     

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/OPTS_UTF8.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/OPTS_UTF8.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/OPTS_UTF8.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/OPTS_UTF8.java Wed Jan 17 13:47:14 2007
@@ -25,6 +25,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 
@@ -51,6 +52,6 @@
         session.resetState();
         
         // send default message
-        out.send(200, "OPTS.UTF8", null);
+        out.send(FtpResponse.REPLY_200_COMMAND_OKAY, "OPTS.UTF8", null);
     }
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASS.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASS.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASS.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASS.java Wed Jan 17 13:47:14 2007
@@ -30,6 +30,7 @@
 import org.apache.ftpserver.ftplet.FileSystemView;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.ftplet.Ftplet;
 import org.apache.ftpserver.ftplet.FtpletEnum;
 import org.apache.ftpserver.ftplet.User;
@@ -75,7 +76,7 @@
             // argument check
             String password = request.getArgument();
             if(password == null) {
-                out.send(501, "PASS", null);
+                out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "PASS", null);
                 return; 
             }
             
@@ -83,13 +84,13 @@
             String userName = session.getUserArgument();
 
             if(userName == null && session.getUser() == null) {
-                out.send(503, "PASS", null);
+                out.send(FtpResponse.REPLY_503_BAD_SEQUENCE_OF_COMMANDS, "PASS", null);
                 return;
             }
             
             // already logged-in
             if(session.isLoggedIn()) {
-                out.send(202, "PASS", null);
+                out.send(FtpResponse.REPLY_202_COMMAND_NOT_IMPLEMENTED, "PASS", null);
                 success = true;
                 return;
             }
@@ -99,7 +100,7 @@
             int currAnonLogin = stat.getCurrentAnonymousLoginNumber();
             int maxAnonLogin = conManager.getMaxAnonymousLogins();
             if( anonymous && (currAnonLogin >= maxAnonLogin) ) {
-                out.send(421, "PASS.anonymous", null);
+                out.send(FtpResponse.REPLY_421_SERVICE_NOT_AVAILABLE_CLOSING_CONTROL_CONNECTION, "PASS.anonymous", null);
                 return;
             }
             
@@ -107,7 +108,7 @@
             int currLogin = stat.getCurrentLoginNumber();
             int maxLogin = conManager.getMaxLogins();
             if(maxLogin != 0 && currLogin >= maxLogin) {
-                out.send(421, "PASS.login", null);
+                out.send(FtpResponse.REPLY_421_SERVICE_NOT_AVAILABLE_CLOSING_CONTROL_CONNECTION, "PASS.login", null);
                 return;
             }
             
@@ -180,7 +181,7 @@
                 session.setMaxIdleTime(oldMaxIdleTime);
                 
                 log.warn("Login failure - " + userName);
-                out.send(530, "PASS", userName);
+                out.send(FtpResponse.REPLY_530_NOT_LOGGED_IN, "PASS", userName);
                 stat.setLoginFail(connection);
                 return;
             }
@@ -192,7 +193,7 @@
             stat.setLogin(connection);
 
             // everything is fine - send login ok message
-            out.send(230, "PASS", userName);
+            out.send(FtpResponse.REPLY_230_USER_LOGGED_IN, "PASS", userName);
             if(anonymous) {
                 log.info("Anonymous login success - " + password);
             }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASV.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASV.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASV.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASV.java Wed Jan 17 13:47:14 2007
@@ -27,6 +27,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -57,7 +58,7 @@
         // set data connection
         FtpDataConnection dataCon = session.getFtpDataConnection();
         if (!dataCon.setPasvCommand()) {
-            out.send(425, "PASV", null);
+            out.send(FtpResponse.REPLY_425_CANT_OPEN_DATA_CONNECTION, "PASV", null);
             return;   
         }
         
@@ -67,6 +68,6 @@
         
         // send connection info to client
         String addrStr = servAddr.getHostAddress().replace( '.', ',' ) + ',' + (servPort>>8) + ',' + (servPort&0xFF);
-        out.send(227, "PASV", addrStr);
+        out.send(FtpResponse.REPLY_227_ENTERING_PASSIVE_MODE, "PASV", addrStr);
     }
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PBSZ.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PBSZ.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PBSZ.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PBSZ.java Wed Jan 17 13:47:14 2007
@@ -25,6 +25,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -44,6 +45,6 @@
                         FtpWriter out) throws IOException, FtpException {
         
         session.resetState();
-        out.send(200, "PBSZ", null);
+        out.send(FtpResponse.REPLY_200_COMMAND_OKAY, "PBSZ", null);
     }
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PORT.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PORT.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PORT.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PORT.java Wed Jan 17 13:47:14 2007
@@ -27,6 +27,7 @@
 import org.apache.ftpserver.FtpSessionImpl;
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.interfaces.DataConnectionConfig;
 import org.apache.ftpserver.listener.Connection;
 
@@ -66,7 +67,7 @@
         
         // argument check
         if(!request.hasArgument()) {
-            out.send(501, "PORT", null);
+            out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "PORT", null);
             return;  
         }
         
@@ -92,7 +93,7 @@
         }
         catch(UnknownHostException ex) {
             log.debug("Unknown host: " + dataSrvName, ex);
-            out.send(553, "PORT.host", null);
+            out.send(FtpResponse.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED, "PORT.host", null);
             return;
         }
         
@@ -114,12 +115,12 @@
         }
         catch(NumberFormatException ex) {
             log.debug("Invalid data port: " + request.getArgument(), ex);
-            out.send(552, "PORT.invalid", null); 
+            out.send(FtpResponse.REPLY_552_REQUESTED_FILE_ACTION_ABORTED_EXCEEDED_STORAGE, "PORT.invalid", null); 
             return; 
         }
         
         session.getFtpDataConnection().setPortCommand(dataAddr, dataPort);
-        out.send(200, "PORT", null);
+        out.send(FtpResponse.REPLY_200_COMMAND_OKAY, "PORT", null);
     }
     
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PROT.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PROT.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PROT.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PROT.java Wed Jan 17 13:47:14 2007
@@ -26,6 +26,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.interfaces.FtpServerContext;
 import org.apache.ftpserver.listener.Connection;
 
@@ -51,7 +52,7 @@
         // check argument
         String arg = request.getArgument();
         if(arg == null) {
-            out.send(501, "PROT", null);
+            out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "PROT", null);
             return;
         }
         
@@ -60,7 +61,7 @@
         FtpDataConnection dcon = session.getFtpDataConnection();
         if(arg.equals("C")) {
             dcon.setSecure(false);
-            out.send(200, "PROT", null);
+            out.send(FtpResponse.REPLY_200_COMMAND_OKAY, "PROT", null);
         }
         else if(arg.equals("P")) {
             FtpServerContext serverContext = connection.getServerContext();
@@ -69,11 +70,11 @@
             }
             else {
                 dcon.setSecure(true);
-                out.send(200, "PROT", null);
+                out.send(FtpResponse.REPLY_200_COMMAND_OKAY, "PROT", null);
             }
         }
         else {
-            out.send(504, "PROT", null);
+            out.send(FtpResponse.REPLY_504_COMMAND_NOT_IMPLEMENTED_FOR_THAT_PARAMETER, "PROT", null);
         }
     }
     

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PWD.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PWD.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PWD.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PWD.java Wed Jan 17 13:47:14 2007
@@ -26,6 +26,7 @@
 import org.apache.ftpserver.ftplet.FileSystemView;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -49,7 +50,7 @@
         session.resetState();
         FileSystemView fsview = session.getFileSystemView();
         String currDir = fsview.getCurrentDirectory().getFullName();
-        out.send(257, "PWD", currDir);
+        out.send(FtpResponse.REPLY_257_PATHNAME_CREATED, "PWD", currDir);
     }
     
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/QUIT.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/QUIT.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/QUIT.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/QUIT.java Wed Jan 17 13:47:14 2007
@@ -24,6 +24,7 @@
 import org.apache.ftpserver.FtpSessionImpl;
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -45,7 +46,7 @@
                         FtpSessionImpl session, 
                         FtpWriter out) throws IOException {
         session.resetState();
-        out.send(221, "QUIT", null);
+        out.send(FtpResponse.REPLY_221_CLOSING_CONTROL_CONNECTION, "QUIT", null);
         connection.getServerContext().getConnectionManager().closeConnection(connection);
     }
 

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/REIN.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/REIN.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/REIN.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/REIN.java Wed Jan 17 13:47:14 2007
@@ -24,6 +24,7 @@
 import org.apache.ftpserver.FtpSessionImpl;
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -47,6 +48,6 @@
         
         session.reinitialize();
         session.setLanguage(null);
-        out.send(220, "REIN", null);
+        out.send(FtpResponse.REPLY_220_SERVICE_READY, "REIN", null);
     }   
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/REST.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/REST.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/REST.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/REST.java Wed Jan 17 13:47:14 2007
@@ -24,6 +24,7 @@
 import org.apache.ftpserver.FtpSessionImpl;
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -52,7 +53,7 @@
         // argument check
         String argument = request.getArgument();
         if(argument == null) {
-            out.send(501, "REST", null);
+            out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "REST", null);
             return;  
         }
         
@@ -65,15 +66,15 @@
             // check offset number
             if(skipLen < 0L) {
                 skipLen = 0L;
-                out.send(501, "REST.negetive", null);
+                out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "REST.negetive", null);
             }
             else {
-                out.send(350, "REST", null);
+                out.send(FtpResponse.REPLY_350_REQUESTED_FILE_ACTION_PENDING_FURTHER_INFORMATION, "REST", null);
             }
         }
         catch(NumberFormatException ex) {
             log.debug("Invalid restart position: " + argument, ex);
-            out.send(501, "REST.invalid", null); 
+            out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "REST.invalid", null); 
         }
         
         session.setFileOffset(skipLen);

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RETR.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RETR.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RETR.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RETR.java Wed Jan 17 13:47:14 2007
@@ -33,6 +33,7 @@
 import org.apache.ftpserver.ftplet.FileObject;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.ftplet.Ftplet;
 import org.apache.ftpserver.ftplet.FtpletEnum;
 import org.apache.ftpserver.interfaces.FtpServerContext;
@@ -72,7 +73,7 @@
             // argument check
             String fileName = request.getArgument();
             if(fileName == null) {
-                out.send(501, "RETR", null);
+                out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "RETR", null);
                 return;  
             }
     
@@ -102,38 +103,38 @@
                 log.debug("Exception getting file object", ex);
             }
             if(file == null) {
-                out.send(550, "RETR.missing", fileName);
+                out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "RETR.missing", fileName);
                 return;
             }
             fileName = file.getFullName();
             
             // check file existance
             if(!file.doesExist()) {
-                out.send(550, "RETR.missing", fileName);
+                out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "RETR.missing", fileName);
                 return;
             }
             
             // check valid file
             if(!file.isFile()) {
-                out.send(550, "RETR.invalid", fileName);
+                out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "RETR.invalid", fileName);
                 return;
             }
             
             // check permission
             if(!file.hasReadPermission()) {
-                out.send(550, "RETR.permission", fileName);
+                out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "RETR.permission", fileName);
                 return;
             }
             
             // get data connection
-            out.send(150, "RETR", null);
+            out.send(FtpResponse.REPLY_150_FILE_STATUS_OKAY, "RETR", null);
             OutputStream os = null;
             try {
                 os = session.getDataOutputStream();
             }
             catch(IOException ex) {
                 log.debug("Exception getting the output data stream", ex);
-                out.send(425, "RETR", null);
+                out.send(FtpResponse.REPLY_425_CANT_OPEN_DATA_CONNECTION, "RETR", null);
                 return;
             }
             
@@ -170,12 +171,12 @@
             catch(SocketException ex) {
                 log.debug("Socket exception during data transfer", ex);
                 failure = true;
-                out.send(426, "RETR", fileName);
+                out.send(FtpResponse.REPLY_426_CONNECTION_CLOSED_TRANSFER_ABORTED, "RETR", fileName);
             }
             catch(IOException ex) {
                 log.debug("IOException during data transfer", ex);
                 failure = true;
-                out.send(551, "RETR", fileName);
+                out.send(FtpResponse.REPLY_551_REQUESTED_ACTION_ABORTED_PAGE_TYPE_UNKNOWN, "RETR", fileName);
             }
             finally {
                 IoUtils.close(bis);
@@ -184,7 +185,7 @@
             
             // if data transfer ok - send transfer complete message
             if(!failure) {
-                out.send(226, "RETR", fileName);
+                out.send(FtpResponse.REPLY_226_CLOSING_DATA_CONNECTION, "RETR", fileName);
                 
                 // call Ftplet.onDownloadEnd() method
                 try {

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RMD.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RMD.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RMD.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RMD.java Wed Jan 17 13:47:14 2007
@@ -27,6 +27,7 @@
 import org.apache.ftpserver.ftplet.FileObject;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.ftplet.Ftplet;
 import org.apache.ftpserver.ftplet.FtpletEnum;
 import org.apache.ftpserver.interfaces.FtpServerContext;
@@ -62,7 +63,7 @@
         // argument check
         String fileName = request.getArgument();
         if(fileName == null) {
-            out.send(501, "RMD", null);
+            out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "RMD", null);
             return;  
         }
         
@@ -92,26 +93,26 @@
             log.debug("Exception getting file object", ex);
         }
         if(file == null) {
-            out.send(550, "RMD.permission", fileName);
+            out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "RMD.permission", fileName);
             return;
         }
         
         // check permission
         fileName = file.getFullName();
         if( !file.hasDeletePermission() ) {
-            out.send(550, "RMD.permission", fileName);
+            out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "RMD.permission", fileName);
             return;
         }
         
         // check file
         if(!file.isDirectory()) {
-            out.send(550, "RMD.invalid", fileName);
+            out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "RMD.invalid", fileName);
             return;
         }
         
         // now delete directory
         if(file.delete()) {
-            out.send(250, "RMD", fileName); 
+            out.send(FtpResponse.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "RMD", fileName); 
             
             // write log message
             String userName = session.getUser().getName();
@@ -136,7 +137,7 @@
 
         }
         else {
-            out.send(450, "RMD", fileName);
+            out.send(FtpResponse.REPLY_450_REQUESTED_FILE_ACTION_NOT_TAKEN, "RMD", fileName);
         }
     }
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RNFR.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RNFR.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RNFR.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RNFR.java Wed Jan 17 13:47:14 2007
@@ -26,6 +26,7 @@
 import org.apache.ftpserver.ftplet.FileObject;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -54,7 +55,7 @@
         // argument check
         String fileName = request.getArgument();
         if(fileName == null) {
-            out.send(501, "RNFR", null);
+            out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "RNFR", null);
             return;  
         }
                 
@@ -69,12 +70,12 @@
             
         // check file
         if(renFr == null) {
-            out.send(550, "RNFR", fileName);
+            out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "RNFR", fileName);
         }
         else {
             session.setRenameFrom(renFr);
             fileName = renFr.getFullName();
-            out.send(350, "RNFR", fileName);    
+            out.send(FtpResponse.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "RNFR", fileName);    
         }
     }
     

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RNTO.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RNTO.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RNTO.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/RNTO.java Wed Jan 17 13:47:14 2007
@@ -27,6 +27,7 @@
 import org.apache.ftpserver.ftplet.FileObject;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.ftplet.Ftplet;
 import org.apache.ftpserver.ftplet.FtpletEnum;
 import org.apache.ftpserver.interfaces.FtpServerContext;
@@ -58,7 +59,7 @@
             // argument check
             String toFileStr = request.getArgument();
             if(toFileStr == null) {
-                out.send(501, "RNTO", null);
+                out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "RNTO", null);
                 return;  
             }
             
@@ -83,7 +84,7 @@
             // get the "rename from" file object
             FileObject frFile = session.getRenameFrom();
             if( frFile == null ) {
-                out.send(503, "RNTO", null);
+                out.send(FtpResponse.REPLY_503_BAD_SEQUENCE_OF_COMMANDS, "RNTO", null);
                 return;
             }
             
@@ -96,26 +97,26 @@
                 log.debug("Exception getting file object", ex);
             }
             if(toFile == null) {
-                out.send(553, "RNTO.invalid", null);
+                out.send(FtpResponse.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED, "RNTO.invalid", null);
                 return;
             }
             toFileStr = toFile.getFullName();
             
             // check permission
             if( !toFile.hasWritePermission() ) {
-                out.send(553, "RNTO.permission", null);
+                out.send(FtpResponse.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED, "RNTO.permission", null);
                 return;
             }
             
             // check file existance
             if( !frFile.doesExist() ) {
-                out.send(553, "RNTO.missing", null);
+                out.send(FtpResponse.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED, "RNTO.missing", null);
                 return;
             }
             
             // now rename
             if( frFile.move(toFile) ) { 
-                out.send(250, "RNTO", toFileStr);
+                out.send(FtpResponse.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "RNTO", toFileStr);
 
                 Log log = serverContext.getLogFactory().getInstance(getClass());
                 log.info("File rename (" + session.getUser().getName() + ") " 
@@ -134,7 +135,7 @@
                 }
             }
             else {
-                out.send(553, "RNTO", toFileStr);
+                out.send(FtpResponse.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED, "RNTO", toFileStr);
             }
         
         }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE.java Wed Jan 17 13:47:14 2007
@@ -27,6 +27,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.ftplet.Ftplet;
 import org.apache.ftpserver.ftplet.FtpletEnum;
 import org.apache.ftpserver.interfaces.Command;
@@ -84,7 +85,7 @@
         // no params
         if(argument == null) {
             session.resetState();
-            out.send(200, "SITE", null);
+            out.send(FtpResponse.REPLY_200_COMMAND_OKAY, "SITE", null);
             return;
         }
         
@@ -97,14 +98,14 @@
             }
             else {
                 session.resetState();
-                out.send(502, "SITE", argument);
+                out.send(FtpResponse.REPLY_502_COMMAND_NOT_IMPLEMENTED, "SITE", argument);
             }
         }
         catch(Exception ex) {
             Log log = serverContext.getLogFactory().getInstance(getClass());
             log.warn("SITE.execute()", ex);
             session.resetState();
-            out.send(500, "SITE", null);
+            out.send(FtpResponse.REPLY_500_SYNTAX_ERROR_COMMAND_UNRECOGNIZED, "SITE", null);
         }
     
     }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_DESCUSER.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_DESCUSER.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_DESCUSER.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_DESCUSER.java Wed Jan 17 13:47:14 2007
@@ -26,6 +26,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.ftplet.User;
 import org.apache.ftpserver.ftplet.UserManager;
 import org.apache.ftpserver.interfaces.FtpServerContext;
@@ -56,7 +57,7 @@
         UserManager userManager = connection.getServerContext().getUserManager(); 
         boolean isAdmin = userManager.isAdmin(session.getUser().getName());
         if(!isAdmin) {
-            out.send(530, "SITE", null);
+            out.send(FtpResponse.REPLY_530_NOT_LOGGED_IN, "SITE", null);
             return;
         }
         
@@ -64,7 +65,7 @@
         String argument = request.getArgument();
         int spIndex = argument.indexOf(' ');
         if(spIndex == -1) {
-            out.send(503, "SITE.DESCUSER", null);
+            out.send(FtpResponse.REPLY_503_BAD_SEQUENCE_OF_COMMANDS, "SITE.DESCUSER", null);
             return;
         }
         String userName = argument.substring(spIndex + 1);
@@ -83,7 +84,7 @@
             user = null;
         }
         if(user == null) {
-            out.send(501, "SITE.DESCUSER", userName);
+            out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "SITE.DESCUSER", userName);
             return;
         }
         
@@ -108,7 +109,7 @@
             sb.append("downloadrate    : 0\n");
         }
         sb.append('\n');
-        out.write(new FtpResponseImpl(200, sb.toString()));
+        out.write(new FtpResponseImpl(FtpResponse.REPLY_200_COMMAND_OKAY, sb.toString()));
     }
 
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_HELP.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_HELP.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_HELP.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_HELP.java Wed Jan 17 13:47:14 2007
@@ -25,6 +25,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 
@@ -48,7 +49,7 @@
         session.resetState();
         
         // print help message
-        out.send(200, "SITE.HELP", null);
+        out.send(FtpResponse.REPLY_200_COMMAND_OKAY, "SITE.HELP", null);
     }
 
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_STAT.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_STAT.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_STAT.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_STAT.java Wed Jan 17 13:47:14 2007
@@ -26,6 +26,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.ftplet.FtpStatistics;
 import org.apache.ftpserver.ftplet.UserManager;
 import org.apache.ftpserver.listener.Connection;
@@ -54,7 +55,7 @@
         UserManager userManager = connection.getServerContext().getUserManager(); 
         boolean isAdmin = userManager.isAdmin(session.getUser().getName());
         if(!isAdmin) {
-            out.send(530, "SITE", null);
+            out.send(FtpResponse.REPLY_530_NOT_LOGGED_IN, "SITE", null);
             return;
         }
         
@@ -77,7 +78,7 @@
         sb.append("Current Connections      : ").append( stat.getCurrentConnectionNumber() ).append('\n');
         sb.append("Total Connections        : ").append( stat.getTotalConnectionNumber() ).append('\n');
         sb.append('\n');
-        out.write(new FtpResponseImpl(200, sb.toString()));
+        out.write(new FtpResponseImpl(FtpResponse.REPLY_200_COMMAND_OKAY, sb.toString()));
     }
     
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_WHO.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_WHO.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_WHO.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_WHO.java Wed Jan 17 13:47:14 2007
@@ -28,6 +28,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.ftplet.FtpSession;
 import org.apache.ftpserver.ftplet.User;
 import org.apache.ftpserver.ftplet.UserManager;
@@ -59,7 +60,7 @@
         UserManager userManager = connection.getServerContext().getUserManager(); 
         boolean isAdmin = userManager.isAdmin(session.getUser().getName());
         if(!isAdmin) {
-            out.send(530, "SITE", null);
+            out.send(FtpResponse.REPLY_530_NOT_LOGGED_IN, "SITE", null);
             return;
         }
         
@@ -83,7 +84,7 @@
             sb.append('\n');
         }
         sb.append('\n');
-        out.write(new FtpResponseImpl(200, sb.toString()));
+        out.write(new FtpResponseImpl(FtpResponse.REPLY_200_COMMAND_OKAY, sb.toString()));
     }
 
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_ZONE.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_ZONE.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_ZONE.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SITE_ZONE.java Wed Jan 17 13:47:14 2007
@@ -28,6 +28,7 @@
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -53,6 +54,6 @@
         
         // send timezone data
         String timezone = TIMEZONE_FMT.format(new Date());
-        out.write(new FtpResponseImpl(200, timezone));
+        out.write(new FtpResponseImpl(FtpResponse.REPLY_200_COMMAND_OKAY, timezone));
     }
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SIZE.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SIZE.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SIZE.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/SIZE.java Wed Jan 17 13:47:14 2007
@@ -26,6 +26,7 @@
 import org.apache.ftpserver.ftplet.FileObject;
 import org.apache.ftpserver.ftplet.FtpException;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -52,7 +53,7 @@
         // argument check
         String fileName = request.getArgument();
         if(fileName == null) {
-            out.send(501, "SIZE", null);
+            out.send(FtpResponse.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "SIZE", null);
             return;  
         }
         
@@ -65,21 +66,21 @@
             log.debug("Exception getting file object", ex);
         }
         if(file == null) {
-            out.send(550, "SIZE.missing", fileName);
+            out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "SIZE.missing", fileName);
             return;
         }
         
         // print file size
         fileName = file.getFullName();
         if(!file.doesExist()) {
-            out.send(550, "SIZE.missing", fileName);
+            out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "SIZE.missing", fileName);
         }
         else if(!file.isFile()) {
-            out.send(550, "SIZE.invalid", fileName);
+            out.send(FtpResponse.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "SIZE.invalid", fileName);
         }
         else {
             String fileLen = String.valueOf(file.getSize());             
-            out.send(213, "SIZE", fileLen);
+            out.send(FtpResponse.REPLY_213_FILE_STATUS, "SIZE", fileLen);
         }
     } 
 

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/STAT.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/STAT.java?view=diff&rev=497189&r1=497188&r2=497189
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/STAT.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/STAT.java Wed Jan 17 13:47:14 2007
@@ -24,6 +24,7 @@
 import org.apache.ftpserver.FtpSessionImpl;
 import org.apache.ftpserver.FtpWriter;
 import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.FtpResponse;
 import org.apache.ftpserver.listener.Connection;
 
 /**
@@ -49,7 +50,7 @@
         session.resetState();
         
         // write the status info
-        out.send(211, "STAT", null); 
+        out.send(FtpResponse.REPLY_211_SYSTEM_STATUS_REPLY, "STAT", null); 
     }
     
 }



Mime
View raw message