Thanks for the review Martin. I agree that the persistence mechanism for managed beans was already working OK. i.e. when a managed bean has scope "none" it was not persisted in a scope. But the problem I encountered was that the CompositeELResolver was not able to resolve managed beans with scope "none". Managed beans with scope "request", "session", or "application" could be resolved because after ManagedBeanResolver creates the bean it persists it in a scope, returns null, and then relies on ScopedAttributeResolver to resolve it further down the call stack. But when scope is "none" persisting the bean in scope was a no-op, so the exchange between ManagedBeanResolver and ScopedAttributeResolver didn't end up resolving the bean for CompositeELResolver.

The second change allows ManagedBeanResolver.getValue() to go ahead and return the managed bean immediately instead of returning null. The first change (removing "none" from s_standardScopes) was really just clean up since that code won't be used.

Best wishes,
Paul

On Apr 18, 2007, at 5:13 PM, Martin Marinschek wrote:

Hi Paul,

if you do the first change (introduce a scope where put does nothing),
I don't see why the second one needs to be done - putting will do
nothing, so you don't need the extra-check for none, right?

regards,

Martin

On 4/18/07, Paul McMahan <[EMAIL PROTECTED]> wrote:
Just wanted to invite some peer review for this change I just
committed for MYFACES-1588.  The problem was that managed beans in
scope "none" weren't accessible via the resolver.  The change I made
passes the test cases but there might be a more elegant way to
implement it.

Also, I have an update for the ValueBindingImplCactus.java test case
to check for this bug (looked like a good place for it) but I
couldn't figure out how to run cactus from maven.  Does that work OK
and if so can anyone provide tips on how to execute?

Best wishes,
Paul

On Apr 18, 2007, at 4:53 PM, [EMAIL PROTECTED] wrote:

> Author: pmcmahan
> Date: Wed Apr 18 13:53:26 2007
> New Revision: 530154
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=530154
> Log:
> MYFACES-1588 resolve managed beans in scope "none"
>
> Modified:
>     myfaces/core/branches/jsf12/impl/src/main/java/org/apache/
> myfaces/el/unified/resolver/ManagedBeanResolver.java
>
> Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/ apache/
> myfaces/el/unified/resolver/ManagedBeanResolver.java
> URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/
> src/main/java/org/apache/myfaces/el/unified/resolver/
> ManagedBeanResolver.java?view=diff&rev=530154&r1=530153&r2=530154
> ===================================================================== =
> ========
> --- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/
> myfaces/el/unified/resolver/ManagedBeanResolver.java (original)
> +++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/
> myfaces/el/unified/resolver/ManagedBeanResolver.java Wed Apr 18
> 13:53:26 2007
> @@ -74,15 +74,6 @@
>                      extContext.getApplicationMap().put(name, obj);
>                  }
>              });
> -        s_standardScopes.put(
> -            "none",
> -            new Scope()
> -            {
> -                public void put(ExternalContext extContext, String
> name, Object obj)
> -                {
> -                    // do nothing
> -                }
> -            });
>      }
>
>      /**
> @@ -156,8 +147,13 @@
>
>          ManagedBean managedBean = runtimeConfig
> (context).getManagedBean(strProperty);
>          if (managedBean != null) {
> -            storeManagedBean(managedBean, facesContext(context));
> +            FacesContext facesContext = facesContext(context);
>              context.setPropertyResolved(true);
> + if ("none".equals(managedBean.getManagedBeanScope ())) {
> +                return beanBuilder.buildManagedBean(facesContext,
> managedBean);
> +            } else {
> +                storeManagedBean(managedBean, facesContext);
> +            }
>          }
>
>          return null;
>
>




--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces


Reply via email to