You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Oscar Reitsma (JIRA)" <de...@myfaces.apache.org> on 2007/11/12 09:23:50 UTC
[jira] Created: (TRINIDAD-813) Downloading file and closing dialog
Downloading file and closing dialog
-----------------------------------
Key: TRINIDAD-813
URL: https://issues.apache.org/jira/browse/TRINIDAD-813
Project: MyFaces Trinidad
Issue Type: Bug
Components: Components
Affects Versions: 1.0.3-core
Environment: Windows XP, MyFaces 1.1.5, Jetty 6.1.5, Trinidad 1.0.3, JDK 1.5
Reporter: Oscar Reitsma
Priority: Minor
The required functionality is as follows:
- In a dialog, the user selects parameters report to be generated.
- The user clicks OK, and the report is generated, and a file download is initiated
- the dialog is closed
When using the below implementation, the following exception is thrown, when a call is made to:
RequestContext.getCurrentInstance().returnFromDialog(null, null);
Caused by: java.lang.IllegalStateException: STREAM
at org.mortbay.jetty.Response.getWriter(Response.java:583)
at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:122)
at org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit._getHtmlWriter(CoreRenderKit.java:744)
at org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit.returnFromDialog(CoreRenderKit.java:282)
at org.apache.myfaces.trinidadinternal.context.DialogServiceImpl.returnFromDialog(DialogServiceImpl.java:173)
at org.apache.myfaces.trinidadinternal.context.RequestContextImpl.returnFromDialog(RequestContextImpl.java:122)
implementation:
in the jspx of the dialog:
<tr:commandButton text="OK" action="#{reportSelection.actionProcessReports}" partialSubmit="false" >
<tr:fileDownloadActionListener method="#{reportSelection.downloadFile}"
contentType="#{reportSelection.contentType}" filename="#{reportSelection.reportFilename}"/>
</tr:commandButton>
The bean:
public void downloadFile(FacesContext context, OutputStream out) throws IOException {
// Here the report is generated, and written to the given OutputStream
downloadReport(selectedReport, out);
out.flush();
}
public String actionProcessReports() {
RequestContext.getCurrentInstance().returnFromDialog(null, null);
return "downloadComplete";
}
Using the above implementation the download of the report completes as expected, but the dialog is not closed.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.