Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-2375

<managed-bean-scope> could also be an EL expression, to allow easy implementation of new scopes

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.0-alpha
    • Component/s: JSR-314
    • Labels:
      None

      Description

      See jsf 2.0 spec section 5.3

      It seems we need to parse the string returned from managedBean.getManagedBeanScope(), but fortunately this problem is already solved in facelets (see TagAttributeImpl and org.apache.myfaces.view.facelets.el.ELText)

        Activity

        Hide
        lu4242 Leonardo Uribe added a comment -

        Thanks to Jakob Korherr for provide this patch

        Show
        lu4242 Leonardo Uribe added a comment - Thanks to Jakob Korherr for provide this patch
        Hide
        jakobkorherr Jakob Korherr added a comment -

        Here is my patch for this issue, including some test cases.

        The patch provides support for ValueExpressions in managed-bean-scope, it detects cyclic references in custom scopes (if ProjectStage != Production), it improves the detection of properties, which point to an object with a potentially shorter lifetime, by using a comparator and it also does this detection for managed-beans in custom scopes (if ProjectStage != Production).

        Show
        jakobkorherr Jakob Korherr added a comment - Here is my patch for this issue, including some test cases. The patch provides support for ValueExpressions in managed-bean-scope, it detects cyclic references in custom scopes (if ProjectStage != Production), it improves the detection of properties, which point to an object with a potentially shorter lifetime, by using a comparator and it also does this detection for managed-beans in custom scopes (if ProjectStage != Production).
        Hide
        mkienenb Mike Kienenberger added a comment -

        Well, it's a good question.
        At this point, it's probably worthwhile to take it it the dev list rather than discussing it in a jira.

        Show
        mkienenb Mike Kienenberger added a comment - Well, it's a good question. At this point, it's probably worthwhile to take it it the dev list rather than discussing it in a jira.
        Hide
        jakobkorherr Jakob Korherr added a comment -

        I have already thought of that, but the problem with this solution is, that you can configure a custom scope of for example #

        {myBean.scope}

        , which, of course, can be different every time you evaluate it.

        Show
        jakobkorherr Jakob Korherr added a comment - I have already thought of that, but the problem with this solution is, that you can configure a custom scope of for example # {myBean.scope} , which, of course, can be different every time you evaluate it.
        Hide
        mkienenb Mike Kienenberger added a comment -

        Can we change the behavior so that we only check it on startup or reconfiguration?
        Might require an additional set of code, but that seems like the correct approach rather than checking it every usage.

        Show
        mkienenb Mike Kienenberger added a comment - Can we change the behavior so that we only check it on startup or reconfiguration? Might require an additional set of code, but that seems like the correct approach rather than checking it every usage.
        Hide
        jakobkorherr Jakob Korherr added a comment -

        It is not really difficult, but the (little) performance issue happens every time a managed-bean instance is created. So not only at MyFaces startup. That's the problem!

        Show
        jakobkorherr Jakob Korherr added a comment - It is not really difficult, but the (little) performance issue happens every time a managed-bean instance is created. So not only at MyFaces startup. That's the problem!
        Hide
        mkienenb Mike Kienenberger added a comment -

        If it's easy to do, I'd say do it. It's only a performance issue on the initial startup, right?

        We have a precedent set on making MyFaces proactive on detecting error conditions in the configuration.

        Show
        mkienenb Mike Kienenberger added a comment - If it's easy to do, I'd say do it. It's only a performance issue on the initial startup, right? We have a precedent set on making MyFaces proactive on detecting error conditions in the configuration.
        Hide
        jakobkorherr Jakob Korherr added a comment -

        Should cyclic references be detected, or not?

        Scenario: Managed bean m1 has a custom scope #

        {m2.scope}

        and managed bean m2 has a custom scope #

        {m1.scope}

        .
        In this scenario you will get a StackOverflowException when trying to create one of the two managed beans.

        RI really ends in a StackOverflowException, should MyFaces end in such a Exception too or detect the cyclic reference and throw a ELException?

        Show
        jakobkorherr Jakob Korherr added a comment - Should cyclic references be detected, or not? Scenario: Managed bean m1 has a custom scope # {m2.scope} and managed bean m2 has a custom scope # {m1.scope} . In this scenario you will get a StackOverflowException when trying to create one of the two managed beans. RI really ends in a StackOverflowException, should MyFaces end in such a Exception too or detect the cyclic reference and throw a ELException?

          People

          • Assignee:
            lu4242 Leonardo Uribe
            Reporter:
            lu4242 Leonardo Uribe
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development