if (actflag.equals("download")) {
saDoc= this.getDocumentAddService().execute(parentCode);
OutputStream out = servletResponse.getOutputStream();
String name = saDoc.getDocumentName();
String nameISO = new String(name.getBytes("gb2312"), "iso-8859-1");
// http
http://www.faqs.org/rfcs/rfc2183.html servletResponse.setHeader("Content-Disposition", "attachment; filename=\""
+ nameISO + "\"");
servletResponse.setHeader("Content-Length", String.valueOf(saDoc.getDocumentSize()));
//BLOB blob = (BLOB) domain.getInformationContent();
//InputStream in = blob.getBinaryStream();
String path=saDoc.getDocumentSrc();
path= path.replace('/','\\');
String url=servletRequest.getRealPath("
\\")+path+"\\"+saDoc.getDocumentName();
File file=new File(url);
InputStream in =new FileInputStream(file);
int count = 0;
try {
byte[] data = new byte[8192];
while ((count = in.read(data)) != -1) {
out.write(data, 0, count);
}
} finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
return null;
posted on 2007-04-17 13:46
NG 阅读(139)
评论(0) 编辑 收藏