ref 11720: DataMiner - Update to StorageHUB

https://support.d4science.org/issues/11720

Updated to StorageHub 

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/data-miner-manager-widget@173866 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2018-10-29 16:52:42 +00:00
parent 0b7f6c6d19
commit 2d5a185517
1 changed files with 7 additions and 5 deletions

View File

@ -101,7 +101,7 @@ public class DownloadServlet extends HttpServlet {
String fileName;
if (itemDownload.getItemDescription() == null) {
fileName = "filename";
resp.setHeader("Content-Disposition:", "attachment;filename=\"" + fileName + "\"");
resp.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\"");
resp.setHeader("Content-Type", "application/force-download");
} else {
if (itemDownload.getItemDescription().getName() == null
@ -109,27 +109,29 @@ public class DownloadServlet extends HttpServlet {
if (itemDownload.getItemDescription().getType() != null && itemDownload.getItemDescription()
.getType().compareTo(FolderItem.class.getSimpleName()) == 0) {
fileName = "folder.zip";
resp.setHeader("Content-Disposition:", "attachment;filename=\"" + fileName + "\"");
resp.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\"");
resp.setHeader("Content-Type", "application/zip");
} else {
fileName = "filename";
resp.setHeader("Content-Disposition:", "attachment;filename=\"" + fileName + "\"");
resp.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\"");
resp.setHeader("Content-Type", "application/force-download");
}
} else {
if (itemDownload.getItemDescription().getType() != null && itemDownload.getItemDescription()
.getType().compareTo(FolderItem.class.getSimpleName()) == 0) {
fileName = itemDownload.getItemDescription().getName() + ".zip";
resp.setHeader("Content-Disposition:", "attachment;filename=\"" + fileName + "\"");
resp.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\"");
resp.setHeader("Content-Type", "application/zip");
} else {
fileName = itemDownload.getItemDescription().getName();
resp.setHeader("Content-Disposition:", "attachment;filename=\"" + fileName + "\"");
resp.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\"");
resp.setHeader("Content-Type", "application/force-download");
}
}
}
logger.debug("Content-Disposition: "+resp.getHeader("Content-Disposition"));
logger.debug("Content-Type: "+resp.getHeader("Content-Type"));
logger.debug("DownloadServlet filename: " + fileName);
stream(itemDownload.getInputStream(), resp.getOutputStream());
}