19 Nisan 2020 Pazar

FtpServerFactory Sınıfı

createServer metodu
Şöyle yaparız
FtpServerFactory serverFactory = new FtpServerFactory();

ListenerFactory listenerFactory = new ListenerFactory();
listenerFactory.setServerAddress("/*IP Address*/");
listenerFactory.setPort(8001);  
serverFactory.addListener("default",listener=listenerFactory.createListener());

PropertiesUserManagerFactory userFactory= new PropertiesUserManagerFactory();
userFactory.setPasswordEncryptor(new ClearTextPasswordEncryptor());
BaseUser baseUser=new BaseUser();
baseUser.setName("Test");
baseUser.setPassword("123");
baseUser.setEnabled(true);
baseUser.setHomeDirectory("E:/Test Data");
baseUser.setAuthorities(Arrays.asList(new WritePermission()));
UserManager uManager=userFactory.createUserManager();
serverFactory.setUserManager(uManager);      

FtpServer ftpServer=serverFactory.createServer();
ftpServer.start();

Hiç yorum yok:

Yorum Gönder