netdisk_mapping_getfile.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:6k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=gb2312"%>
  2. <%@page import="cn.js.fan.util.*"%>
  3. <%@page import="cn.js.fan.web.*"%>
  4. <%@page import="com.redmoon.oa.*"%>
  5. <%@page import="com.redmoon.oa.dept.*"%>
  6. <%@page import="com.redmoon.oa.netdisk.*"%>
  7. <%@page import="java.util.*"%>
  8. <%@page import="java.io.*"%>
  9. <%@page import="java.net.*"%>
  10. <jsp:useBean id="fchar" scope="page" class="cn.js.fan.util.StrUtil"/>
  11. <jsp:useBean id="fsecurity" scope="page" class="cn.js.fan.security.SecurityUtil"/>
  12. <%
  13. String fileName = ParamUtil.get(request, "fileName");
  14. String mappingAddress = ParamUtil.get(request, "mappingAddress");
  15. String ext = StrUtil.getFileExt(fileName);
  16. if (ext.equals("rm") || ext.equals("rmvb")) {
  17. %>
  18. <table width="100%" align="center"><tr><td align="center">
  19. <object ID="video1" CLASSID="clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" HEIGHT="300" WIDTH="400">
  20. <param name="_ExtentX" value="22304">
  21. <param name="_ExtentY" value="14288">
  22. <param name="AUTOSTART" value="-1">
  23. <param name="SHUFFLE" value="0">
  24. <param name="PREFETCH" value="0">
  25. <param name="NOLABELS" value="0">
  26. <param name="SRC" value="<%=mappingAddress%>">
  27. <param name="CONTROLS" value="ImageWindow">
  28. <param name="CONSOLE" value="Clip1">
  29. <param name="LOOP" value="0">
  30. <param name="NUMLOOP" value="0">
  31. <param name="CENTER" value="0">
  32. <param name="MAINTAINASPECT" value="0">
  33. <param name="BACKGROUNDCOLOR" value="#000000">
  34. </object>
  35. <object ID="video1" CLASSID="clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" HEIGHT="60" WIDTH="400">
  36. <param name="controls" value="ControlPanel,StatusBar">
  37. <param name="console" value="Clip1">
  38. <embed type="audio/x-pn-realaudio-plugin" CONSOLE="Clip1" CONTROLS="ControlPanel,StatusBar" HEIGHT="60" WIDTH="400" AUTOSTART="true"/>
  39. </object>
  40. </td></tr></table>
  41. <%
  42. } else if (ext.equals("wmv") || ext.equals("asf") || ext.equals("mp3") || ext.equals("mpeg") || ext.equals("wma") || ext.equals("mpg")) {
  43. %>
  44. <table width="100%" align="center"><tr><td align="center">
  45. <object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" id="MediaPlayer1" width="428" height="330">
  46.         <param name="AudioStream" value="-1">
  47.         <param name="AutoSize" value="0">
  48.         <param name="AutoStart" value="-1">
  49.         <param name="AnimationAtStart" value="-1">
  50.         <param name="AllowScan" value="-1">
  51.         <param name="AllowChangeDisplaySize" value="-1">
  52.         <param name="AutoRewind" value="0">
  53.         <param name="Balance" value="0">
  54.         <param name="BaseURL" value>
  55.         <param name="BufferingTime" value="5">
  56.         <param name="CaptioningID" value>
  57.         <param name="ClickToPlay" value="-1">
  58.         <param name="CursorType" value="0">
  59.         <param name="CurrentPosition" value="-1">
  60.         <param name="CurrentMarker" value="0">
  61.         <param name="DefaultFrame" value>
  62.         <param name="DisplayBackColor" value="0">
  63.         <param name="DisplayForeColor" value="16777215">
  64.         <param name="DisplayMode" value="0">
  65.         <param name="DisplaySize" value="2">
  66.         <param name="Enabled" value="-1">
  67.         <param name="EnableContextMenu" value="-1">
  68.         <param name="EnablePositionControls" value="-1">
  69.         <param name="EnableFullScreenControls" value="0">
  70.         <param name="EnableTracker" value="-1">
  71.         <param name="Filename" value="<%=mappingAddress%>">
  72.         <param name="InvokeURLs" value="-1">
  73.         <param name="Language" value="-1">
  74.         <param name="Mute" value="0">
  75.         <param name="PlayCount" value="1">
  76.         <param name="PreviewMode" value="0">
  77.         <param name="Rate" value="1">
  78.         <param name="SAMILang" value>
  79.         <param name="SAMIStyle" value>
  80.         <param name="SAMIFileName" value>
  81.         <param name="SelectionStart" value="-1">
  82.         <param name="SelectionEnd" value="-1">
  83.         <param name="SendOpenStateChangeEvents" value="-1">
  84.         <param name="SendWarningEvents" value="-1">
  85.         <param name="SendErrorEvents" value="-1">
  86.         <param name="SendKeyboardEvents" value="0">
  87.         <param name="SendMouseClickEvents" value="0">
  88.         <param name="SendMouseMoveEvents" value="0">
  89.         <param name="SendPlayStateChangeEvents" value="-1">
  90.         <param name="ShowCaptioning" value="0">
  91.         <param name="ShowControls" value="-1">
  92.         <param name="ShowAudioControls" value="-1">
  93.         <param name="ShowDisplay" value="0">
  94.         <param name="ShowGotoBar" value="0">
  95.         <param name="ShowPositionControls" value="-1">
  96.         <param name="ShowStatusBar" value="-1">
  97.         <param name="ShowTracker" value="-1">
  98.         <param name="TransparentAtStart" value="0">
  99.         <param name="VideoBorderWidth" value="0">
  100.         <param name="VideoBorderColor" value="0">
  101.         <param name="VideoBorder3D" value="0">
  102.         <param name="Volume" value="-40">
  103.         <param name="WindowlessVideo" value="0">
  104.       </object>
  105. </td></tr></table>   
  106. <%
  107. } else {
  108. // response.setContentType(MIMEMap.get(StrUtil.getFileExt(att.getDiskName())));
  109. response.setContentType(MIMEMap.get(ext));
  110. response.setHeader("Content-disposition","filename=" + StrUtil.GBToUnicode(fileName));
  111. // 以询问下载的方式打开,会覆盖父窗口
  112. // response.setContentType("application/octet-stream");
  113. // response.setHeader("Content-disposition","attachment; filename=" + StrUtil.GBToUnicode(att.getName()));
  114. BufferedInputStream bis = null;
  115. BufferedOutputStream bos = null;
  116. try {
  117. bis = new BufferedInputStream(new FileInputStream(mappingAddress));
  118. bos = new BufferedOutputStream(response.getOutputStream());
  119. byte[] buff = new byte[2048];
  120. int bytesRead;
  121. while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
  122. bos.write(buff,0,bytesRead);
  123. }
  124. } catch(final IOException e) {
  125. System.out.println( "IOException: " + e );
  126. } finally {
  127. if (bis != null)
  128. bis.close();
  129. if (bos != null)
  130. bos.close();
  131. }
  132. }
  133. %>