public class ListCommandHandler extends AbstractStubDataCommandHandler implements CommandHandler
directoryListing property.
The interpretation of the value returned from this command is dependent upon the value returned
by the SYST command. The format of the directory listing should match the format associated with
the system named by the SYST command. For example, if the SYST command returns "WINDOWS", then
the directory listing value from this command should match the Windows-specific format. See the
SystCommandHandler to control the value returned for the SYST command.
Here is an example value for directoryListing when the SystCommandHandler
returns "WINDOWS". Note that multiple entries are separated by "\n":
CommandHandler listCommandHandler = new ListCommandHandler();
listCommandHandler.setDirectoryListing("11-09-01 12:30PM 406348 File2350.log\n" +
"11-01-01 1:30PM <DIR> archive");
And here is an example value for directoryListing when the SystCommandHandler
returns "UNIX". Note that multiple entries are separated by "\n":
CommandHandler listCommandHandler = new ListCommandHandler();
listCommandHandler.setDirectoryListing("drwxrwxrwx 1 none none 0 Mar 20 2010 archive\n" +
"-rwxrwxrwx 1 none none 19 Mar 20 2010 abc.txt");
Each invocation record stored by this CommandHandler includes the following data element key/values:
PATHNAME_KEY ("pathname") - the pathname of the directory (or file) submitted on the
invocation (the first command parameter); this parameter is optional, so the value may be null.
SystCommandHandler| Modifier and Type | Field and Description |
|---|---|
static String |
PATHNAME_KEY |
finalReplyCode, finalReplyMessageKey, finalReplyText, preliminaryReplyCode, preliminaryReplyMessageKey, preliminaryReplyTextLOG| Constructor and Description |
|---|
ListCommandHandler() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
beforeProcessData(Command command,
Session session,
InvocationRecord invocationRecord)
Perform any necessary logic before transferring data across the data connection.
|
protected void |
processData(Command command,
Session session,
InvocationRecord invocationRecord)
Abstract method placeholder for subclass transfer of data across the data connection.
|
void |
setDirectoryListing(String directoryListing)
Set the contents of the directoryListing to send back on the data connection for this command.
|
afterProcessData, handleCommand, sendFinalReply, setFinalReplyCode, setFinalReplyMessageKey, setFinalReplyText, setPreliminaryReplyCode, setPreliminaryReplyMessageKey, setPreliminaryReplyTextclearInvocations, getInvocation, handleCommand, numberOfInvocations, sendReplyassertValidReplyCode, getReplyTextBundle, quotes, setReplyTextBundleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandleCommandpublic static final String PATHNAME_KEY
protected void beforeProcessData(Command command, Session session, InvocationRecord invocationRecord) throws Exception
AbstractStubDataCommandHandlerbeforeProcessData in class AbstractStubDataCommandHandlercommand - - the Command to be handledsession - - the session on which the Command was submittedinvocationRecord - - the InvocationRecord; CommandHandlers are expected to add
handler-specific data to the InvocationRecord, as appropriateException - - if an error occursAbstractStubDataCommandHandler.beforeProcessData(org.mockftpserver.core.command.Command, org.mockftpserver.core.session.Session, org.mockftpserver.core.command.InvocationRecord)protected void processData(Command command, Session session, InvocationRecord invocationRecord)
AbstractStubDataCommandHandlerprocessData in class AbstractStubDataCommandHandlercommand - - the Command to be handledsession - - the session on which the Command was submittedinvocationRecord - - the InvocationRecord; CommandHandlers are expected to add
handler-specific data to the InvocationRecord, as appropriateAbstractStubDataCommandHandler.processData(org.mockftpserver.core.command.Command, org.mockftpserver.core.session.Session, org.mockftpserver.core.command.InvocationRecord)public void setDirectoryListing(String directoryListing)
directoryListing - - the directoryListing to setCopyright © 2016. All rights reserved.