Attached is the patch for the Jira issue FTPSERVER-222 which calls
back the Ftplet.afterCommand method with the actual reply that was
sent to the client.
I've tested it reasonably and works as expected. However, there is an
issue when the Ftplet.beforeCommand sends a response other than the
DEFAULT, then afterCommand is not called any more. I know this was
recently changed to behave this way, but I think the afterCommand MUST
be called no matter what. Let me know what you think.
Sai Pullabhotla
Phone: (402) 408-5753
Fax: (402) 408-6861
www.jMethods.com
Index:
core/src/main/java/org/apache/ftpserver/ftpletcontainer/impl/DefaultFtpletContainer.java
===================================================================
---
core/src/main/java/org/apache/ftpserver/ftpletcontainer/impl/DefaultFtpletContainer.java
(revision 717862)
+++
core/src/main/java/org/apache/ftpserver/ftpletcontainer/impl/DefaultFtpletContainer.java
(working copy)
@@ -25,6 +25,7 @@
import java.util.concurrent.ConcurrentHashMap;
import org.apache.ftpserver.ftplet.FtpException;
+import org.apache.ftpserver.ftplet.FtpReply;
import org.apache.ftpserver.ftplet.FtpRequest;
import org.apache.ftpserver.ftplet.FtpSession;
import org.apache.ftpserver.ftplet.Ftplet;
@@ -137,12 +138,12 @@
return retVal;
}
- public FtpletResult afterCommand(FtpSession session, FtpRequest request)
+ public FtpletResult afterCommand(FtpSession session, FtpRequest request,
FtpReply reply)
throws FtpException, IOException {
FtpletResult retVal = FtpletResult.DEFAULT;
for (Entry<String, Ftplet> entry : ftplets.entrySet()) {
- retVal = entry.getValue().afterCommand(session, request);
+ retVal = entry.getValue().afterCommand(session, request, reply);
if (retVal == null) {
retVal = FtpletResult.DEFAULT;
}
Index: core/src/main/java/org/apache/ftpserver/impl/DefaultFtpHandler.java
===================================================================
--- core/src/main/java/org/apache/ftpserver/impl/DefaultFtpHandler.java
(revision 717862)
+++ core/src/main/java/org/apache/ftpserver/impl/DefaultFtpHandler.java
(working copy)
@@ -143,7 +143,7 @@
try {
ftpletRet =
ftplets.afterCommand(session.getFtpletSession(),
- request);
+ request, session.getLastReply());
} catch (Exception e) {
LOG.debug("Ftplet container threw exception", e);
ftpletRet = FtpletResult.DISCONNECT;
Index: core/src/main/java/org/apache/ftpserver/impl/FtpIoSession.java
===================================================================
--- core/src/main/java/org/apache/ftpserver/impl/FtpIoSession.java
(revision 717862)
+++ core/src/main/java/org/apache/ftpserver/impl/FtpIoSession.java
(working copy)
@@ -31,6 +31,7 @@
import org.apache.ftpserver.ftplet.DataType;
import org.apache.ftpserver.ftplet.FileSystemView;
import org.apache.ftpserver.ftplet.FtpFile;
+import org.apache.ftpserver.ftplet.FtpReply;
import org.apache.ftpserver.ftplet.FtpSession;
import org.apache.ftpserver.ftplet.Structure;
import org.apache.ftpserver.ftplet.User;
@@ -107,10 +108,15 @@
private static final String ATTRIBUTE_CACHED_REMOTE_ADDRESS =
ATTRIBUTE_PREFIX
+ "cached-remote-address";
-
+
private IoSession wrappedSession;
private FtpServerContext context;
+
+ /**
+ * Last reply that was sent to the client, if any.
+ */
+ private FtpReply lastReply = null;
/* Begin wrapped IoSession methods */
@@ -536,14 +542,18 @@
* @see IoSession#write(Object)
*/
public WriteFuture write(Object message) {
- return wrappedSession.write(message);
+ WriteFuture future = wrappedSession.write(message);
+ this.lastReply = (FtpReply) message;
+ return future;
}
/**
* @see IoSession#write(Object, SocketAddress)
*/
public WriteFuture write(Object message, SocketAddress destination) {
- return wrappedSession.write(message, destination);
+ WriteFuture future = wrappedSession.write(message, destination);
+ this.lastReply = (FtpReply) message;
+ return future;
}
/* End wrapped IoSession methods */
@@ -677,7 +687,7 @@
setAttribute(ATTRIBUTE_DATA_TYPE, dataType);
}
-
+
public FtpIoSession(IoSession wrappedSession, FtpServerContext context) {
this.wrappedSession = wrappedSession;
this.context = context;
@@ -791,4 +801,12 @@
((AbstractIoSession)wrappedSession).increaseReadBytes(increment,
System.currentTimeMillis());
}
}
+
+ /**
+ * Returns the last reply that was sent to the client.
+ * @return the last reply that was sent to the client.
+ */
+ public FtpReply getLastReply() {
+ return lastReply;
+ }
}
Index: ftplet-api/src/main/java/org/apache/ftpserver/ftplet/DefaultFtplet.java
===================================================================
--- ftplet-api/src/main/java/org/apache/ftpserver/ftplet/DefaultFtplet.java
(revision 717862)
+++ ftplet-api/src/main/java/org/apache/ftpserver/ftplet/DefaultFtplet.java
(working copy)
@@ -25,316 +25,411 @@
* Default ftplet implementation. All the callback method returns null. It is
* just an empty implementation. You can derive your ftplet implementation from
* this class.
- *
+ *
* @author The Apache MINA Project ([EMAIL PROTECTED])
* @version $Rev$, $Date$
*/
+
+// TODO remove unncessary throws clause from onXXXStart and onXXXEnd methods.
+// TODO consider splitting the onLogin method into two - onLoginStart and
+// onLoginEnd, fire these two methods on the PASS command.
public class DefaultFtplet implements Ftplet {
- public void init(FtpletContext ftpletContext) throws FtpException {
- }
+ public void init(FtpletContext ftpletContext) throws FtpException {
+ }
- public void destroy() {
- }
+ public void destroy() {
+ }
- public FtpletResult onConnect(FtpSession session) throws FtpException,
- IOException {
- return null;
- }
+ public FtpletResult onConnect(FtpSession session) throws FtpException,
+ IOException {
+ return null;
+ }
- public FtpletResult onDisconnect(FtpSession session) throws FtpException,
- IOException {
- return null;
- }
+ public FtpletResult onDisconnect(FtpSession session) throws
FtpException,
+ IOException {
+ return null;
+ }
- public FtpletResult beforeCommand(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
- String command = request.getCommand().toUpperCase();
+ public FtpletResult beforeCommand(FtpSession session, FtpRequest
request)
+ throws FtpException, IOException {
+ String command = request.getCommand().toUpperCase();
- if ("DELE".equals(command)) {
- return onDeleteStart(session, request);
- } else if ("STOR".equals(command)) {
- return onUploadStart(session, request);
- } else if ("RETR".equals(command)) {
- return onDownloadStart(session, request);
- } else if ("RMD".equals(command)) {
- return onRmdirStart(session, request);
- } else if ("MKD".equals(command)) {
- return onMkdirStart(session, request);
- } else if ("APPE".equals(command)) {
- return onAppendStart(session, request);
- } else if ("STOU".equals(command)) {
- return onUploadUniqueStart(session, request);
- } else if ("RNTO".equals(command)) {
- return onRenameStart(session, request);
- } else if ("SITE".equals(command)) {
- return onSite(session, request);
- } else {
- // TODO should we call a catch all?
- return null;
- }
- }
+ if ("DELE".equals(command)) {
+ return onDeleteStart(session, request);
+ }
+ else if ("STOR".equals(command)) {
+ return onUploadStart(session, request);
+ }
+ else if ("RETR".equals(command)) {
+ return onDownloadStart(session, request);
+ }
+ else if ("RMD".equals(command)) {
+ return onRmdirStart(session, request);
+ }
+ else if ("MKD".equals(command)) {
+ return onMkdirStart(session, request);
+ }
+ else if ("APPE".equals(command)) {
+ return onAppendStart(session, request);
+ }
+ else if ("STOU".equals(command)) {
+ return onUploadUniqueStart(session, request);
+ }
+ else if ("RNTO".equals(command)) {
+ return onRenameStart(session, request);
+ }
+ else if ("SITE".equals(command)) {
+ return onSite(session, request);
+ }
+ else {
+ // TODO should we call a catch all?
+ return null;
+ }
+ }
- public FtpletResult afterCommand(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
+ public FtpletResult afterCommand(FtpSession session, FtpRequest request,
+ FtpReply reply) throws FtpException, IOException {
- String command = request.getCommand().toUpperCase();
+ String command = request.getCommand().toUpperCase();
+ // TODO is this supposed to be bere or in the beforeCommand?
+ if ("PASS".equals(command)) {
+ return onLogin(session, request, reply);
+ }
+ else if ("DELE".equals(command)) {
+ return onDeleteEnd(session, request, reply);
+ }
+ else if ("STOR".equals(command)) {
+ return onUploadEnd(session, request, reply);
+ }
+ else if ("RETR".equals(command)) {
+ return onDownloadEnd(session, request, reply);
+ }
+ else if ("RMD".equals(command)) {
+ return onRmdirEnd(session, request, reply);
+ }
+ else if ("MKD".equals(command)) {
+ return onMkdirEnd(session, request, reply);
+ }
+ else if ("APPE".equals(command)) {
+ return onAppendEnd(session, request, reply);
+ }
+ else if ("STOU".equals(command)) {
+ return onUploadUniqueEnd(session, request, reply);
+ }
+ else if ("RNTO".equals(command)) {
+ return onRenameEnd(session, request, reply);
+ }
+ else {
+ // TODO should we call a catch all?
+ return null;
+ }
+ }
- if ("PASS".equals(command)) {
- return onLogin(session, request);
- } else if ("DELE".equals(command)) {
- return onDeleteEnd(session, request);
- } else if ("STOR".equals(command)) {
- return onUploadEnd(session, request);
- } else if ("RETR".equals(command)) {
- return onDownloadEnd(session, request);
- } else if ("RMD".equals(command)) {
- return onRmdirEnd(session, request);
- } else if ("MKD".equals(command)) {
- return onMkdirEnd(session, request);
- } else if ("APPE".equals(command)) {
- return onAppendEnd(session, request);
- } else if ("STOU".equals(command)) {
- return onUploadUniqueEnd(session, request);
- } else if ("RNTO".equals(command)) {
- return onRenameEnd(session, request);
- } else {
- // TODO should we call a catch all?
- return null;
- }
- }
+ /**
+ * Override this method to intercept user logins
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @param reply
+ * the reply that was sent for the login (PASS) command.
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onLogin(FtpSession session, FtpRequest request,
+ FtpReply reply) throws FtpException, IOException {
+ return null;
+ }
- /**
- * Override this method to intercept user logins
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onLogin(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
- return null;
- }
+ /**
+ * Override this method to intercept deletions
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onDeleteStart(FtpSession session, FtpRequest
request)
+ throws FtpException, IOException {
+ return null;
+ }
- /**
- * Override this method to intercept deletions
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onDeleteStart(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
- return null;
- }
+ /**
+ * Override this method to handle deletions after completion
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @param reply
+ * the reply that was sent for the delete (DELE) command.
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onDeleteEnd(FtpSession session, FtpRequest request,
+ FtpReply reply) throws FtpException, IOException {
+ return null;
+ }
- /**
- * Override this method to handle deletions after completion
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onDeleteEnd(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
- return null;
- }
+ /**
+ * Override this method to intercept uploads
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onUploadStart(FtpSession session, FtpRequest
request)
+ throws FtpException, IOException {
+ return null;
+ }
- /**
- * Override this method to intercept uploads
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onUploadStart(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
- return null;
- }
+ /**
+ * Override this method to handle uploads after completion
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @param reply
+ * the reply that was sent for the upload (STOR) command.
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onUploadEnd(FtpSession session, FtpRequest request,
+ FtpReply reply) throws FtpException, IOException {
+ return null;
+ }
- /**
- * Override this method to handle uploads after completion
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onUploadEnd(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
- return null;
- }
+ /**
+ * Override this method to intercept downloads
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onDownloadStart(FtpSession session, FtpRequest
request)
+ throws FtpException, IOException {
+ return null;
+ }
- /**
- * Override this method to intercept downloads
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onDownloadStart(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
- return null;
- }
+ /**
+ * Override this method to handle downloads after completion
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @param reply
+ * the reply that was sent for the download (RETR) command.
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onDownloadEnd(FtpSession session, FtpRequest
request,
+ FtpReply reply) throws FtpException, IOException {
+ return null;
+ }
- /**
- * Override this method to handle downloads after completion
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onDownloadEnd(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
- return null;
- }
+ /**
+ * Override this method to intercept deletion of directories
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onRmdirStart(FtpSession session, FtpRequest request)
+ throws FtpException, IOException {
+ return null;
+ }
- /**
- * Override this method to intercept deletion of directories
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onRmdirStart(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
- return null;
- }
+ /**
+ * Override this method to handle deletion of directories after
completion
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @param reply
+ * the reply that was sent for the remove directory (RMD)
+ * command.
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onRmdirEnd(FtpSession session, FtpRequest request,
+ FtpReply reply) throws FtpException, IOException {
+ return null;
+ }
- /**
- * Override this method to handle deletion of directories after completion
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onRmdirEnd(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
- return null;
- }
+ /**
+ * Override this method to intercept creation of directories
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onMkdirStart(FtpSession session, FtpRequest request)
+ throws FtpException, IOException {
+ return null;
+ }
- /**
- * Override this method to intercept creation of directories
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onMkdirStart(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
- return null;
- }
+ /**
+ * Override this method to handle creation of directories after
completion
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @param reply
+ * the reply that was sent for the make directory (MKD)
command.
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onMkdirEnd(FtpSession session, FtpRequest request,
+ FtpReply reply) throws FtpException, IOException {
+ return null;
+ }
- /**
- * Override this method to handle creation of directories after completion
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onMkdirEnd(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
- return null;
- }
+ /**
+ * Override this method to intercept file appends
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onAppendStart(FtpSession session, FtpRequest
request)
+ throws FtpException, IOException {
+ return null;
+ }
- /**
- * Override this method to intercept file appends
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onAppendStart(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
- return null;
- }
+ /**
+ * Override this method to intercept file appends after completion
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @param reply
+ * the reply that was sent for the append (APPE) command.
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onAppendEnd(FtpSession session, FtpRequest request,
+ FtpReply reply) throws FtpException, IOException {
+ return null;
+ }
- /**
- * Override this method to intercept file appends after completion
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onAppendEnd(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
- return null;
- }
+ /**
+ * Override this method to intercept unique uploads
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onUploadUniqueStart(FtpSession session,
+ FtpRequest request) throws FtpException, IOException {
+ return null;
+ }
- /**
- * Override this method to intercept unique uploads
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onUploadUniqueStart(FtpSession session,
- FtpRequest request) throws FtpException, IOException {
- return null;
- }
+ /**
+ * Override this method to handle unique uploads after completion
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @param reply
+ * the reply that was sent for the upload unique (STOU)
command.
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onUploadUniqueEnd(FtpSession session,
+ FtpRequest request, FtpReply reply) throws FtpException,
IOException {
+ return null;
+ }
- /**
- * Override this method to handle unique uploads after completion
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onUploadUniqueEnd(FtpSession session, FtpRequest
request)
- throws FtpException, IOException {
- return null;
- }
+ /**
+ * Override this method to intercept renames
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onRenameStart(FtpSession session, FtpRequest
request)
+ throws FtpException, IOException {
+ return null;
+ }
- /**
- * Override this method to intercept renames
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onRenameStart(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
- return null;
- }
+ /**
+ * Override this method to handle renames after completion
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @param reply
+ * the reply that was sent for the rename (RNTO) command.
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onRenameEnd(FtpSession session, FtpRequest request,
+ FtpReply reply) throws FtpException, IOException {
+ return null;
+ }
- /**
- * Override this method to handle renames after completion
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onRenameEnd(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
- return null;
- }
-
- /**
- * Override this method to intercept SITE commands
- * @param session The current [EMAIL PROTECTED] FtpSession}
- * @param request The current [EMAIL PROTECTED] FtpRequest}
- * @return The action for the container to take
- * @throws FtpException
- * @throws IOException
- */
- public FtpletResult onSite(FtpSession session, FtpRequest request)
- throws FtpException, IOException {
- return null;
- }
+ /**
+ * Override this method to intercept SITE commands
+ *
+ * @param session
+ * The current [EMAIL PROTECTED] FtpSession}
+ * @param request
+ * The current [EMAIL PROTECTED] FtpRequest}
+ * @return The action for the container to take
+ * @throws FtpException
+ * @throws IOException
+ */
+ public FtpletResult onSite(FtpSession session, FtpRequest request)
+ throws FtpException, IOException {
+ return null;
+ }
}
\ No newline at end of file
Index: ftplet-api/src/main/java/org/apache/ftpserver/ftplet/Ftplet.java
===================================================================
--- ftplet-api/src/main/java/org/apache/ftpserver/ftplet/Ftplet.java
(revision 717862)
+++ ftplet-api/src/main/java/org/apache/ftpserver/ftplet/Ftplet.java
(working copy)
@@ -98,28 +98,32 @@
throws FtpException, IOException;
/**
- * Called by the ftplet container after a command has been executed by the
- * server. The implementation should return based on the desired action to
- * be taken by the server:
- * <ul>
- * <li>[EMAIL PROTECTED] FtpletResult#DEFAULT}: The server continues as
normal</li>
- * <li>[EMAIL PROTECTED] FtpletResult#NO_FTPLET}: The server does not call
any more
- * Ftplets before this command but continues as normal</li>
- * <li>[EMAIL PROTECTED] FtpletResult#SKIP}: Same as [EMAIL PROTECTED]
FtpletResult#DEFAULT}</li>
- * <li>[EMAIL PROTECTED] FtpletResult#DISCONNECT}: The server will
immediately
- * disconnect the client.</li>
- * <li>Ftplet throws exception: Same as [EMAIL PROTECTED]
FtpletResult#DISCONNECT}</li>
- * </ul>
- *
- * @param session
- * The current session
- * @param request
- * The current request
- * @return The desired action to be performed by the server
- * @throws FtpException
- * @throws IOException
- */
- FtpletResult afterCommand(FtpSession session, FtpRequest request)
+ * Called by the ftplet container after a command has been executed by
the
+ * server. The implementation should return based on the desired action
to
+ * be taken by the server:
+ * <ul>
+ * <li>[EMAIL PROTECTED] FtpletResult#DEFAULT}: The server continues as
normal</li>
+ * <li>[EMAIL PROTECTED] FtpletResult#NO_FTPLET}: The server does not
call any more
+ * Ftplets before this command but continues as normal</li>
+ * <li>[EMAIL PROTECTED] FtpletResult#SKIP}: Same as [EMAIL PROTECTED]
FtpletResult#DEFAULT}</li>
+ * <li>[EMAIL PROTECTED] FtpletResult#DISCONNECT}: The server will
immediately
+ * disconnect the client.</li>
+ * <li>Ftplet throws exception: Same as [EMAIL PROTECTED]
FtpletResult#DISCONNECT}</li>
+ * </ul>
+ *
+ * @param session
+ * The current session
+ * @param request
+ * The current request
+ * @param reply
+ * the reply that was sent for this command. Implementations
can
+ * use this to check the reply code and thus determine if the
+ * command was successfully processed or not.
+ * @return The desired action to be performed by the server
+ * @throws FtpException
+ * @throws IOException
+ */
+ FtpletResult afterCommand(FtpSession session, FtpRequest request, FtpReply
reply)
throws FtpException, IOException;
/**