deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject deltaspike git commit: DELTASPIKE-635 improved documentation
Date Sat, 20 Dec 2014 20:24:37 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master f99bad1a3 -> b779e9c81


DELTASPIKE-635 improved documentation


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/b779e9c8
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/b779e9c8
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/b779e9c8

Branch: refs/heads/master
Commit: b779e9c814f9bd0ad7ce5f1b75f7ca7e15b37d17
Parents: f99bad1
Author: gpetracek <gpetracek@apache.org>
Authored: Sat Dec 20 20:34:57 2014 +0100
Committer: gpetracek <gpetracek@apache.org>
Committed: Sat Dec 20 21:22:30 2014 +0100

----------------------------------------------------------------------
 documentation/src/main/asciidoc/jsf.adoc | 92 +++++++++++++++++++++++----
 1 file changed, 81 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/b779e9c8/documentation/src/main/asciidoc/jsf.adoc
----------------------------------------------------------------------
diff --git a/documentation/src/main/asciidoc/jsf.adoc b/documentation/src/main/asciidoc/jsf.adoc
index 97ed3ae..4026fa6 100644
--- a/documentation/src/main/asciidoc/jsf.adoc
+++ b/documentation/src/main/asciidoc/jsf.adoc
@@ -1167,10 +1167,6 @@ However, in case of JSF you have to ensure that you are at a valid
point
 in the JSF request-lifecycle for a navigation, because invocation gets
 transformed to a standard (implicit) JSF navigation.
 
-===== Using @Matches
-
-This annotation is currently not integrated. [TODO]
-
 ===== Using ViewConfigResolver
 
 If you would like to query view-meta-data yourself (for whatever
@@ -1228,8 +1224,6 @@ configured (view-)meta-data and get and/or execute configured callbacks.
 
 ==== Advanced API Usages
 
-[TODO]
-
 ===== Creating Custom Meta-Data via @ViewMetaData
 
 This meta-annotation allows to create custom view-meta-data which can be
@@ -1376,8 +1370,6 @@ which restricts
 
 ==== View-Config SPI
 
-[TODO]
-
 ===== ConfigDescriptorValidator
 
 Allows to validate the final view-config descriptors before they get
@@ -1791,18 +1783,96 @@ In the listing above all beans which implement the Wizard interface
will
 be closed as soon as you close the ImplicitSubGroup.
 
 
-=== Injection in JSF Artifacts (TODO)
+=== Injection in JSF Artifacts
 
 ==== Converter and Validator
 
+Per default the JSF module of DeltaSpike handles JSF converters and validators as std. CDI
beans and
+therefore it's possible to use injection, lifecycle-callbacks, scope-annotations,...
+the same way as with any other CDI bean.
+The usage is the same as for `PhaseListener` s.
+
 ==== PhaseListener
 
+Once a std. JSF-`PhaseListener` is annotated with `@org.apache.deltaspike.jsf.api.listener.phase.JsfPhaseListener`,
+that `PhaseListener` gets active without additional config in `faces-config.xml`.
+Since such `PhaseListener` s are std. CDI beans,
+it's possible to use injection, lifecycle-callbacks as well as scope-annotations
+the same way as with any other CDI bean.
+Furthermore, it's possible to order `PhaseListener` s via `ordinal`.
+DeltaSpike itself uses it internally e.g. in case of `DoubleSubmitAwarePhaseListener` which
looks like:
+
+.Example
+[source,java]
+------------------------------------------------------------------------
+@JsfPhaseListener(ordinal = 9000)
+public class DoubleSubmitAwarePhaseListener implements PhaseListener, Deactivatable
+{
+    @Inject
+    private PostRequestTokenManager postRequestTokenManager;
+
+    @Override
+    public void beforePhase(PhaseEvent event)
+    {
+        //...
+    }
+
+    @Override
+    public void afterPhase(PhaseEvent event)
+    {
+        //...
+    }
+
+    @Override
+    public PhaseId getPhaseId()
+    {
+        return PhaseId.RESTORE_VIEW;
+    }
+}
+------------------------------------------------------------------------
+
 
 === Event broadcasting
 
-==== BeforeJsfRequest / AfterJsfRequest (TODO)
+==== Observe Faces-Requests
+
+It is possible to observe JSF-Requests via `@Observes` in combination with
+`@org.apache.deltaspike.core.api.lifecycle.Initialized` or
+`@org.apache.deltaspike.core.api.lifecycle.Destroyed` as qualifier for `javax.faces.context.FacesContext`.
+
+Such observer-methods look e.g. like:
+
+.Example
+[source,java]
+------------------------------------------------------------------------
+public void onBeforeFacesRequest(@Observes @Initialized FacesContext facesContext) {
+    //...
+}
+
+public void onAfterFacesRequest(@Observes @Destroyed FacesContext facesContext) {
+    //...
+}
+------------------------------------------------------------------------
+
+==== BeforePhase / AfterPhase
+
+It is possible to observe JSF request-lifecycle phase-events via `@Observes` in combination
with
+`@org.apache.deltaspike.jsf.api.listener.phase.BeforePhase` or
+`@org.apache.deltaspike.jsf.api.listener.phase.AfterPhase` as qualifier for `javax.faces.event.PhaseEvent`.
+
+Such observer-methods look e.g. like:
 
-==== BeforePhase / AfterPhase (TODO)
+.Example
+[source,java]
+------------------------------------------------------------------------
+public void onPhaseStart(@Observes @BeforePhase(JsfPhaseId.ANY_PHASE) PhaseEvent event) {
+    //...
+}
+
+public void onPhaseEnd(@Observes @AfterPhase(JsfPhaseId.ANY_PHASE) PhaseEvent event) {
+    //...
+}
+------------------------------------------------------------------------
 
 ==== JSF SystemEvents
 


Mime
View raw message