|
|
@@ -185,14 +185,17 @@ public class FileUtils extends org.apache.commons.io.FileUtils
|
|
|
* @param realFileName 真实文件名
|
|
|
* @return
|
|
|
*/
|
|
|
- public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName,String afttName) throws UnsupportedEncodingException
|
|
|
+ public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName,String attName) throws UnsupportedEncodingException
|
|
|
{
|
|
|
- String percentEncodedFileName = percentEncode(realFileName);
|
|
|
-
|
|
|
+ String percentEncodedFileName=null;
|
|
|
+ if (attName!=null){
|
|
|
+ percentEncodedFileName=percentEncode(attName);
|
|
|
+ } else{
|
|
|
+ percentEncodedFileName=percentEncode(realFileName);
|
|
|
+ }
|
|
|
StringBuilder contentDispositionValue = new StringBuilder();
|
|
|
- if(afttName!= null)contentDispositionValue.append("attachment; filename="+afttName);
|
|
|
- else contentDispositionValue.append("attachment; filename=");
|
|
|
- contentDispositionValue.append(percentEncodedFileName)
|
|
|
+ contentDispositionValue.append("attachment; filename=")
|
|
|
+ .append(percentEncodedFileName)
|
|
|
.append(";")
|
|
|
.append("filename*=")
|
|
|
.append("utf-8''")
|