【发布时间】:2019-01-14 04:25:32
【问题描述】:
我正在使用 Primefaces 在 JSF 中提供文件下载操作。我使用的代码是:
<p:commandButton id="xlsExport" value="Export XLS"
ajax="false"
onclick="PrimeFaces.monitorDownload(startPleaseWaitMonitor, stopPleaseWaitMonitor);">
<p:fileDownload value="#{SampleBean.XLSExport}" />
</p:commandButton>
SampleBean 有以下方法:
public StreamedContent getXLSExport() {
...
byte[] content = generator.generateXLS();
return new DefaultStreamedContent(new ByteArrayInputStream(content), "application/vnd.ms-excel", fileName, "UTF-8");
}
我在两台应用服务器上使用它——JBoss 和 Websphere。如果是 Websphere,我在导出时会在服务器日志中看到警告:
000000f5 SRTServletRes W com.ibm.ws.webcontainer.srt.SRTServletResponse setStatus 警告: 无法设置状态。响应已提交。
当我运行类似的方法但对于 CSV 导出时没有警告。对于 JBoss,也没有警告。
出现这种日志警告的原因可能是什么?
【问题讨论】:
-
CSV 的“类似”方法有效,那么 IS 有什么区别? “应用程序/vnd.ms-excel”与其他东西?
-
只是内容类型:application/csv
-
您使用的是哪个 WebSphere 版本?
-
我在 WAS 9.0
标签: jsf primefaces websphere