Hi
Janardhanan, Ajith (AJANARDH) wrote:
Niklas,
Thank you very much for the response. Your solution works for mkdir.
I tried this solution for LIST command too. But I am running in to some
small issues. I am using the following command:
response.write(new DefaultFtpReply(200, "Command successful\n
File1111\nFile2222\nFile3333") );
return FtpletEnum.RET_SKIP;
The result is
ftp> ls
200 Command PORT okay.
200-Command successful
File1111
File2222
200 File3333
ftp> ls
226 Closing data connection.
200 Command PORT okay.
Any idea how to fix this would be greately appreciated.
The LIST command will open the data connection for transmitting the file
listing. So, the client sending the LIST request will expect back a
response saying that the data connection has been opened or will open it
itself (depending on active or passive mode). So, just returning the
response as done above would not work. Instead you will have to open a
data connection and send your listing there, while sending status
replies on the control socket. Have a look at our implementation of the
LIST command for clues on how to do this:
http://svn.apache.org/repos/asf/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/LIST.java
/niklas