String beforeName = "资金出借报告-"+custInvestInfoShou.getChName()+"-"+custInvestInfoShou.getCustCityName();
if (file.exists()) {
if(StringUtils.contains(userAgent,"Mozilla")){
String beforeNameFireFox = new String(beforeName.getBytes(), "ISO8859-1"); 火狐浏览器
response.addHeader(
"Content-Disposition",
"attachment;filename=\""
+beforeNameFireFox+"-"
+ finInvestInfo.getInvestNum()+
"-"+format.format(reportDate)
+ ".pdf\"");
}else{ 其他浏览器
response.addHeader(
"Content-Disposition",
"attachment;filename=\""
+ URLEncoder.encode(beforeName,"UTF-8")+"-"
+ finInvestInfo.getInvestNum()+
"-"+format.format(reportDate)
+ ".pdf\"");
}
response.setContentType("application/pdf");
temps = new DataOutputStream(response.getOutputStream());
in = new DataInputStream(
new FileInputStream(strPdfPath));
byte[] b = new byte[2048];
while ((in.read(b)) != -1) {
temps.write(b);
temps.flush();
}
}
if (file.exists()) {
if(StringUtils.contains(userAgent,"Mozilla")){
String beforeNameFireFox = new String(beforeName.getBytes(), "ISO8859-1"); 火狐浏览器
response.addHeader(
"Content-Disposition",
"attachment;filename=\""
+beforeNameFireFox+"-"
+ finInvestInfo.getInvestNum()+
"-"+format.format(reportDate)
+ ".pdf\"");
}else{ 其他浏览器
response.addHeader(
"Content-Disposition",
"attachment;filename=\""
+ URLEncoder.encode(beforeName,"UTF-8")+"-"
+ finInvestInfo.getInvestNum()+
"-"+format.format(reportDate)
+ ".pdf\"");
}
response.setContentType("application/pdf");
temps = new DataOutputStream(response.getOutputStream());
in = new DataInputStream(
new FileInputStream(strPdfPath));
byte[] b = new byte[2048];
while ((in.read(b)) != -1) {
temps.write(b);
temps.flush();
}
}