Skip to content

Commit 1507199

Browse files
author
NoteFox
committed
files can be found again
1 parent 0bb6a80 commit 1507199

4 files changed

Lines changed: 43 additions & 2 deletions

File tree

ftpserver.jks

Whitespace-only changes.

maps/map/testFile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
edit this

src/main/java/Playground.java

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,45 @@
1+
import org.apache.ftpserver.FtpServer;
2+
import org.apache.ftpserver.FtpServerFactory;
3+
import org.apache.ftpserver.ftplet.FtpException;
4+
import org.apache.ftpserver.listener.ListenerFactory;
5+
import org.apache.ftpserver.ssl.SslConfigurationFactory;
6+
import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory;
7+
8+
import java.io.File;
9+
110
public class Playground {
2-
public static void main(String[] args) {
11+
public static void main(String[] args) throws FtpException {
12+
FtpServerFactory serverFactory = new FtpServerFactory();
13+
14+
ListenerFactory factory = new ListenerFactory();
15+
16+
// set the port of the listener
17+
factory.setPort(2221);
18+
19+
// define SSL configuration
20+
SslConfigurationFactory ssl = new SslConfigurationFactory();
21+
ssl.setKeystoreFile(new File("ftpserver.jks"));
22+
ssl.setKeystorePassword("password");
23+
24+
// set the SSL configuration for the listener
25+
factory.setSslConfiguration(ssl.createSslConfiguration());
26+
factory.setImplicitSsl(true);
27+
28+
// replace the default listener
29+
serverFactory.addListener("default", factory.createListener());
30+
31+
PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
32+
userManagerFactory.setFile(new File("users.properties"));
33+
34+
serverFactory.setUserManager(userManagerFactory.createUserManager());
335

36+
// start the server
37+
FtpServer server = serverFactory.createServer();
38+
//mFtpServer = server;
39+
try {
40+
server.start();
41+
} catch (FtpException e) {
42+
e.printStackTrace();
43+
}
444
}
545
}

src/main/java/Server/FTPServer/FTPService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void ftpServerSetUp() throws IOException {
8686
private void defineSSLConf() {
8787
// define SSL configuration
8888
SslConfigurationFactory ssl = new SslConfigurationFactory();
89-
ssl.setKeystoreFile(new File("src/main/resources/ftpServer.jks"));
89+
ssl.setKeystoreFile(new File("./ftp/ftpServer.jks"));
9090
ssl.setKeystorePassword("password");
9191

9292
// set the SSL configuration for the listener

0 commit comments

Comments
 (0)