I need to make a file available for download from a certain URL on my server(It's a google app angine project). Here is what I use:
@At("/api/download")
@Service
public class ZipDownloadService {
@Get
public Reply<?> downloadZip() throws IOException, ServletException {
try (FileInputStream stream = new FileInputStream("/assets/zip/my_file.zip")) {
final byte[] bytes = IOUtils.toByteArray(stream);
return Reply.with(bytes).type("application/octet-stream").as(Raw.class);
}
}
}
The zip file is stored in the web directory of my project and the file has read permissions for everyone, but when I go to the url I always get the AccessControlException.