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