Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
PrimeFaces.monitorDownload not calling the stop function

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

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!