本文整理汇总了Java中org.apache.ftpserver.listener.ListenerFactory.setDataConnectionConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java ListenerFactory.setDataConnectionConfiguration方法的具体用法?Java ListenerFactory.setDataConnectionConfiguration怎么用?Java ListenerFactory.setDataConnectionConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ftpserver.listener.ListenerFactory
的用法示例。
在下文中一共展示了ListenerFactory.setDataConnectionConfiguration方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createServer
import org.apache.ftpserver.listener.ListenerFactory; //导入方法依赖的package包/类
public static FtpServer createServer(int port, int maxLoginFailures, int loginFailureDelay,
boolean anonymousEnable, String anonymousHomeDirectory,
FTPUser... users) {
final ListenerFactory listener = new ListenerFactory();
listener.setPort(port);
listener.setDataConnectionConfiguration(
new DataConnectionConfigurationFactory().createDataConnectionConfiguration());
ConnectionConfigFactory connection = new ConnectionConfigFactory();
connection.setMaxLoginFailures(maxLoginFailures);
connection.setLoginFailureDelay(loginFailureDelay);
connection.setAnonymousLoginEnabled(anonymousEnable);
final FtpServerFactory server = new FtpServerFactory();
server.setUserManager(new FTPUserManager(anonymousEnable, anonymousHomeDirectory, users));
server.setFileSystem(FTPFileSystemFactory.getInstance());
server.addListener("default", listener.createListener());
server.setConnectionConfig(connection.createConnectionConfig());
return server.createServer();
}
示例2: configureSSL
import org.apache.ftpserver.listener.ListenerFactory; //导入方法依赖的package包/类
private ListenerFactory configureSSL() {
ListenerFactory listener = new ListenerFactory();
listener.setServerAddress("127.0.0.1");
listener.setPort(PORT);
SslConfigurationFactory ssl = new SslConfigurationFactory();
ssl.setKeystoreFile(SERVER_SSL_KEY_TRUST_STORE);
ssl.setKeyPassword(SERVER_SSL_KEY_PASSWD);
ssl.setKeystorePassword(SERVER_SSL_STORE_PASSWD);
ssl.setTruststoreFile(SERVER_SSL_KEY_TRUST_STORE);
ssl.setTruststorePassword(SERVER_SSL_STORE_PASSWD);
ssl.setClientAuthentication("NEED");
SslConfiguration sslConfig = ssl.createSslConfiguration();
listener.setSslConfiguration(sslConfig);
listener.setImplicitSsl(true);
DataConnectionConfigurationFactory dataConfigFactory = new DataConnectionConfigurationFactory();
dataConfigFactory.setImplicitSsl(true);
listener.setDataConnectionConfiguration(dataConfigFactory.createDataConnectionConfiguration());
return listener;
}
示例3: createServer
import org.apache.ftpserver.listener.ListenerFactory; //导入方法依赖的package包/类
@Override
protected FtpServerFactory createServer() throws Exception {
FtpServerFactory server = super.createServer();
ListenerFactory listenerFactory = new ListenerFactory(server.getListener("default"));
DataConnectionConfigurationFactory dccFactory = new DataConnectionConfigurationFactory();
dccFactory.setPassiveExternalAddress("127.0.0.1");
listenerFactory.setDataConnectionConfiguration(dccFactory.createDataConnectionConfiguration());
server.addListener("default", listenerFactory.createListener());
CommandFactoryFactory cmFact = new CommandFactoryFactory();
cmFact.setUseDefaultCommands(true);
cmFact.addCommand("PASV", new PASVTest());
server.setCommandFactory(cmFact.createCommandFactory());
return server;
}
示例4: createServer
import org.apache.ftpserver.listener.ListenerFactory; //导入方法依赖的package包/类
@Override
protected FtpServerFactory createServer() throws Exception {
FtpServerFactory server = super.createServer();
ListenerFactory listenerFactory = new ListenerFactory(server.getListener("default"));
DataConnectionConfigurationFactory dccFactory = new DataConnectionConfigurationFactory();
passiveAddress = TestUtil.findNonLocalhostIp().getHostAddress();
dccFactory.setPassiveAddress(passiveAddress);
dccFactory.setPassivePorts("12347");
DataConnectionConfiguration dcc=dccFactory.createDataConnectionConfiguration();
listenerFactory.setDataConnectionConfiguration(dcc);
server.addListener("default", listenerFactory.createListener());
return server;
}
示例5: ftpServerFactory
import org.apache.ftpserver.listener.ListenerFactory; //导入方法依赖的package包/类
public static FtpServer ftpServerFactory(String name, HashMap<String, ConfigurationItem> all_instances_confs, HashMap<String, Ftplet> ftplets) throws Exception {
FtpServerFactory server_factory = new FtpServerFactory();
LinkedHashMap<String, Object> log = new LinkedHashMap<String, Object>();
DataConnectionConfigurationFactory dccf = new DataConnectionConfigurationFactory();
dccf.setActiveEnabled(true);
dccf.setActiveIpCheck(true);
log.put("active", dccf.isActiveEnabled());
log.put("active IP check", dccf.isActiveIpCheck());
ConfigurationClusterItem local = Configuration.getClusterConfiguration(all_instances_confs, name, "active", "0.0.0.0", 20).get(0);
dccf.setActiveLocalAddress(local.address);
dccf.setActiveLocalPort(local.port);
log.put("active local", dccf.getActiveLocalAddress() + ":" + dccf.getActiveLocalPort());
int idle = Configuration.getValue(all_instances_confs, name, "idle", 300);
dccf.setIdleTime(idle);
log.put("Idle time", dccf.getIdleTime());
dccf.setImplicitSsl(false);
dccf.setPassiveAddress(Configuration.getValue(all_instances_confs, name, "passive-internal", "0.0.0.0"));
dccf.setPassiveExternalAddress(Configuration.getValue(all_instances_confs, name, "passive-external", "0.0.0.0"));
dccf.setPassivePorts(Configuration.getValue(all_instances_confs, name, "passive-ports", "30000-40000"));
log.put("passive", dccf.getPassiveAddress() + ">" + dccf.getPassiveExternalAddress());
log.put("passive ports", dccf.getPassivePorts());
ListenerFactory factory = new ListenerFactory();
factory.setPort(Configuration.getValue(all_instances_confs, name, "listen", 21));
factory.setIpFilter(FTPIpFilter.getFilter());
factory.setIdleTimeout(idle);
log.put("port", factory.getPort());
factory.setDataConnectionConfiguration(dccf.createDataConnectionConfiguration());
server_factory.addListener("default", factory.createListener());
FTPUserManager ftpum;
if (name == "default") {
ftpum = new FTPUserManager("");
} else {
ftpum = new FTPUserManager(name);
server_factory.setUserManager(ftpum);
}
server_factory.setUserManager(ftpum);
log.put("User Manager", ftpum);
server_factory.setFtplets(ftplets);
Loggers.FTPserver.info("Start FTP Server: " + log);
FtpServer server = server_factory.createServer();
server.start();
return server;
}
示例6: createServer
import org.apache.ftpserver.listener.ListenerFactory; //导入方法依赖的package包/类
@Override
protected FtpServerFactory createServer() throws Exception {
FtpServerFactory server = super.createServer();
ListenerFactory listenerFactory = new ListenerFactory(server.getListener("default"));
DataConnectionConfigurationFactory dccFactory = new DataConnectionConfigurationFactory();
dccFactory.setPassiveExternalAddress("127.0.0.1");
listenerFactory.setDataConnectionConfiguration(dccFactory.createDataConnectionConfiguration());
server.addListener("default", listenerFactory.createListener());
return server;
}
示例7: createServer
import org.apache.ftpserver.listener.ListenerFactory; //导入方法依赖的package包/类
@Override
protected FtpServerFactory createServer() throws Exception {
FtpServerFactory server = super.createServer();
ListenerFactory listenerFactory = new ListenerFactory(server
.getListener("default"));
DataConnectionConfigurationFactory dccFactory = new DataConnectionConfigurationFactory();
passivePort = TestUtil.findFreePort(12444);
dccFactory.setPassivePorts(passivePort + "-" + (passivePort + 1));
listenerFactory.setDataConnectionConfiguration(dccFactory
.createDataConnectionConfiguration());
server.addListener("default", listenerFactory.createListener());
return server;
}
示例8: createServer
import org.apache.ftpserver.listener.ListenerFactory; //导入方法依赖的package包/类
@Override
protected FtpServerFactory createServer() throws Exception {
FtpServerFactory server = super.createServer();
ListenerFactory listenerFactory = new ListenerFactory(server.getListener("default"));
DataConnectionConfigurationFactory dccFactory = new DataConnectionConfigurationFactory();
int passivePort = TestUtil.findFreePort(12000 + new Random().nextInt(20000));
dccFactory.setPassivePorts(passivePort + "-" + passivePort);
listenerFactory.setDataConnectionConfiguration(dccFactory.createDataConnectionConfiguration());
server.addListener("default", listenerFactory.createListener());
return server;
}
示例9: createServer
import org.apache.ftpserver.listener.ListenerFactory; //导入方法依赖的package包/类
@Override
protected FtpServerFactory createServer() throws Exception {
FtpServerFactory server = super.createServer();
ListenerFactory listenerFactory = new ListenerFactory(server
.getListener("default"));
DataConnectionConfigurationFactory dccFactory = new DataConnectionConfigurationFactory();
passivePort = TestUtil.findFreePort(12444);
dccFactory.setPassivePorts(String.valueOf(passivePort));
listenerFactory.setDataConnectionConfiguration(dccFactory
.createDataConnectionConfiguration());
server.addListener("default", listenerFactory.createListener());
return server;
}
示例10: createServer
import org.apache.ftpserver.listener.ListenerFactory; //导入方法依赖的package包/类
protected FtpServerFactory createServer() throws Exception {
assertTrue(USERS_FILE.getAbsolutePath() + " must exist", USERS_FILE
.exists());
FtpServerFactory serverFactory = new FtpServerFactory();
serverFactory.setConnectionConfig(createConnectionConfigFactory()
.createConnectionConfig());
ListenerFactory listenerFactory = new ListenerFactory();
listenerFactory.setPort(0);
listenerFactory
.setDataConnectionConfiguration(createDataConnectionConfigurationFactory()
.createDataConnectionConfiguration());
serverFactory.addListener("default", listenerFactory.createListener());
PropertiesUserManagerFactory umFactory = new PropertiesUserManagerFactory();
umFactory.setAdminName("admin");
umFactory.setPasswordEncryptor(new ClearTextPasswordEncryptor());
umFactory.setFile(USERS_FILE);
serverFactory.setUserManager(umFactory.createUserManager());
return serverFactory;
}