Created
May 3, 2012 19:37
-
-
Save sam/2588648 to your computer and use it in GitHub Desktop.
Example for org.apache.ftpserver on JRuby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "java" | |
| jars = File.join(File.dirname(__FILE__), "*.jar") | |
| Dir[jars].each { |jar| require jar } | |
| import org.apache.ftpserver.FtpServer | |
| import org.apache.ftpserver.FtpServerFactory | |
| import org.apache.ftpserver.listener.ListenerFactory | |
| server_factory = FtpServerFactory.new | |
| listener_factory = ListenerFactory.new | |
| listener_factory.port = 2221 | |
| server_factory.add_listener "default", listener_factory.create_listener | |
| server = server_factory.create_server | |
| # start the server | |
| server.start |
Author
Author
Here's an example of adding/overriding the defaults with your own commands: http://mail-archives.apache.org/mod_mbox/mina-ftpserver-users/201003.mbox/%[email protected]%3E
The list of commands you'd need to appropriately override to create a dynamic FTP server isn't exactly short (start at line 89 here: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/CommandFactoryFactory.java?view=markup#L89) , but most of the ones you'd have to touch probably map pretty easily to a REST-alike interface.
Also, unlike with ProFTPd, with this you could BCrypt your user database, and authenticate directly against it in your FTP server.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@fgrehm FYI, thought you might find this interesting. :)