I've a very strange problem. I use a RHEL 6 32bit workstation to develop Play! application with Oracle JDK 1.8.71. When all works fine I put everything on a server RHEL 6 64bit with the same JDK version and I create the stage to use in production.
Now I've a simple app that creates a pdf file and permits to an user to download it using the following method:
@Security.Authenticated(Secured.class)
@With(Perms.class)
public Result download(String n) {
String filename = "Ricevuta" + n + ".pdf";
System.out.println("Download: " + filename);
response().setContentType("application/x-download");
response().setHeader("Content-disposition","attachment; filename=" + filename);
return ok(new File("public/tmp/" + filename));
}
Clicking on a template icon:
<acronym title="Download Ricevuta">
<a href="@routes.Receipt.download(value(0))"><span class="glyphicon glyphicon-download" ></span></a>
</acronym>
When I click on the icon on my machine all works fine, the browser open the download window. On the server nothing happens and no error occurs.
The file is really created in public/tmp, If I put the server running in development mode (via activator run), all works fine.
If I copy the file in target/universal/stage/public/tmp/ all works fine also using the stage.
If I try to create the pdf directly under target/universal/stage/public/tmp/ the file in empty.
So, where I've to create the PDF to be able to download it in both mode?