2013-01-07 79 views
1

我有一個Struts動作,寫入HttpServletResponse如下。代碼僅適用於HTTP,但不適用於HTTPS。IE顯示通過HTTPS下載的「Windows無法找到https:// xxxxxxx」錯誤

BufferedInputStream in = null; 
try { 
    response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\";"); 
    // set response headers 
    response.setContentLength(fileData.length); 
    response.setContentType("application/octet-stream"); 

    //BUFFER 
    int bufferSize = 2 * 1024 * 1024; 
    in = new BufferedInputStream(new ByteArrayInputStream(fileData), bufferSize); 
    byte[] buffer = new byte[bufferSize]; 
    int len = 0; 

    // Loop through the input file and get the data chunks... 
    while ((len = in.read(buffer, 0, bufferSize)) != -1) { 
     response.getOutputStream().write(buffer, 0, len); 
    } 
} catch (Exception e) { 
    throw new SystemException(e.getMessage()); 
} finally { 
    response.getOutputStream().flush(); 
    response.getOutputStream().close(); 
} 

服務器是Weblogic 10(是否重要?)。除文件下載外,整個Web應用程序都可以使用HTTPS。 它適用於Chrome和FF,但不適用於IE 8/9。顯示在一個警告框

Windows無法找到以下消息的「https:// XXXXXXX」

+0

你是否在容器中啓用了SSL端口? (Tomcat或同等版本) – madth3

+0

是的,它在Weblogic 10上啓用,整個Web應用程序與HTTPS一起工作,除了下載部分。 – gpa

回答