Author: phuong_vu
Date: 2010-12-24 04:22:56 -0500 (Fri, 24 Dec 2010)
New Revision: 5642
Modified:
portal/branches/branch-GTNPORTAL-1731/component/web/server/src/main/java/org/exoplatform/web/handler/DownloadHandler.java
Log:
GTNPORTAL-1660 Download file name in chrome browser always be download.* or command.*
Modified:
portal/branches/branch-GTNPORTAL-1731/component/web/server/src/main/java/org/exoplatform/web/handler/DownloadHandler.java
===================================================================
---
portal/branches/branch-GTNPORTAL-1731/component/web/server/src/main/java/org/exoplatform/web/handler/DownloadHandler.java 2010-12-24
08:06:27 UTC (rev 5641)
+++
portal/branches/branch-GTNPORTAL-1731/component/web/server/src/main/java/org/exoplatform/web/handler/DownloadHandler.java 2010-12-24
09:22:56 UTC (rev 5642)
@@ -64,15 +64,15 @@
String userAgent = req.getHeader("User-Agent");
if (dresource.getDownloadName() != null)
{
- if (userAgent != null && userAgent.contains("MSIE"))
+ if (userAgent != null && userAgent.contains("Firefox"))
{
- res.setHeader("Content-Disposition",
"attachment;filename=\""
- + URLEncoder.encode(dresource.getDownloadName(), "UTF-8") +
"\"");
+ res.setHeader("Content-Disposition", "attachment;
filename*=utf-8''"
+ + URLEncoder.encode(dresource.getDownloadName(), "UTF-8") +
"");
}
else
{
- res.setHeader("Content-Disposition", "attachment;
filename*=utf-8''"
- + URLEncoder.encode(dresource.getDownloadName(), "UTF-8") +
"");
+ res.setHeader("Content-Disposition",
"attachment;filename=\""
+ + URLEncoder.encode(dresource.getDownloadName(), "UTF-8") +
"\"");
}
}
res.setContentType(dresource.getResourceMimeType());
@@ -105,4 +105,4 @@
}
}
}
-}
\ No newline at end of file
+}