2

I have CDI Conversation scoped bean which has field of type StreamedContent (this content should be previewed with Primefaces Extension documentViewer).

Conversation is declared long-running before redirection to the page with documentViewer

I put loggers in getContent() method (CDI bean instance, conversation, and content are logged)

getContent() method is being called 3 times, 2 times in the same bean instance, conversation has id, and content has value. the third time it is new bean instance, conversation id is null, content is null... and documentViewer shows "Missing PDF file".

If I set bean to be session scoped all 3 getContent() calls logged the same insance of bean, same conversation ID and PDF is previewed on the page.

Is it possible to achieve this with conversation scope??

Primefaces extension version: 6.2.8

SMilos
  • 261
  • 2
  • 6
  • Hi, [mcve] please, as requested in [ask] otherwise it is next to impossible to help – Kukeltje Sep 20 '18 at 15:04
  • This should be possible but like @Kukeltje said I need a small reproducible sample to see the problem to debug it. You can clone this project https://github.com/primefaces/primefaces-test to create the MVCE requested. – Melloware Sep 21 '18 at 11:08
  • Might be that an omnifaces `o:form` instead of an h:form already solves your problem and that it is the only solution then – Kukeltje Sep 21 '18 at 11:37
  • I tried with omnifaces version 2.7 and no luck. I will make simple example and attach it here – SMilos Sep 24 '18 at 08:15
  • Hi, here is simple example github.com/milos993/primefaces-test test.xhtml is welcome page. it has button that redirects to PDFView.xhtml page. CdiBean is conversationScoped CDI bean. Pay attention to getPdf() method it writes to console instance of content and CdiBean. If you read console after PDFView.xhtml is shown you will see that getPdf() is called 3 times (third time content is null and it is in new CdiBean instance). If scope is changed to Session, getter is called 3 times too but in same instance of CdiBean. – SMilos Sep 25 '18 at 06:47

0 Answers0