[jira] Created: (MYFACES-2399) ManagedBeanResolver does not handle view scope

View: New views
14 Messages — Rating Filter:   Alert me  

[jira] Created: (MYFACES-2399) ManagedBeanResolver does not handle view scope

by My Faces - Dev mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ManagedBeanResolver does not handle view scope
----------------------------------------------

                 Key: MYFACES-2399
                 URL: https://issues.apache.org/jira/browse/MYFACES-2399
             Project: MyFaces Core
          Issue Type: Task
          Components: JSR-314
    Affects Versions: 2.0.0-alpha
            Reporter: Jakob Korherr


Testing the mojarra-example "custom-tag", I ran into the following Exception:

06.11.2009 12:29:18 org.apache.myfaces.el.unified.resolver.ManagedBeanResolver putInScope
SCHWERWIEGEND: Managed bean 'data' has illegal scope: view

The managed bean "data" is annotated with @ViewScoped, but the ManagedBeanResolver does not know this scope.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MYFACES-2399) ManagedBeanResolver does not handle view scope

by My Faces - Dev mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/MYFACES-2399?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Korherr updated MYFACES-2399:
-----------------------------------

    Status: Patch Available  (was: Open)

> ManagedBeanResolver does not handle view scope
> ----------------------------------------------
>
>                 Key: MYFACES-2399
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2399
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>         Attachments: view_scope.patch
>
>
> Testing the mojarra-example "custom-tag", I ran into the following Exception:
> 06.11.2009 12:29:18 org.apache.myfaces.el.unified.resolver.ManagedBeanResolver putInScope
> SCHWERWIEGEND: Managed bean 'data' has illegal scope: view
> The managed bean "data" is annotated with @ViewScoped, but the ManagedBeanResolver does not know this scope.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2399) ManagedBeanResolver does not handle view scope

by My Faces - Dev mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/MYFACES-2399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12775122#action_12775122 ]

Jakob Korherr commented on MYFACES-2399:
----------------------------------------

I just realized that we also have to implement the reference checking mechanism (a bean cannot reference an object with a potentially shorter lifetime) for the view scope. I will provide a patch for that soon.

> ManagedBeanResolver does not handle view scope
> ----------------------------------------------
>
>                 Key: MYFACES-2399
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2399
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>         Attachments: view_scope.patch
>
>
> Testing the mojarra-example "custom-tag", I ran into the following Exception:
> 06.11.2009 12:29:18 org.apache.myfaces.el.unified.resolver.ManagedBeanResolver putInScope
> SCHWERWIEGEND: Managed bean 'data' has illegal scope: view
> The managed bean "data" is annotated with @ViewScoped, but the ManagedBeanResolver does not know this scope.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MYFACES-2399) ManagedBeanResolver does not handle view scope

by My Faces - Dev mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/MYFACES-2399?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Korherr updated MYFACES-2399:
-----------------------------------

    Status: Open  (was: Patch Available)

> ManagedBeanResolver does not handle view scope
> ----------------------------------------------
>
>                 Key: MYFACES-2399
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2399
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>         Attachments: view_scope.patch
>
>
> Testing the mojarra-example "custom-tag", I ran into the following Exception:
> 06.11.2009 12:29:18 org.apache.myfaces.el.unified.resolver.ManagedBeanResolver putInScope
> SCHWERWIEGEND: Managed bean 'data' has illegal scope: view
> The managed bean "data" is annotated with @ViewScoped, but the ManagedBeanResolver does not know this scope.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2399) ManagedBeanResolver does not handle view scope

by My Faces - Dev mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/MYFACES-2399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776712#action_12776712 ]

Jakob Korherr commented on MYFACES-2399:
----------------------------------------

I just finished implementing the view scope and I ran into an interesting NotSerializableException while testing:

Caused by: java.lang.NullPointerException
        at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.restoreView(DefaultFaceletsStateManagementStrategy.java:174)
        at org.apache.myfaces.application.jsp.JspStateManagerImpl.restoreView(JspStateManagerImpl.java:388)
        at org.apache.myfaces.view.ViewDeclarationLanguageBase.restoreView(ViewDeclarationLanguageBase.java:106)
        at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.restoreView(FaceletViewDeclarationLanguage.java:927)
        at org.apache.myfaces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:231)
        at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:106)
        at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:129)
        at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:85)
        at javax.faces.webapp.FacesServlet._handleStandardRequest(FacesServlet.java:448)
        ... 13 more

And here's why: UIViewRoot uses a inner class ViewScope which extends HashMap to publish the PreDestroyViewMapEvent, when clear is called. The problem is, if you want to serialize an object of an inner class, the enclosing class also needs to be serialized. The enclosing class is UIViewRoot, which is not serializable and we don't want it to be serializable, I think.

So I'll change it to a static nested class.


> ManagedBeanResolver does not handle view scope
> ----------------------------------------------
>
>                 Key: MYFACES-2399
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2399
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>         Attachments: view_scope.patch
>
>
> Testing the mojarra-example "custom-tag", I ran into the following Exception:
> 06.11.2009 12:29:18 org.apache.myfaces.el.unified.resolver.ManagedBeanResolver putInScope
> SCHWERWIEGEND: Managed bean 'data' has illegal scope: view
> The managed bean "data" is annotated with @ViewScoped, but the ManagedBeanResolver does not know this scope.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MYFACES-2399) ManagedBeanResolver does not handle view scope

by My Faces - Dev mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/MYFACES-2399?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Korherr updated MYFACES-2399:
-----------------------------------

    Status: Patch Available  (was: Open)

> ManagedBeanResolver does not handle view scope
> ----------------------------------------------
>
>                 Key: MYFACES-2399
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2399
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>         Attachments: view_scope.patch, view_scope_newest.patch
>
>
> Testing the mojarra-example "custom-tag", I ran into the following Exception:
> 06.11.2009 12:29:18 org.apache.myfaces.el.unified.resolver.ManagedBeanResolver putInScope
> SCHWERWIEGEND: Managed bean 'data' has illegal scope: view
> The managed bean "data" is annotated with @ViewScoped, but the ManagedBeanResolver does not know this scope.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2399) ManagedBeanResolver does not handle view scope

by My Faces - Dev mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/MYFACES-2399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777161#action_12777161 ]

Leonardo Uribe commented on MYFACES-2399:
-----------------------------------------

I have checked the patch and there is only one question: Why use transient vars to save facesContext and viewRoot on UIViewRoot.ViewScope?. I think it is more clean to use FacesContext.getCurrentInstance() and facesContext.getViewRoot() to obtain this two values, because it prevents the workaround on UIViewRoot.restoreState.

> ManagedBeanResolver does not handle view scope
> ----------------------------------------------
>
>                 Key: MYFACES-2399
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2399
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>         Attachments: view_scope.patch, view_scope_newest.patch
>
>
> Testing the mojarra-example "custom-tag", I ran into the following Exception:
> 06.11.2009 12:29:18 org.apache.myfaces.el.unified.resolver.ManagedBeanResolver putInScope
> SCHWERWIEGEND: Managed bean 'data' has illegal scope: view
> The managed bean "data" is annotated with @ViewScoped, but the ManagedBeanResolver does not know this scope.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2399) ManagedBeanResolver does not handle view scope

by My Faces - Dev mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/MYFACES-2399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777191#action_12777191 ]

Jakob Korherr commented on MYFACES-2399:
----------------------------------------

But can we be sure that we get the right UIViewRoot instance with this way? What if someone stored a reference to another UIViewRoot in a managed bean and than calls getViewMap().clear()? In such a scenario we would provide a wrong instance of UIViewRoot, ain't we?

However, FacesContext.getCurrentInstance() can/could be used.

> ManagedBeanResolver does not handle view scope
> ----------------------------------------------
>
>                 Key: MYFACES-2399
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2399
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>         Attachments: view_scope.patch, view_scope_newest.patch
>
>
> Testing the mojarra-example "custom-tag", I ran into the following Exception:
> 06.11.2009 12:29:18 org.apache.myfaces.el.unified.resolver.ManagedBeanResolver putInScope
> SCHWERWIEGEND: Managed bean 'data' has illegal scope: view
> The managed bean "data" is annotated with @ViewScoped, but the ManagedBeanResolver does not know this scope.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2399) ManagedBeanResolver does not handle view scope

by My Faces - Dev mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/MYFACES-2399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777215#action_12777215 ]

Leonardo Uribe commented on MYFACES-2399:
-----------------------------------------

Look the code on FacesContextImpl.setViewRoot(). This method is the one that calls clear() and trigger the event publishing. I don't see a valid case why store a UIViewRoot in a managed bean. I think we can assume clear  method is only called from FacesContextImpl.setViewRoot().

> ManagedBeanResolver does not handle view scope
> ----------------------------------------------
>
>                 Key: MYFACES-2399
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2399
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>         Attachments: view_scope.patch, view_scope_newest.patch
>
>
> Testing the mojarra-example "custom-tag", I ran into the following Exception:
> 06.11.2009 12:29:18 org.apache.myfaces.el.unified.resolver.ManagedBeanResolver putInScope
> SCHWERWIEGEND: Managed bean 'data' has illegal scope: view
> The managed bean "data" is annotated with @ViewScoped, but the ManagedBeanResolver does not know this scope.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2399) ManagedBeanResolver does not handle view scope

by My Faces - Dev mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/MYFACES-2399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777235#action_12777235 ]

Jakob Korherr commented on MYFACES-2399:
----------------------------------------

I also don't see a valid case for that, but maybe there is one.

Besides that: Shouldn't we also check the remove() method of the HashMap in ViewScope to invoke the @PreDestroy method of a managed bean that is removed by this method, but not with clear()? Then we would also need FacesContext and UIViewRoot.
Every other scope listenes on removing of specified objects as well as destroying the whole scope (look at MyFacesSessonAttributeListener for example).

> ManagedBeanResolver does not handle view scope
> ----------------------------------------------
>
>                 Key: MYFACES-2399
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2399
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>         Attachments: view_scope.patch, view_scope_newest.patch
>
>
> Testing the mojarra-example "custom-tag", I ran into the following Exception:
> 06.11.2009 12:29:18 org.apache.myfaces.el.unified.resolver.ManagedBeanResolver putInScope
> SCHWERWIEGEND: Managed bean 'data' has illegal scope: view
> The managed bean "data" is annotated with @ViewScoped, but the ManagedBeanResolver does not know this scope.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2399) ManagedBeanResolver does not handle view scope

by My Faces - Dev mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/MYFACES-2399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777242#action_12777242 ]

Leonardo Uribe commented on MYFACES-2399:
-----------------------------------------

PreDestroyViewMapEvent is triggered when the view "expires". If you remove all elements from the view scope does not means the view hasn't expired. Note that this event is only triggered if the view scope has been created.

> ManagedBeanResolver does not handle view scope
> ----------------------------------------------
>
>                 Key: MYFACES-2399
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2399
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>         Attachments: view_scope.patch, view_scope_newest.patch
>
>
> Testing the mojarra-example "custom-tag", I ran into the following Exception:
> 06.11.2009 12:29:18 org.apache.myfaces.el.unified.resolver.ManagedBeanResolver putInScope
> SCHWERWIEGEND: Managed bean 'data' has illegal scope: view
> The managed bean "data" is annotated with @ViewScoped, but the ManagedBeanResolver does not know this scope.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2399) ManagedBeanResolver does not handle view scope

by My Faces - Dev mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/MYFACES-2399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777450#action_12777450 ]

Jakob Korherr commented on MYFACES-2399:
----------------------------------------

That's clear, but when we create a ViewScoped managed bean, its @PostConstruct method will be called. If we remove it from the viewmap afterwards, its @PreDestroy method will never be called, because PreDestroyViewMapEvent invokes @PreDestroy only on managed beans, which still exist in the viewmap. Isn't this a problem?

> ManagedBeanResolver does not handle view scope
> ----------------------------------------------
>
>                 Key: MYFACES-2399
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2399
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>         Attachments: view_scope.patch, view_scope_newest.patch
>
>
> Testing the mojarra-example "custom-tag", I ran into the following Exception:
> 06.11.2009 12:29:18 org.apache.myfaces.el.unified.resolver.ManagedBeanResolver putInScope
> SCHWERWIEGEND: Managed bean 'data' has illegal scope: view
> The managed bean "data" is annotated with @ViewScoped, but the ManagedBeanResolver does not know this scope.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2399) ManagedBeanResolver does not handle view scope

by My Faces - Dev mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/MYFACES-2399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777459#action_12777459 ]

Jakob Korherr commented on MYFACES-2399:
----------------------------------------

I looked it up in the spec and it says: @PreDestroy must only be called, when the view scope is destroyed.

So you're right, Leonardo! I'll alter the patch to use FacesContext.getCurrentInstance() and facesContext.getViewRoot(). Thanks for the discussion.

> ManagedBeanResolver does not handle view scope
> ----------------------------------------------
>
>                 Key: MYFACES-2399
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2399
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>         Attachments: view_scope.patch, view_scope_newest.patch
>
>
> Testing the mojarra-example "custom-tag", I ran into the following Exception:
> 06.11.2009 12:29:18 org.apache.myfaces.el.unified.resolver.ManagedBeanResolver putInScope
> SCHWERWIEGEND: Managed bean 'data' has illegal scope: view
> The managed bean "data" is annotated with @ViewScoped, but the ManagedBeanResolver does not know this scope.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MYFACES-2399) ManagedBeanResolver does not handle view scope

by My Faces - Dev mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/MYFACES-2399?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leonardo Uribe updated MYFACES-2399:
------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0-alpha
         Assignee: Leonardo Uribe
           Status: Resolved  (was: Patch Available)

Thanks to Jakob Korherr for this patch

> ManagedBeanResolver does not handle view scope
> ----------------------------------------------
>
>                 Key: MYFACES-2399
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2399
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.0-alpha
>
>         Attachments: view_scope.patch, view_scope_newest.patch, view_scope_newest_no_transient.patch
>
>
> Testing the mojarra-example "custom-tag", I ran into the following Exception:
> 06.11.2009 12:29:18 org.apache.myfaces.el.unified.resolver.ManagedBeanResolver putInScope
> SCHWERWIEGEND: Managed bean 'data' has illegal scope: view
> The managed bean "data" is annotated with @ViewScoped, but the ManagedBeanResolver does not know this scope.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.