file_content.jsp
资源名称:NetOffice.rar [点击查看]
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:3k
源码类别:
电子政务应用
开发平台:
Java
- <%@ page import="com.vnex.intranet.upload.*"%>
- <%@ page import="com.vnex.intranet.system.loader.ConfigParaLoader"%>
- <jsp:useBean id="myUpload" scope="page" class="com.vnex.intranet.upload.SmartUpload"/>
- <%@ page import="java.io.InputStream" %>
- <%@ page import="com.vnex.intranet.directory.proxy.DirectoryProxyBean" %>
- <%@ page import="com.vnex.intranet.directory.value.*" %>
- <%@ page import="com.vnex.intranet.util.*" %>
- <jsp:useBean id="dPermissionProxy" class="com.vnex.intranet.directory.proxy.DirectoryPermissionProxyBean" scope="application"/>
- <jsp:useBean id="BusinessName" class="com.vnex.intranet.pub.BusinessSession" scope="session"/>
- <jsp:useBean id="dProxy" class="com.vnex.intranet.directory.proxy.DirectoryProxyBean" scope="application" /><%
- int id = Integer.parseInt(request.getParameter("id"));
- int empId = BusinessName.getEmpId();
- if ( !dPermissionProxy.haveDirectoryReadRight(id,empId) ){
- response.sendRedirect("/mainctrl/directory/file_deny?id="+id+"&type=read");
- return;
- }
- FileValueBean finfo = (FileValueBean)dProxy.getSimpleDirectoryInfo(id);
- if ( finfo.getStorageType() == FileValueBean.STORAGE_FILE)
- {
- //add by yuduan.
- String str = finfo.getLocation();
- System.out.println("location: " + str);
- int s = str.lastIndexOf("/");
- System.out.println("location1: " + s);
- System.out.println("location2: " + SubPathGenerater.getSeperator());
- String filename = str.substring(s+1);
- System.out.println("location1: " + filename);
- String UTFurl = str.substring(0,s+1)+StringUtil.encode(filename);
- System.out.println("location1: " + StringUtil.encode(filename));
- //add over by yuduan.
- response.sendRedirect(UTFurl);
- return;
- }
- if ( finfo.getStorageType() == FileValueBean.STORAGE_URL)
- {
- //add by yuduan.
- String str = finfo.getLocation();
- System.out.println("location: " + str);
- int s = str.lastIndexOf(SubPathGenerater.getSeperator());
- String filename = str.substring(s+1);
- String UTFurl = str.substring(0,s+1)+StringUtil.encode(filename);
- //add over by yuduan.
- response.sendRedirect(UTFurl);
- return;
- }
- // Initialization myUpload bean.
- myUpload.initialize(pageContext);
- byte[] b;
- String location = null;
- finfo = (FileValueBean)dProxy.getDirectoryInfo(id);
- if (finfo != null)
- {
- location = finfo.getLocation();
- System.out.println("location: " + location);
- b = finfo.getFileContent();
- if ( b != null)
- {
- System.out.println("file size: " + b.length);
- myUpload.downloadBytes(b,null,location);
- }else
- {
- response.sendRedirect("/mainctrl/error/DefaultError");
- }
- }
- else
- {
- System.out.println("finfo is null");
- response.sendRedirect("/mainctrl/home/index");
- }
- %>