4 Replies Latest reply on May 9, 2011 9:33 AM by iga3k

    KeepAlive comportment change between 2.0.0.ALPHA and 2.0.0.BETA

      Hi,

       

      I used portletbridge 2.0.0.ALPHA and beans in scope request with anotation @KeepAlive and @ExcludeFromManagedRequestScope.

       

      With this version, when I refreshed my portal page, my beans were recreated from scratch, but when I made an action or an ajax request, the beans were well keep alive.

       

      This behaviour well suit my need.

       

      But with the new bridge version, when I refresh my portal page, my beans are restored as if they don't use @ExcludeFromManagedRequestScope.

       

      What is the right behaviour and how can I get the old one with the new bridge version. I must precise that using @KeepAlive(ajaxonly=true) doesn't suit my need.

       

      Thanks in advance.

        • 1. Re: KeepAlive comportment change between 2.0.0.ALPHA and 2.0.0.BETA
          wesleyhales

          Can you give me some debugging information?

          • Are they the exact same projects, only switching the bridge jars to a newer version?
          • Do you see anything in the logs?
          • Can you create a jira with an example project if you cannot find the problem?

           

          Thanks!

          • 2. Re: KeepAlive comportment change between 2.0.0.ALPHA and 2.0.0.BETA

            Thanks for your answer !

             

            • Yes, it's exactly the same project, I only change the bridge version
            • I don't know what to look after in log, but there isn't any exception
            • I don't create any JIRA because I'm not sure this is a bug ... I don't know which behaviour is the good one.

             

            I attach a sample project to reproduce this.

            I made a little table with the differents cases :

             

             

            Expected
            page reloadajax requeststandard requestredirect
            standard   beanrestoredrecreatedrecreatedrecreated
            excluded beanrecreatedrecreatedrecreatedrecreated
            keepalive beanrestoredrestoredrestoredrecreated
            keepalive and excluded beanrecreatedrestoredrestoredrecreated
            bridge   2.0.0.ALPHA
            page reloadajax requeststandard requestredirect
            standard   beanrestoredrecreatedrecreatedrecreated
            excluded beanrecreatedrecreatedrecreatedrecreated
            keepalive beanrestoredrestoredrestoredrecreated
            keepalive and excluded beanrecreatedrestoredrecreatedrecreated
            bridge   2.0.0.BETA
            page reloadajax requeststandard requestredirect
            standard   beanrestoredrecreatedrecreatedrecreated
            excluded beanrecreatedrecreatedrecreatedrecreated
            keepalive beanrestoredrestoredrestoredrecreated
            keepalive and excluded beanrestoredrestoredrecreatedrecreated

             

            Are you agree with what is expected ?

             

            To be honest I think I'm a little lost about what behaviour we must expected in a portal.

             

            My use case is to make wizard and perhaps I need something else than keepalive and excluded feature... the fact is that when the user change portal page, I want my portlet to be refresh as if user never use it before ... how can I do that ?

             

            I don't know if my explanation is clear enough, please feel free to ask me more questions !

             

            Thanks !

            • 3. Re: KeepAlive comportment change between 2.0.0.ALPHA and 2.0.0.BETA

              Hi,

               

              Nobody have an answer to my question ...What is the right behavour for keepAlive and excluded ?

              How can I do to refresh a bean only when the user changed the portal page ?

               

              Please let me know if you need more elements !

               

              Thanks !

              • 4. Re: KeepAlive comportment change between 2.0.0.ALPHA and 2.0.0.BETA
                iga3k

                Did you get an answert to your problem? I am in the same situation. I need to reset the status of a bean after leaving the pace. I tryed to use this code to remove the keepAlive beans but it is not working. When I'm getting back to the initial page, it is still filled with the old data.

                public static final void clearKeepAlive() {
                          FacesContext fc = FacesContext.getCurrentInstance();
                          for (String key: new ArrayList<String>(fc.getViewRoot().getAttributes().keySet())) {
                                    if (key.startsWith(AjaxPhaseListener.VIEW_BEAN_PREFIX)
                                                        || key.startsWith(AjaxPhaseListener.AJAX_BEAN_PREFIX)) {
                                              fc.getViewRoot().getAttributes().remove(key);
                                    }
                          }
                }