after porting my application from PF 8.0 to PF 11.0 with PrimeFaces.monitorDownload, the stop method is not called.
<h:form id="pdfExportForm">
<h:commandLink id="pdfExportLink" action="#{statisticsAdminController.exportPDF}" style="display: none;"
onclick="PrimeFaces.monitorDownload(showStatus, hideStatus);" />
<p:dialog modal="true" widgetVar="statusDialog" draggable="false" closable="false">
<p:graphicImage library="images" name="ajax-loader.gif" />
</p:dialog>
</h:form>
the exportPDF method calls the method that downloads the file
public static void downloadFile (
ByteArrayOutputStream baos
,FacesContext fctx
,String fileName
,String contentType
) throws IOException
{
ExternalContext ectx = fctx.getExternalContext();
OutputStream out = ectx.getResponseOutputStream();
ectx.responseReset();
ectx.setResponseContentType(contentType);
ectx.setResponseHeader("Expires", "0");
ectx.setResponseHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
ectx.setResponseHeader("Pragma", "public");
ectx.setResponseHeader("Content-disposition", "attachment;filename=" + fileName);
ectx.setResponseContentLength(baos.size());
ectx.addResponseCookie(Constants.DOWNLOAD_COOKIE, "true", Collections.<String, Object> emptyMap());
baos.writeTo(out);
fctx.responseComplete();
ectx.responseFlushBuffer();
out.close();
}
this code works fine with PF 8.0, but after porting to PF 11.0 I end up with a modal dialog that does not close after the download finishes. However the file gets downloaded.
Best Regards
Andrija