public class SimpleFtpServer extends Object
| Constructor and Description |
|---|
SimpleFtpServer()
构造
|
| Modifier and Type | Method and Description |
|---|---|
SimpleFtpServer |
addAnonymous(String homePath)
添加匿名用户
|
SimpleFtpServer |
addFtplet(String name,
org.apache.ftpserver.ftplet.Ftplet ftplet)
增加FTP动作行为监听处理器,通过实现
Ftplet,可以对用户的行为监听并执行相应动作 |
SimpleFtpServer |
addUser(org.apache.ftpserver.ftplet.User user)
增加FTP用户
|
SimpleFtpServer |
delUser(String userName)
删除用户
|
org.apache.ftpserver.listener.ListenerFactory |
getListenerFactory()
获取
ListenerFactory,用于设置端口、用户、SSL等信息 |
org.apache.ftpserver.FtpServerFactory |
getServerFactory()
获取
FtpServerFactory,用于设置FTP服务器相关信息 |
org.apache.ftpserver.ftplet.UserManager |
getUserManager()
获取用户管理器,用于新增、查找和删除用户信息
|
static SimpleFtpServer |
of()
创建FTP服务器,调用
start()启动即可 |
SimpleFtpServer |
setConnectionConfig(org.apache.ftpserver.ConnectionConfig connectionConfig)
设置连接相关配置,使用ConnectionConfigFactory创建
ConnectionConfig对象 |
SimpleFtpServer |
setPort(int port)
自定义默认端口,如果不设置,使用默认端口:21
|
SimpleFtpServer |
setSsl(File keystoreFile,
String password)
使用SSL安全连接
|
SimpleFtpServer |
setSsl(org.apache.ftpserver.ssl.SslConfiguration ssl)
使用SSL安全连接,可以使用SslConfigurationFactory创建
SslConfiguration |
SimpleFtpServer |
setUserManager(org.apache.ftpserver.ftplet.UserManager userManager)
自定义用户管理器,一般用于使用配置文件配置用户信息
|
SimpleFtpServer |
setUsersConfig(File propertiesFile)
自定义用户信息配置文件,此方法会重置用户管理器
|
void |
start()
启动FTP服务,阻塞当前线程
|
public static SimpleFtpServer of()
start()启动即可public org.apache.ftpserver.FtpServerFactory getServerFactory()
FtpServerFactory,用于设置FTP服务器相关信息FtpServerFactorypublic SimpleFtpServer setConnectionConfig(org.apache.ftpserver.ConnectionConfig connectionConfig)
ConnectionConfig对象connectionConfig - 连接配置public org.apache.ftpserver.listener.ListenerFactory getListenerFactory()
ListenerFactory,用于设置端口、用户、SSL等信息ListenerFactorypublic SimpleFtpServer setPort(int port)
port - 端口public org.apache.ftpserver.ftplet.UserManager getUserManager()
public SimpleFtpServer addUser(org.apache.ftpserver.ftplet.User user)
user - FTP用户信息public SimpleFtpServer addAnonymous(String homePath)
homePath - 用户路径,匿名用户对此路径有读写权限public SimpleFtpServer delUser(String userName)
userName - 用户名public SimpleFtpServer setSsl(org.apache.ftpserver.ssl.SslConfiguration ssl)
SslConfigurationssl - SslConfigurationpublic SimpleFtpServer setSsl(File keystoreFile, String password)
keystoreFile - 密钥文件password - 密钥文件密码public SimpleFtpServer setUserManager(org.apache.ftpserver.ftplet.UserManager userManager)
userManager - UserManagerpublic SimpleFtpServer setUsersConfig(File propertiesFile)
propertiesFile - 配置文件public SimpleFtpServer addFtplet(String name, org.apache.ftpserver.ftplet.Ftplet ftplet)
Ftplet,可以对用户的行为监听并执行相应动作name - 名称ftplet - Ftplet,用户自定义监听规则public void start()
Copyright © 2025. All rights reserved.