diff --git a/README.md b/README.md index 793f72b794d5954be14465f0144774ce0f8fb67b..4a74bc50fef66a36e786585ea5ddfb045c55be5e 100644 --- a/README.md +++ b/README.md @@ -75,16 +75,18 @@ Puis ouvrir le fichier `target/site/apidocs/index.html` En utilisant la commande suivante `python3 serveur_ftp.py`, vous pouvez donner les identifiants FTP anonymous/anonymous ou user/password -Il faut aussi penser à ajouter un serveur FTP avec la commande suivant : `curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer valid-token-1" -d '{"alias":"mon-ftp","host":"localhost","port":2121}' http://localhost:8080/ftps` +Il faut aussi penser faire un `mvn clean package`, puis `java -jar target/FlopBox.jar` et à ajouter un serveur FTP avec la commande suivant : `curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer valid-token-1" -d '{"alias":"mon-ftp","host":"localhost","port":2121}' http://localhost:8080/ftps` **Note < 10 si le code fourni ne compile pas et ne peut pas être exécuté en suivant les instructions:** **Note comprise entre 10 et 11 si le code compile et peut être lancé pour afficher l'arborescence d'un serveur FTP via le proxy FlopBox:** +- afficher l'arborescence du root du serveur FTP correspondant à l'alias `mon-ftp` : ```shell curl -X GET -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: anonymous" -H "X-FTP-Pass: anonymous" localhost:8080/ftps/list/mon-ftp/ ``` +- afficher l'arborescence du dossier `dossier1/` du serveur FTP : ```shell curl -X GET -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: anonymous" -H "X-FTP-Pass: anonymous" localhost:8080/ftps/list/mon-ftp/dossier1 ``` @@ -130,6 +132,11 @@ curl -X PUT -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: user" -H "X **Note comprise entre 13 et 14 si—en plus—le proxy FlopBox permet de gérer plusieurs serveurs FTP différents (ajout, suppression, modification des serveurs):** +- lister les serveurs : +```shell +curl -X GET -H "Authorization: Bearer valid-token-1" http://localhost:8080/ftps +``` + - ajout : ```shell curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer valid-token-1" -d '{"alias":"mon-ftp","host":"localhost","port":2121}' http://localhost:8080/ftps @@ -145,11 +152,6 @@ curl -X DELETE -H "Authorization: Bearer valid-token-1" http://localhost:8080/ft curl -X PUT http://localhost:8080/ftps/mon-ftp -H "Content-Type: application/json" -H "Authorization: Bearer valid-token-1" -d '{"alias":"mon-ftp","host":"nouvelle-adresse","port":2221}' ``` -- lister les serveurs : -```shell -curl -X GET -H "Authorization: Bearer valid-token-1" http://localhost:8080/ftps -``` - **Note comprise entre 14 et 15 si—en plus—le proxy FlopBox, permet de créer, supprimer, renommer une ressource directement sur l'un des serveurs FTP gérés (fichier ou répertoire):** - créer dossier : diff --git a/examples_ressources/dossier1/fichier11 b/examples_ressources/dossier1/fichier11 new file mode 100644 index 0000000000000000000000000000000000000000..dbe8b717ce3cf63155110811d8eb54230654bb6e --- /dev/null +++ b/examples_ressources/dossier1/fichier11 @@ -0,0 +1 @@ +FICHIER11 diff --git a/examples_ressources/fichier1 b/examples_ressources/fichier1 new file mode 100644 index 0000000000000000000000000000000000000000..c074b73f25b04b7773f12e2e42e93c20ea39d823 --- /dev/null +++ b/examples_ressources/fichier1 @@ -0,0 +1 @@ +FICHIER1 diff --git a/examples_ressources/image.png b/examples_ressources/image.png new file mode 100644 index 0000000000000000000000000000000000000000..8741baa19d02a003db73c33bd779a324bc1a57fa Binary files /dev/null and b/examples_ressources/image.png differ diff --git a/src/main/java/fil/sr2/flopbox/FTPService.java b/src/main/java/fil/sr2/flopbox/FTPService.java index 6319864e81687bce113a114df0192cf914381260..7e7bcd2eccc7a8c99ef4c801bd8ba13396b91234 100644 --- a/src/main/java/fil/sr2/flopbox/FTPService.java +++ b/src/main/java/fil/sr2/flopbox/FTPService.java @@ -171,7 +171,7 @@ public class FTPService { throw new FTPException("Authentification FTP échouée", 401); } ftp.enterLocalPassiveMode(); - if ("directory".equalsIgnoreCase(resourceType)) { + if ("folder".equalsIgnoreCase(resourceType)) { boolean created = ftp.makeDirectory(path); if (!created) { throw new FTPException("Erreur création répertoire", 400);