Author: tandraschko
Date: Thu Feb 13 22:44:41 2014
New Revision: 1568078

URL: http://svn.apache.org/r1568078
Log:
added scopes prototype

Modified:
    deltaspike/site/trunk/content/jsf.mdtext

Modified: deltaspike/site/trunk/content/jsf.mdtext
URL: 
http://svn.apache.org/viewvc/deltaspike/site/trunk/content/jsf.mdtext?rev=1568078&r1=1568077&r2=1568078&view=diff
==============================================================================
--- deltaspike/site/trunk/content/jsf.mdtext (original)
+++ deltaspike/site/trunk/content/jsf.mdtext Thu Feb 13 22:44:41 2014
@@ -182,10 +182,49 @@ Don't forget to set the ClientWindowRend
 
 #Scopes (TODO)
 
-  - @WindowScoped
-  - @ViewAccessScoped
-  - @GroupedConversationScoped
-  - @ViewScoped
+## @WindowScoped
+The window-scope is like a session per window. That means that the data is 
bound to a window/tab and it not shared between windows (like the session scope 
does). Usually you need the window-scope instead of the session-scope. There 
aren't a lot of use-cases which need shared data between windows.
+
+    :::java
+    @WindowScoped
+    public class PreferencesBean implements Serializable
+    {
+        //...
+    }
+
+## @ViewAccessScoped
+In case of conversations you have to un-scope beans manually (or they we be 
terminated automatically after a timeout). However, sometimes you need beans 
with a lifetime which is as long as needed and as short as possible - which are 
terminated automatically (as soon as possible). In such an use-case you can use 
this scope. The simple rule is, as long as the bean is referenced by a page - 
the bean will be available for the next page (if it's used again the bean will 
be forwarded again). It is important that it's based on the view-id of a page 
(it isn't based on the request) so e.g. Ajax requests <b>don't</b> trigger a 
cleanup if the request doesn't access all view-access scoped beans of the page. 
That's also the reason for the name @*View*AccessScoped.
+
+    :::java
+    @ViewAccessScoped
+    public class WizardBean implements Serializable
+    {
+        //...
+    }
+
+Hint: <br/>
+@ViewAccessScoped beans are best used in conjunction with the `CLIENTWINDOW` 
window handling, which ensures a clean browser-tab separation without touching 
the old windowId. Otherwise a 'open in new tab' on a page with a 
@ViewAccessScoped bean might cause the termination (and re-initialization) of 
that bean.
+
+
+## @GroupedConversationScoped
+See <a href="#grouped-conversations">(Grouped-)Conversations</a>
+
+## @ViewScoped
+
+DeltaSpike provides an CDI context for the JSF 2.0/2.1 
@javax.faces.bean.ViewScoped. You can simply annotate your bean with 
@javax.faces.bean.ViewScoped and @Named.
+
+## JSF 2.0 Scopes
+
+JSF 2.0 introduced new annotations as well as a new scope - the View Scope. 
CODI allows to use all the CDI mechanisms in beans annotated with:
+
+  - javax.faces.bean.ApplicationScoped
+  - javax.faces.bean.SessionScoped
+  - javax.faces.bean.RequestScoped
+  - javax.faces.bean.ViewScoped
+
+Furthermore, the managed-bean annotation (javax.faces.bean.ManagedBean) is 
mapped to @Named from CDI.
+
+All these annotations are mapped automatically. So you won't face issues, if 
you import a JSF 2 annotation instead of the corresponding CDI annotation.
 
 # Type-safe View-Configs
 
@@ -1183,8 +1222,6 @@ Example - Implicit sub-group:
 
 In the listing above all beans which implement the Wizard interface will be 
closed as soon as you close the ImplicitSubGroup.
 
-#JSF ManagedBean to CDI mapping (TODO)
-
 #Converter & Validator Injection (TODO)
 
 #Event broadcasting (TODO)


Reply via email to