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
+ 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 閱讀(141)
評論(0) 編輯 收藏