Bom dia,
Tenho o seguinte cenário.
Estou com problemas em renderizar imagens provenientes de um serviço dentro de um Datatatble JSF. Os outros dados são carregados corretamente. Já fiz várias pesquisas em Sites e não encontrei a solução.
Debuguei o código e recebo org.primefaces.model.DefaultStreamedContent@2f666ebb - o endereço do objeto StreamedContent sem erros.
Alguém com o mesmo problema?
1. // Meu metodo pra gerar a imagem
2. public StreamedContent getImage() {
3. FacesContext context = FacesContext.getCurrentInstance();
4. if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
5. return new DefaultStreamedContent();
6. }
7. else {
8. String identificador =
context.getExternalContext().getRequestParameterMap().get("identificador");
9. PostoGraduacao postoGraduacaoMB =
10. service.postoGraduacaoConsumer(Long.valueOf(identificador));
11.
12. byte [] bites = postoGraduacaoMB.getInsignia().getBytes();
13.
image = new DefaultStreamedContent(new ByteArrayInputStream(bites));
14. }
15.
16. return image;
17. }
19. // Minha coluna no Datatable
20. <p:column headerText="INSIGNIA">
21. <p:graphicImage value="#{postoGraduacaoMB.image}" cache ="false">
22. <f:param name="fab" value="#{fab.identificador}"/>
23. </p:graphicImage>.
</p:column>