Skip to content
Snippets Groups Projects
Commit 482bbe71 authored by Fabio Vandewaeter's avatar Fabio Vandewaeter
Browse files

save

parent 4aa6ce10
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,14 @@ Pour exécuter uniquement les tests il faut lancer la commande suivante :
mvn test
```
```
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 -H "Authorization: Bearer valid-token-1" http://localhost:8080/ftps -v
curl -H "Authorization: Bearer valid-token-1" -o fichier.html http://localhost:8080/ftps/mon-ftp/test/download -v
```
## Détails du code
### Générer la javadoc
Lancer la commande suivante :
......
......@@ -102,7 +102,12 @@ public class FTPResource {
try {
ftp.connect(config.getHost(), config.getPort());
ftp.login(user, pass);
// path = "/home/m1gl/fabio.vandewaeter.etu/M1/SR2/serveur-ftp-test/" + path;
InputStream is = ftp.retrieveFileStream(path);
if (is == null) {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
.entity("Could not retrieve file : " + path).build();
}
return Response.ok(is)
.header("Content-Disposition", "attachment; filename=\"" + getFileName(path) + "\"")
.build();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment