Implemented Feature #5028 with WebSockets

Workspace enhancements: avoid http timeout during folder compression plus fix for servlet not exposing absute paths file download

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@131620 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2016-09-22 10:31:41 +00:00
parent 10e426abd7
commit 378829087c
1 changed files with 8 additions and 6 deletions

View File

@ -57,11 +57,13 @@ public class DownloadFolderServlet extends HttpServlet{
}
}
String fileAbsolutePath = req.getParameter("filepath");
logger.debug("Trigger file download of " + fileAbsolutePath);
String fileRelativePath = req.getParameter("filepath");
String tmpDir = System.getProperty("java.io.tmpdir");
String pathToFile = tmpDir + File.separator + fileRelativePath;
try {
File tmpZip = new File(fileAbsolutePath);
logger.debug("File instanciated " + fileAbsolutePath);
logger.debug("looking for File in " + pathToFile);
File tmpZip = new File(pathToFile);
logger.debug("File instanciated " + pathToFile);
resp.setHeader( "Content-Disposition", "attachment; filename=\"" + tmpZip.getName() + ".zip\"" );
resp.setContentType("application/zip");
@ -77,8 +79,8 @@ public class DownloadFolderServlet extends HttpServlet{
return;
} catch (Exception e) {
logger.error("Error during folder compression "+fileAbsolutePath,e);
handleError(urlRedirectOnError, req, resp, fileAbsolutePath, HttpServletResponse.SC_INTERNAL_SERVER_ERROR +": Error during folder compression: "+e.getMessage());
logger.error("Error during folder compression "+pathToFile,e);
handleError(urlRedirectOnError, req, resp, fileRelativePath, HttpServletResponse.SC_INTERNAL_SERVER_ERROR +": Error during folder compression: "+e.getMessage());
return;
}