[seam-issues] [JBoss JIRA] (SEAMFACES-185) Add support for activating beans based on the JSF project stage

Bernard Labno (Commented) (JIRA) jira-events at lists.jboss.org
Wed Dec 28 04:06:10 EST 2011


    [ https://issues.jboss.org/browse/SEAMFACES-185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12653195#comment-12653195 ] 

Bernard Labno commented on SEAMFACES-185:
-----------------------------------------

I've tried this cool feature, but can't make it work. I'm setting up the stage using JNDI (AS7.1.0.Beta1) with following entry in web.xml:
<resource-env-ref>
        <resource-env-ref-name>jsf/ProjectStage</resource-env-ref-name>
        <resource-env-ref-type>java.lang.String</resource-env-ref-type>
        <lookup-name>java:/jsf/ProjectStage</lookup-name>
    </resource-env-ref>
During bean processing by extension the java:comp/env/jsf/ProjectStage is not available, thus extension always thinks it's Production phase.
                
> Add support for activating beans based on the JSF project stage
> ---------------------------------------------------------------
>
>                 Key: SEAMFACES-185
>                 URL: https://issues.jboss.org/browse/SEAMFACES-185
>             Project: Seam Faces
>          Issue Type: Feature Request
>    Affects Versions: 3.0.2
>            Reporter: Christian Kaltepoth
>            Assignee: Christian Kaltepoth
>             Fix For: 3.1.0.Beta4
>
>
> Hey all,
> I think it would be a great enhancement if Seam Faces could support activation of beans only in specific JSF project stages. MyFaces CODI supports a similar feature with the {{@ProjectStageActivated}} annotation.
> Examples:
> {code}
> @ProductionStage
> @ApplicationScoped
> public class ProductionEntityManagerProducer {
>   ...
> }
> @DevelopmentStage
> @ApplicationScoped
> public class DevelopmentEntityManagerProducer {
>   ...
> }
> {code}
> Another very interesting usecase would be to enable specific interceptors/decorators only in development stage. This could be used for debugging stuff that is only interesting during development.
> I think this could be easily implenented using an CDI extension that vetos beans that do not match the active project stage. The only problem I'm seeing is that we will need the JSF project stage in an very early stage during application startup (actually before JSF started up). This means that we would have to determine the project stage JSF will use ourselves.
> The JSF spec describes that the project stage can either be set with a servlet context parameter or using JNDI. If the latter one is uses, we could simply do a JNDI lookup in the extension. No problem here. If the developer uses a servlet context parameter the situation will become more problematic, because we will need a reference to the ServletContext in the extension.
> What do you think of this feature? Would it be useful? Any further ideas for the implementation?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list