當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。