Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

149
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda