tags:

views:

111

answers:

3

I've tried Apache FTP Server but it lacks document and support.

And it's totally based on spring configuration framework which I don't think I could understand very quickly.

What I want is just

  1. a simple FTP Server that could I could embed into my application
  2. I could handle "download" commands using my own code, sending some data from database instead of from static files.

Any suggestion?

+1  A: 

The Apache folks are very good with stuff like Web servers, and that would be the first place I'd look for something like that. Their documentation looks plenty adequate to me. I'm not a big fan of Spring but if they tell me what to put in which XML file I can handle it. Thus, my first recommendation would be to ask you to reconsider your aversion against the Apache FTP server.

<update> To help ablmf and provide a more authoritative answer, I downloaded Apache FTP Server and got it working almost right away without having to change anything. More info in Juha's answer and in my answer to ablmf's other question. </update>

That said, I stumbled across a product from 2001 called jftpd that may satisfy your needs. It appears to be intentionally very simple-minded, so hopefully you can extend it to your needs. However, it doesn't look like documentation is its strong suit.

More modern is Colorado FTP, for which I find updates as late as April 2008. Looks like a very well thought out implementation. There is a manual in their wiki but it doesn't approach the quality of Apache's. They provide several builds, some ready-built and some where you have to dive in yourself to some extent.

Carl Smotricz
Thanks. The most biggest problem I met with Apache FtpServer is that I don't know where to put the configure file, what name it should have. I also posted a question about how to configure Apache FtpServer on stack overflow, but haven't got any responses yet. Do you still remember how to config it?
ablmf
I never used the dang thing... back when I needed an extended FTP server this one wasn't available so I got some university students to write one from scratch :) Hang on, I'll go look. Can you gimme a pointer to your earlier question?
Carl Smotricz
@Carl: The question ablmf asked earlier seems to be this http://stackoverflow.com/questions/1812373/how-to-configure-apache-ftpserver
Juha Syrjälä
Thanks! OK, I just answered that question.
Carl Smotricz
I finally found that : 1. to embed an FtpServer, configure file is not needed. 2. BUT you have to give a user.properties file otherwise anonymous user would not be able to login.
ablmf
A: 

I can't give a straight answer as I never used them, but Googling learns me that Javaworld has two nice articles about doing the FTP in Java.

  1. FTP Client Libraries Reviewed
  2. Java FTP Libraries Benchmarked

They may be of use. It also lists several Java FTP API's.

As to your 2nd question I could handle "download" commands using my own code, sending some data from database instead of from static files.. You could just code to end up with an InputStream from anywhere, such as from the DB using ResultSet#getBinaryStream() and write it to the OutputStream of the FTP connection.

BalusC
A: 

Have a look at Apache FtpServer. Its documentation claims that you can embed it into Java application.

Juha Syrjälä
I tried, I just don't find any clue on how to configure it.
ablmf
How do you want to configure it? I looked documentation briefly and it would seem that you just use programmatic API when embedding, no need for configuration file. Have a look at http://cwiki.apache.org/FTPSERVER/ftplet.html
Juha Syrjälä
It keeps refuse anonymous user login. Although this should be default behavior.
ablmf
It's customary to supply your email address as a password for "anonymous". Have you tried that?
Carl Smotricz
Sorry for lack of formatting, but here: carl@carl-ubuntu:~$ ftp localhost 2121 Connected to localhost. 220 Service ready for new user. Name (localhost:carl): anonymous 331 Guest login okay, send your complete e-mail address as password. Password: 230 User logged in, proceed. Remote system type is UNIX.
Carl Smotricz
The default configuration runs on port 2121 because many people aren't privileged enough to bind to the standard port 21. So perhaps you were talking to the wrong FTP server. You can change the port number, of course, by editing the XML file or copying it and fiddling with the copy.
Carl Smotricz