6 Replies Latest reply on Nov 6, 2011 1:52 PM by Lukáš Fryč

    RichFaces 4 - fileUpload; CDI- Conversation scope

    kem Newbie

      Hi,

       

      fileUpload only works with SessionScope!

       

      in a conversation scope I got the following:

       

      1. During the upload file, a conversation start.
      2. the file is uploaded
      3. when I click on submit, the submit() method is called
      4. a new conversation starts
      5. the uploaded file is null.

       

      In a SessionScope, everything works fine.

       

      Does the fileUpload only works in a SessionScope?

       

      Thanks

       

       

      @Named

      @ConversationScoped

      public class UploadBean implements Serializable{

       

         private Logger log = LoggerFactory.getLogger(AnnotateBean.class);

       

         private UploadedFile uploadedFile;

        

         @Inject

         Conversation conversation;

       

         public UploadBean() {

         }

       

       

         @PostConstruct

         private void init() {

            if (conversation.isTransient()) {

               conversation.begin();

               log.debug("conversation started cid=" + conversation.getId());

            }

         }

       

       

         public void listner(FileUploadEvent event) throws IOException {

            this.uploadedFile = event.getUploadedFile();

         }

       

       

         public void submit() {

            log.debug("submit called for " + uploadedFile.getName());

         }

      }