Your browser does not support iframes
This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.
MyFaces CODI provides powerful scopes for JSF applications. The inspiration for most parts came from MyFaces Orchestra. If you already know MyFaces Orchestra you will be able to use the scopes provided by MyFaces CODI easily. Also the migration of existing applications shouldn't be that hard.
For users who aren't familiar with the conversation concepts provided by MyFaces Orchestra:
Orchestra allows to group beans within a (named) conversation. Furthermore, it's possible to use beans with different (conversation-) lifecycles in the same page. (Usually there isn't one big conversation - like the std. CDI conversation which is more like a bit smarter session for a window/tab.) Conversations are bound to a window/tab of a browser. That means you automatically get new conversations, if you open the application in a new tab/window. Conversations are started automatically as terminates as a conversation scoped bean is used. A conversation terminates based on a timeout (in case of the access scope - a conversation terminates as soon as it wasn't used by a page). Furthermore, it's possible to close (or restart) conversations manually. That means via an API call it's possible to terminate a conversation immediately. The next access leads to a new conversation. If the whole session gets destroyed, also all conversations will be destroyed automatically.
MyFaces CODI provides all these principles of MyFaces Orchestra in combination with typesafe improvements as well as the support of CDI mechanisms like qualifiers.
And why do we need new scopes? CDI already provides conversations. That's right and CDI is a great spec. and the EG did a nice job, however, (compared to the concepts of MyFaces Orchestra) CDI std. conversations are not that nice. So we saw the need to port a lot of the concepts provided by MyFaces Orchestra to CDI.
MyFaces CODI provides the following types of conversations:
As soon as you access the bean, the conversation gets started!
If you would like to use the bean within your JSF pages, you have to add
If you are using MyFaces CODI you don't need std. CDI conversations any more. So it might be a good idea to exclude
javax.enterprise.context.Conversation via IDE settings. If you are using those classes instead of the CODI classes, you will see different results.
@ConversationScoped means you are using a bean with a timeout (default: 30 minutes). As soon as a bean gets accessed, the bean is touched which leads to a reset of the timeout.
You can see the default values in:
If you don't like to close a conversation immediately, you will be able to terminate a conversation after the rendering process of the next view. This feature will be implemented soon. Currently you can use phase-observer-methods in combination with @View to do it manually.
The usage is exactly the same like
@ConversationScoped . The only difference is that there is no timeout.
You can compare it to a session per window. However, as we will see later on it's possible to reset the window-context manually.
The usage is exactly the same like
@ConversationScoped . The only difference is that there is no timeout. If you don't use
@ViewAccessScoped beans within a view, they won't be available any longer. That means: They get cleaned up automatically, as soon as you don't use them.
MyFaces Orchestra introduced conversation names to group conversation scoped beans. Instead of names MyFaces CODI provides a typesafe alternative: conversation groups. A conversation group is a marker class or interface. Behind the scenes
@ConversationGroup is a CDI qualifier which is treated in a special way. If you don't define a special group the class of the bean is used as conversation group. That means: every conversation scoped bean belongs to an explicit or implicit conversation group.
In case of
this.conversation.close(); the whole conversation of
ConversationGroup1 will be destroyed (in this case 2 beans).
If you would like to close all conversations of an other conversation-group, you can use the