-
1. Re: RichFaces 4 - fileUpload; CDI- Conversation scope
lfryc Oct 31, 2011 10:42 AM (in response to kem)Hello Khalil,
I think it can be caused by UploadedFile not being Serializable,
it can help to wrap the data you have received in listener and store them as Serializable (simply storing byte[] should help).
Please try that and let us know.
~ Lukas
-
2. Re: RichFaces 4 - fileUpload; CDI- Conversation scope
lfryc Oct 31, 2011 10:43 AM (in response to lfryc)For example in RichFaces Showcase:
UploadedImage is Serializable wrapper for UploadedFile data.
-
3. Re: RichFaces 4 - fileUpload; CDI- Conversation scope
kem Oct 31, 2011 11:46 AM (in response to lfryc)Hi Lukas,
first of all, it works fine with @ManagedBean and @SessionScoped.
The issue is related to CDI and @ConversationScoped.
tried with the example from the book (rf4 2nd). Just added @PostConstruct and PreDestroy methods.
Here is the source of the problem: each time the fileUpload.jsf is refreshed, a new conversation starts. It's apparently related to conversation propagation issue. Still I don't know how to fix it.
here is the log:
INFO: conversation started cid=1
INFO: conversation started cid=2
INFO: file uploaded
INFO: conversation started cid=3
//@ManagedBean
//@SessionScoped
@Named
@ConversationScoped
public class FileUploadBean implements Serializable {
private ArrayList<UploadedFile> files = new ArrayList<UploadedFile>();
@Inject
Conversation conversation;
Logger log = Logger.getAnonymousLogger();
public FileUploadBean() {
}
@PostConstruct
public void init() {
if (conversation.isTransient()) {
conversation.begin();
log.info("conversation started");
}
}
@PreDestroy
public void destroy() {
if (!conversation.isTransient()) {
conversation.end();
log.info("conversation ended");
}
}
....
}
Regards,
Khalil
-
4. Re: RichFaces 4 - fileUpload; CDI- Conversation scope
lfryc Oct 31, 2011 1:01 PM (in response to kem)Khalil, it would be great if you could provide sample for reproduction.
-
5. Re: RichFaces 4 - fileUpload; CDI- Conversation scope
kem Oct 31, 2011 1:29 PM (in response to lfryc)Hi Lukas,
here is FileUploadBean and view file. The example came from RF4 book
you can do the test as
@ManagedBean
@SessionScoped
OR
@Named
@ConversationScoped
to add something else ;-), the maxFilesQuantity in the view is not available!!
Regards,
Khalil
-
fileUpload.xhtml.zip 860 bytes
-
FileUploadBean.java.zip 788 bytes
-
-
6. Re: RichFaces 4 - fileUpload; CDI- Conversation scope
lfryc Nov 6, 2011 1:52 PM (in response to kem)Hi Khalil,
thanks for your sample!
Regrettably I didn't have time to look into this issue last few days,
could you please open issue in RichFaces issue tracker note details so we can schedule it appropriately?
Basically if FileUpload works with @SessionScoped and @ViewScoped, we need to make it work with @ConversationScope.
Thanks,
~ Lukas