use of com.odysseusinc.arachne.portal.model.AbstractPaperFile in project ArachneCentralAPI by OHDSI.
the class BasePaperController method downloadFile.
@ApiOperation("Download file of the Paper")
@RequestMapping(value = "/{id}/files/{fileUuid}/download", method = GET)
public void downloadFile(@PathVariable("id") Long id, @PathVariable("fileUuid") String uuid, @RequestParam("type") PaperFileType type, HttpServletResponse response) throws PermissionDeniedException, IOException {
final AbstractPaperFile paperFile = paperService.getFile(id, uuid, type);
final InputStream inputStream = fileService.getFileInputStream(paperFile);
response.setContentType(paperFile.getContentType());
response.setHeader("Content-Disposition", "attachment; filename=" + paperFile.getRealName());
response.setHeader("Content-type", paperFile.getContentType());
IOUtils.copy(inputStream, response.getOutputStream());
response.flushBuffer();
}
Aggregations