deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rafab...@apache.org
Subject svn commit: r1673970 - /deltaspike/site/trunk/content/staging/documentation/jsf.html
Date Wed, 15 Apr 2015 22:13:01 GMT
Author: rafabene
Date: Wed Apr 15 22:13:01 2015
New Revision: 1673970

URL: http://svn.apache.org/r1673970
Log:
Site checkin for project Apache DeltaSpike Documentation

Modified:
    deltaspike/site/trunk/content/staging/documentation/jsf.html

Modified: deltaspike/site/trunk/content/staging/documentation/jsf.html
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/staging/documentation/jsf.html?rev=1673970&r1=1673969&r2=1673970&view=diff
==============================================================================
--- deltaspike/site/trunk/content/staging/documentation/jsf.html (original)
+++ deltaspike/site/trunk/content/staging/documentation/jsf.html Wed Apr 15 22:13:01 2015
@@ -238,7 +238,6 @@ body {
 <li><a href="#__groupedconversationscoped_from_deltaspike_0_6">@GroupedConversationScoped
(From DeltaSpike 0.6)</a></li>
 <li><a href="#__viewscoped">@ViewScoped</a></li>
 <li><a href="#_jsf_2_0_scopes">JSF 2.0 Scopes</a></li>
-<li><a href="#_observing_jsf_requests">Observing JSF requests</a></li>
 </ul>
 </li>
 <li><a href="#_integration_with_deltaspike_type_safe_messages">Integration with
DeltaSpike Type-safe Messages</a></li>
@@ -910,57 +909,6 @@ issues, if you import a JSF 2 annotation
 CDI annotation.</p>
 </div>
 </div>
-<div class="sect3">
-<h4 id="_observing_jsf_requests">Observing JSF requests</h4>
-<div class="paragraph">
-<p>DeltaSpike allows to observe JSF requests using <code>@org.apache.deltaspike.core.api.lifecycle.Initialized</code>
and <code>@org.apache.deltaspike.core.api.lifecycle.Destroyed</code></p>
-</div>
-<div class="paragraph">
-<p>Example:</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java">    <span class="directive">protected</span>
<span class="type">void</span> onFacesRequestStart(<span class="annotation">@Observes</span>
<span class="annotation">@org</span>.apache.deltaspike.core.api.lifecycle.Initialized
FacesContext facesContext) {
-        <span class="comment">//...</span>
-    }
-
-    <span class="directive">protected</span> <span class="type">void</span>
onFacesRequestEnd(<span class="annotation">@Observes</span> <span class="annotation">@org</span>.apache.deltaspike.core.api.lifecycle.Destroyed
FacesContext facesContext) {
-        <span class="comment">//...</span>
-    }</code></pre>
-</div>
-</div>
-<div class="paragraph">
-<p>In CDI 1.1+ there are annotations with the same name (different packages). DeltaSpike
makes possible to use these annotations to access the FacesContext.</p>
-</div>
-<div class="paragraph">
-<p>CDI 1.1+ out-of-the-box support:</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java">    <span class="directive">protected</span>
<span class="type">void</span> onRequestStart(<span class="annotation">@Observes</span>
<span class="annotation">@javax</span>.enterprise.context.Initialized(javax.enterprise.context.RequestScoped.class)
<span class="predefined-type">Object</span> payload) {
-        <span class="comment">//...</span>
-    }
-
-    <span class="directive">protected</span> <span class="type">void</span>
onRequestEnd(<span class="annotation">@Observes</span> <span class="annotation">@javax</span>.enterprise.context.Destroyed(javax.enterprise.context.RequestScoped.class)
<span class="predefined-type">Object</span> payload) {
-        <span class="comment">//...</span>
-    }</code></pre>
-</div>
-</div>
-<div class="paragraph">
-<p>Feature introduced by DeltaSpike for CDI 1.1+:</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java">    <span class="directive">protected</span>
<span class="type">void</span> onFacesRequestStart(<span class="annotation">@Observes</span>
<span class="annotation">@javax</span>.enterprise.context.Initialized(javax.faces.bean.RequestScoped.class)
FacesContext facesContext) {
-        <span class="comment">//...</span>
-    }
-
-    <span class="directive">protected</span> <span class="type">void</span>
onFacesRequestEnd(<span class="annotation">@Observes</span> <span class="annotation">@javax</span>.enterprise.context.Destroyed(javax.faces.bean.RequestScoped.class)
FacesContext facesContext) {
-        <span class="comment">//...</span>
-    }</code></pre>
-</div>
-</div>
-</div>
 </div>
 <div class="sect2">
 <h3 id="_integration_with_deltaspike_type_safe_messages">Integration with DeltaSpike
Type-safe Messages</h3>
@@ -2645,6 +2593,29 @@ DeltaSpike itself uses it internally e.g
     <span class="comment">//...</span>
 }</code></pre>
 </div>
+</div>
+<div class="paragraph">
+<p>Since CDI 1.1+ there are annotations with the same name (different packages) and
DeltaSpike supports it.
+These CDI 1.1+ annotations require the corresponding scope-annotation as value. Since <code>javax.enterprise.context.RequestScoped</code>
is supported out-of-the-box and this event is about the Faces-Requests, we have to use <code>javax.faces.bean.RequestScoped</code>.</p>
+</div>
+<div class="paragraph">
+<p>The benefit is that it&#8217;s possible to observe faces-requests via standard
annotations and it&#8217;s possible to access the FacesContext object (which isn&#8217;t
the case with an observer for javax.enterprise.context.RequestScoped).</p>
+</div>
+<div class="listingblock">
+<div class="title">Example</div>
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="keyword">import</span>
<span class="include">javax.enterprise.context.Initialized</span>;
+<span class="keyword">import</span> <span class="include">javax.enterprise.context.Destroyed</span>;
+<span class="keyword">import</span> <span class="include">javax.faces.bean.RequestScoped</span>;
+
+<span class="directive">protected</span> <span class="type">void</span>
onFacesRequestStart(<span class="annotation">@Observes</span> <span class="annotation">@Initialized</span>(RequestScoped.class)
FacesContext facesContext) {
+    <span class="comment">//...</span>
+}
+
+<span class="directive">protected</span> <span class="type">void</span>
onFacesRequestEnd(<span class="annotation">@Observes</span> <span class="annotation">@Destroyed</span>(RequestScoped.class)
FacesContext facesContext) {
+    <span class="comment">//...</span>
+}</code></pre>
+</div>
 </div>
 </div>
 <div class="sect3">



Mime
View raw message