diff --git a/README.md b/README.md index af3270bb427a64626549e2a17242b18d5ce1f3c9..b84cddfbd8492e887f0cb28d2708752a430fde7c 100644 --- a/README.md +++ b/README.md @@ -66,8 +66,8 @@ Puis ouvrir le fichier `target/site/apidocs/index.html` **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:** -``` -curl -X GET -v -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: anonymous" -H "X-FTP-Pass: anonymous" localhost:8080/ftps/mon-ftp/folder +```shell +> curl -X GET -v -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: anonymous" -H "X-FTP-Pass: anonymous" localhost:8080/ftps/mon-ftp/folder Note: Unnecessary use of -X or --request, GET is already inferred. * Trying 127.0.0.1:8080... @@ -95,6 +95,27 @@ Note: Unnecessary use of -X or --request, GET is already inferred. **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):** +```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 +``` + +```shell +> curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer valid-token-1" http://localhost:8080/ftps +``` + +```shell +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}' +``` + +```shell +fabio.vandewaeter.etu@b10p21:~/M1/SR2/TEMPO$ curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer valid-token-1" http://localhost:8080/ftps + +[{"alias":"mon-ftp","host":"nouvelle-adresse","port":2221}] +``` + **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 15 et 16 si—en plus—le proxy FlopBox, permet de chercher des fichiers/répertoires stockés dans plusieurs serveurs FTP (le proxy retourne la liste des URLs pour chaque fichier trouvé):** diff --git a/src/main/java/fil/sr2/flopbox/FTPResource.java b/src/main/java/fil/sr2/flopbox/FTPResource.java index 7feae6d273be75fafc0b2228bdb5621e903ce107..694a01bd0bbdf42b12e334c64dff2bfb61e35d4b 100644 --- a/src/main/java/fil/sr2/flopbox/FTPResource.java +++ b/src/main/java/fil/sr2/flopbox/FTPResource.java @@ -116,7 +116,6 @@ public class FTPResource { // POST /ftps - enregistre un nouveau serveur FTP @POST @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) public Response addFTPServer(FTPServerConfig config, @Context UriInfo uriInfo) { System.out.println("addFTPServer()"); boolean created = FTPServerRepository.getInstance().addServer(config); @@ -126,7 +125,7 @@ public class FTPResource { } UriBuilder builder = uriInfo.getAbsolutePathBuilder(); builder.path(config.getAlias()); - return Response.created(builder.build()).entity(config).build(); + return Response.created(builder.build()).build(); } @DELETE