日期:2014-05-17  浏览次数:20682 次

struts2下载功能,为什么有些文件360浏览器不能下载?
用struts2开发了一个文件下载功能,IE,FIREFOX都可以,可是360就不能下载。显示错误
2014-1-28 10:20:31 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
严重: Can not find a java.io.InputStream with the name [fileInputStream] in the invocation stack. Check the <param name="inputName"> tag specified for this action.

struts2.xml:
<action name="muxz_action2" class="updownfiles.DownFilesAction" >
            <result name="success" type="stream">
                <!-- 下载文件类型定义 -->
                <param name="contentType">${mimeType}</param>
                <!-- 下载文件处理方法 -->
                <param name="contentDisposition">
                    attachment;filename="${downFileName}"
                </param>
                <!-- 下载文件输出流定义 getFileInputStream() -->
                <param name="inputName">fileInputStream</param>
                <param name="bufferSize">4096</param>
            </result>
     </action>


action:(我的文件存放在数据库里)
   public InputStream getFileInputStream() throws Exception {
return fileInputStream;
    }

    public String getMimeType() {
        return ServletActionContext.getServletContext().getMimeType(downFileName);
    }

    public String getDownFileName() {
        String FileName = downFileName;

        try {
         //对文件名转码, 不然在下载的时候文件名是乱码.
          if(ServletActionContext.getRequest().getHeader("USER-AGENT").toLowerCase().indexOf("msie") > 0 ? true : false){
           FileName = new String(FileName.getBytes("GBK"), "ISO-8859-1"); 
          }else{
           FileName = new String(FileName.getBytes("UTF-8"), "ISO-8859-1");  
          }
        } catch (UnsupportedEncodingException e) {

     &n