当前位置: 首页>>代码示例>>Java>>正文


Java ListenerFactory.setServerAddress方法代码示例

本文整理汇总了Java中org.apache.ftpserver.listener.ListenerFactory.setServerAddress方法的典型用法代码示例。如果您正苦于以下问题:Java ListenerFactory.setServerAddress方法的具体用法?Java ListenerFactory.setServerAddress怎么用?Java ListenerFactory.setServerAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ftpserver.listener.ListenerFactory的用法示例。


在下文中一共展示了ListenerFactory.setServerAddress方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startFtpServer

import org.apache.ftpserver.listener.ListenerFactory; //导入方法依赖的package包/类
/**
 * ����FTP������
 * @param hostip ����ip
 */
private void startFtpServer(String hostip) {
	FtpServerFactory serverFactory = new FtpServerFactory();

	PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
	File files = new File(filename);
	//���������ļ�
	userManagerFactory.setFile(files);
	serverFactory.setUserManager(userManagerFactory.createUserManager());
	// ���ü���IP�Ͷ˿ں�
	ListenerFactory factory = new ListenerFactory();
	factory.setPort(PORT);
	factory.setServerAddress(hostip);

	// replace the default listener
	serverFactory.addListener("default", factory.createListener());

	// start the server
	mFtpServer = serverFactory.createServer();
	try {
		mFtpServer.start();
		Log.d(TAG, "������FTP������  ip = " + hostip);
	} catch (FtpException e) {
		System.out.println(e);
	}
}
 
开发者ID:lucky-code,项目名称:Practice,代码行数:30,代码来源:MainActivity.java

示例2: before

import org.apache.ftpserver.listener.ListenerFactory; //导入方法依赖的package包/类
@Before
public void before() throws Exception {
	directory = new File(folder.newFolder(), "test-1");
	directory.mkdir();
	
	FtpServerFactory serverFactory = new FtpServerFactory();
	ListenerFactory listenerFactory = new ListenerFactory();
	listenerFactory.setServerAddress("127.0.0.1");
	listenerFactory.setPort(21000);
	serverFactory.addListener("default", listenerFactory.createListener());
	serverFactory.setUserManager(new AdminUserManagerFactory(directory.getParentFile().getAbsolutePath()));
	
	try {
		ftpServer = serverFactory.createServer();
		ftpServer.start();
	} catch (FtpException ex) {
		throw new RuntimeException(ex);
	}
	
	FtpStorageProviderFactory factory = new FtpStorageProviderFactory();
	Map<String, Object> properties = new HashMap<String, Object>();
	properties.put(FtpStorage.URL_PROPERTY, "ftp://admin:[email protected]:21000/" + directory.getName());
	properties.put(FtpStorage.CREATE_DIRECTORY_PROPERTY, "false");
	storageProvider = factory.createStorageProvider(properties);
}
 
开发者ID:Blazebit,项目名称:blaze-storage,代码行数:26,代码来源:FtpStorageProviderTest.java

示例3: before

import org.apache.ftpserver.listener.ListenerFactory; //导入方法依赖的package包/类
@Before
public void before() throws Exception {
	directory = folder.newFolder();
	FtpServerFactory serverFactory = new FtpServerFactory();
	ListenerFactory listenerFactory = new ListenerFactory();
	listenerFactory.setServerAddress("127.0.0.1");
	listenerFactory.setPort(21000);
	serverFactory.addListener("default", listenerFactory.createListener());
	serverFactory.setUserManager(new AdminUserManagerFactory(directory.getAbsolutePath()));
	
	try {
		ftpServer = serverFactory.createServer();
		ftpServer.start();
	} catch (FtpException ex) {
		throw new RuntimeException(ex);
	}
	
	factory = new FtpStorageProviderFactory();
}
 
开发者ID:Blazebit,项目名称:blaze-storage,代码行数:20,代码来源:FtpStorageProviderFactoryTest.java

示例4: 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;
}
 
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:25,代码来源:CamelFtpsTest.java

示例5: preStart

import org.apache.ftpserver.listener.ListenerFactory; //导入方法依赖的package包/类
public void preStart() throws FtpException {
	FtpServerFactory serverFactory = new FtpServerFactory();
	ListenerFactory factory = new ListenerFactory();

	// set the ip, port of the listener
	factory.setPort(port);
	factory.setServerAddress("0.0.0.0");
	
	// replace the default listener
	PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
	userManagerFactory.setInputSteam(new ByteArrayInputStream(propInBytes));

	serverFactory.addListener("default", factory.createListener());
	// start the server
	serverFactory.setUserManager(userManagerFactory.createUserManager());
	
	server = serverFactory.createServer();         
	server.start();
}
 
开发者ID:lgnlgn,项目名称:feluca,代码行数:20,代码来源:DataFtpServer.java

示例6: configureFtpServer

import org.apache.ftpserver.listener.ListenerFactory; //导入方法依赖的package包/类
@Override
protected FtpServer configureFtpServer(CamelFtpBaseTest.FtpServerBuilder builder) throws FtpException {
    ListenerFactory listenerFactory = new ListenerFactory();
    listenerFactory.setServerAddress(HOST);
    listenerFactory.setPort(PORT);

    return builder.addUser(USER, PASSWD, ftpRoot, true).registerDefaultListener(listenerFactory.createListener()).build();
}
 
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:9,代码来源:CamelFtpTest.java

示例7: init

import org.apache.ftpserver.listener.ListenerFactory; //导入方法依赖的package包/类
private void init() {
	setFileSystem(new FtpFileSystemView());
	ConnectionConfigFactory connectionConfigFactory = new ConnectionConfigFactory();
	connectionConfigFactory.setMaxThreads(10);
	connectionConfigFactory.setAnonymousLoginEnabled(true);
	setConnectionConfig(connectionConfigFactory.createConnectionConfig());
	setUserManager(new FtpUserManagerFactory().createUserManager());

	// MFMT for directories (default mina command doesn't support it)
	CommandFactoryFactory ccf = new CommandFactoryFactory();
	ccf.addCommand("MFMT", new FtpCommands.MFMT());
	setCommandFactory(ccf.createCommandFactory());
	
	// TODO: set ftplet to control all commands
	Map<String,Ftplet> ftplets = new HashMap<String,Ftplet>();
	ftplets.put("default", new FtpletController());
	setFtplets(ftplets);

	// set the port of the listener
	int port = Integer.parseInt(configuration.getProperty("port", String.valueOf(1821)));
	String serverAddress = configuration.getProperty("server", "");
	LOG.info("FTP server configured at '" + serverAddress + ":" + port + "'");
	ListenerFactory listenerFactory = new ListenerFactory();
	listenerFactory.setPort(port);
	if (!serverAddress.isEmpty()){
		listenerFactory.setServerAddress(serverAddress);
	}

	// replace the default listener
	addListener("default", listenerFactory.createListener());
}
 
开发者ID:andresoviedo,项目名称:google-drive-ftp-adapter,代码行数:32,代码来源:GFtpServerFactory.java


注:本文中的org.apache.ftpserver.listener.ListenerFactory.setServerAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。