byte[] bytes;
this.getResponse().setHeader("Pragma", "no-cache");
this.getResponse().setHeader("Cache-Control", "no-cache");this.getResponse().setDateHeader("Expires", 0);
this.getResponse().setContentType(Util.fileFormat(sf.get("EXT")));
this.getResponse().setHeader("content-disposition", "attachment;filename="+sf.getStr("FILE_NAME"));
outStream = this.getResponse().getOutputStream();
outStream.write(bytes, 0, bytes.length);
outStream.flush();
outStream.close();
public static String fileFormat(Object ext){
String fileFormat="";
if(ext.equals("pdf")){
fileFormat="application/pdf";
}else if(ext.equals("jpeg") || ext.equals("jpg") || ext.equals("jfif") || ext.equals("jpe")){
fileFormat="image/jpeg";
}else if(ext.equals("png")){
fileFormat="image/png";
}else if(ext.equals("tiff") || ext.equals("tif")){
fileFormat="image/tiff";
}else if(ext.equals("pdf")){
fileFormat="application/pdf";
}
return fileFormat;
}