123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <%@page import="com.persistence.DBdll.SysOperator"%>
- <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
- <%@ page
- import = "com.sysmodel.datamodel.xmlmodel.ModelFactory"
- import = "com.sysmodel.datamodel.xmlmodel.able.SysModel"
- import = "com.persistence.service.SysPersistence"
- import = "com.persistence.service.PersistenceFactory"
- import = "javax.servlet.ServletOutputStream"
- import = "java.io.PrintWriter"
- import = "java.util.ArrayList"
- import = "com.sinosoft.common.upLoad.util.*"
- import = "com.sinosoft.common.upLoad.service.UploadManageable"
- import = "com.sinosoft.common.upLoad.service.UploadManageImpl"
- import = "java.net.URLDecoder"
- %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <%@page import="java.io.OutputStream"%>
- <%@page import="java.net.URLDecoder"%><html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta http-equiv="Content-Language" content="UTF-8" />
- </head>
- <body>
- <%
- response.setCharacterEncoding("UTF-8");
- String objectID = request.getParameter("objectID") == null ? "" : request.getParameter("objectID");
- //String classId = request.getParameter("classid") == null ? "" : request.getParameter("classid");
- String filename = request.getParameter("filename") == null ? "" : request.getParameter("filename");
- String downfilename = request.getParameter("downfilename") == null ? "" : request.getParameter("downfilename");
- //autopath=false 自己传入完整路径文件
- String autopath = request.getParameter("autopath") == null ? "" : request.getParameter("autopath");
- System.out.println(autopath+"====");
- if(filename.contains("/")){
- return;
- }
- //optmethod 文件处理方式
- //open 打开文件
- String optmethod = request.getParameter("optmethod") == null ? "" : request.getParameter("optmethod");
- filename = URLDecoder.decode(filename, "UTF-8");
- downfilename = URLDecoder.decode(downfilename, "UTF-8");
- String uploadType = request.getParameter("uploadType") == null ? "path" : "blob";
- //filename = new String(filename.getBytes("iso-8859-1"),"utf-8");
- response.reset();
- try {
- OutputStream sout = response.getOutputStream();
- //判断下载方式
- System.out.println(autopath);
- if (uploadType.equalsIgnoreCase("path")) {
- UploadManageable upload = new UploadManageImpl();
-
- if("false".equalsIgnoreCase(autopath.trim())){
- upload.downloadFile(request, response, filename, false, downfilename);
- }else{
- upload.downloadFile(request, response, filename, true, downfilename);
- }
- }else if (uploadType.equalsIgnoreCase("blob")){
- SysModel sysmodel = ModelFactory.getSysmodel();
- SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
- persistence.readBlobToOutputStream(110,objectID,"FileContents",sout);
- }
- out.clear();
- out = pageContext.pushBody();
- }catch (Exception e) {
- e.printStackTrace();
- }
- %>
- </body>
- </html>
|