Skip to content
Snippets Groups Projects
Commit 559038f5 authored by fabiovandewaeter's avatar fabiovandewaeter
Browse files

fix création dossiers

parent b84d7bd9
Branches tp_2_miso_dict.py
No related tags found
No related merge requests found
...@@ -75,16 +75,18 @@ Puis ouvrir le fichier `target/site/apidocs/index.html` ...@@ -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 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 < 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:** **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 ```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/ 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 ```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 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 ...@@ -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):** **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 : - ajout :
```shell ```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 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 ...@@ -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}' 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):** **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 : - créer dossier :
......
FICHIER11
FICHIER1
examples_ressources/image.png

45.2 KiB

...@@ -171,7 +171,7 @@ public class FTPService { ...@@ -171,7 +171,7 @@ public class FTPService {
throw new FTPException("Authentification FTP échouée", 401); throw new FTPException("Authentification FTP échouée", 401);
} }
ftp.enterLocalPassiveMode(); ftp.enterLocalPassiveMode();
if ("directory".equalsIgnoreCase(resourceType)) { if ("folder".equalsIgnoreCase(resourceType)) {
boolean created = ftp.makeDirectory(path); boolean created = ftp.makeDirectory(path);
if (!created) { if (!created) {
throw new FTPException("Erreur création répertoire", 400); throw new FTPException("Erreur création répertoire", 400);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment