Modified: tomee/site/trunk/content/master/examples/mp-rest-jwt.html
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/content/master/examples/mp-rest-jwt.html?rev=1849998&r1=1849997&r2=1849998&view=diff
==============================================================================
--- tomee/site/trunk/content/master/examples/mp-rest-jwt.html (original)
+++ tomee/site/trunk/content/master/examples/mp-rest-jwt.html Sun Dec 30 
19:02:51 2018
@@ -88,21 +88,41 @@
           <div class="col-md-12">
             <div class='page-header'>
               
-              <h1>Microprofile Rest JWT</h1>
+              <h1>MicroProfile JWT</h1>
             </div>
           </div>
         </div>
         <div class="row">
             
             <div class="col-md-12">
-                <h1>MP REST JWT</h1>
-<p>This is a basic example on how to configure and use MicroProfile JWT in 
TomEE.</p>
-<h2>Run the tests for different scenarios related with JWT validation</h2>
-<pre><code>mvn clean test 
-</code></pre>
-<h2>Configuration in TomEE</h2>
-<p>The class <code>MoviesMPJWTConfigurationProvider.java</code> provides to 
TomEE the figuration need it for JWT validation.</p>
-<pre><code>package org.superbiz.moviefun.rest;
+                <div id="preamble">
+<div class="sectionbody">
+<div class="paragraph">
+<p>This is a basic example on how to configure and use MicroProfile JWT in
+TomEE.</p>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 
id="_run_the_tests_for_different_scenarios_related_with_jwt_validation">Run the 
tests for different scenarios related with JWT validation</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>mvn clean test</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_configuration_in_tomee">Configuration in TomEE</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>The class <code>MoviesMPJWTConfigurationProvider.java</code> provides to 
TomEE the
+figuration need it for JWT validation.</p>
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.moviefun.rest;
 
 import org.apache.tomee.microprofile.jwt.config.JWTAuthContextInfo;
 
@@ -124,19 +144,19 @@ public class MoviesMPJWTConfigurationPro
         JWTAuthContextInfo contextInfo = new JWTAuthContextInfo();
 
         // todo use MP Config to load the configuration
-        contextInfo.setIssuedBy(&quot;https://server.example.com&quot;);
+        contextInfo.setIssuedBy("https://server.example.com";);
 
-        final String pemEncoded = 
&quot;MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlivFI8qB4D0y2jy0CfEq&quot; +
-                
&quot;Fyy46R0o7S8TKpsx5xbHKoU1VWg6QkQm+ntyIv1p4kE1sPEQO73+HY8+Bzs75XwR&quot; +
-                
&quot;TYL1BmR1w8J5hmjVWjc6R2BTBGAYRPFRhor3kpM6ni2SPmNNhurEAHw7TaqszP5e&quot; +
-                
&quot;UF/F9+KEBWkwVta+PZ37bwqSE4sCb1soZFrVz/UT/LF4tYpuVYt3YbqToZ3pZOZ9&quot; +
-                
&quot;AX2o1GCG3xwOjkc4x0W7ezbQZdC9iftPxVHR8irOijJRRjcPDtA6vPKpzLl6CyYn&quot; +
-                
&quot;sIYPd99ltwxTHjr3npfv/3Lw50bAkbT4HeLFxTx4flEoZLKO/g0bAoV2uqBhkA9x&quot; +
-                &quot;nQIDAQAB&quot;;
+        final String pemEncoded = 
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlivFI8qB4D0y2jy0CfEq" +
+                
"Fyy46R0o7S8TKpsx5xbHKoU1VWg6QkQm+ntyIv1p4kE1sPEQO73+HY8+Bzs75XwR" +
+                
"TYL1BmR1w8J5hmjVWjc6R2BTBGAYRPFRhor3kpM6ni2SPmNNhurEAHw7TaqszP5e" +
+                
"UF/F9+KEBWkwVta+PZ37bwqSE4sCb1soZFrVz/UT/LF4tYpuVYt3YbqToZ3pZOZ9" +
+                
"AX2o1GCG3xwOjkc4x0W7ezbQZdC9iftPxVHR8irOijJRRjcPDtA6vPKpzLl6CyYn" +
+                
"sIYPd99ltwxTHjr3npfv/3Lw50bAkbT4HeLFxTx4flEoZLKO/g0bAoV2uqBhkA9x" +
+                "nQIDAQAB";
         byte[] encodedBytes = Base64.getDecoder().decode(pemEncoded);
 
         final X509EncodedKeySpec spec = new X509EncodedKeySpec(encodedBytes);
-        final KeyFactory kf = KeyFactory.getInstance(&quot;RSA&quot;);
+        final KeyFactory kf = KeyFactory.getInstance("RSA");
         final RSAPublicKey pk = (RSAPublicKey) kf.generatePublic(spec);
 
         contextInfo.setSignerKey(pk);
@@ -148,11 +168,23 @@ public class MoviesMPJWTConfigurationPro
     JWTAuthContextInfo getContextInfo() throws InvalidKeySpecException, 
NoSuchAlgorithmException {
         return getOptionalContextInfo().get();
     }
-}
-</code></pre>
-<h2>Use MicroProfile JWT in TomEE</h2>
-<p>The JAX-RS resource <code>MoviesRest.java</code> contains several endpoint 
that are secured using the standard annotation <code>@RolesAllowed</code>. 
MicroProfile JWT takes care of performing the validation for incoming requests 
with <code>Authorization</code> header providing a signed <code>Access 
Token</code></p>
-<pre><code>   package org.superbiz.moviefun.rest;
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_use_microprofile_jwt_in_tomee">Use MicroProfile JWT in TomEE</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>The JAX-RS resource <code>MoviesRest.java</code> contains several endpoint 
that are
+secured using the standard annotation <code>@RolesAllowed</code>. MicroProfile 
JWT
+takes care of performing the validation for incoming requests with
+<code>Authorization</code> header providing a signed <code>Access 
Token</code></p>
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>   package org.superbiz.moviefun.rest;
 
    import org.superbiz.moviefun.Movie;
    import org.superbiz.moviefun.MoviesBean;
@@ -163,7 +195,7 @@ public class MoviesMPJWTConfigurationPro
    import javax.ws.rs.core.MediaType;
    import java.util.List;
 
-   @Path(&quot;cinema&quot;)
+   @Path("cinema")
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    public class MoviesRest {
@@ -174,40 +206,40 @@ public class MoviesMPJWTConfigurationPro
        @GET
        @Produces(MediaType.TEXT_PLAIN)
        public String status() {
-           return &quot;ok&quot;;
+           return "ok";
        }
 
        @GET
-       @Path(&quot;/movies&quot;)
-       @RolesAllowed({&quot;crud&quot;, &quot;read-only&quot;})
+       @Path("/movies")
+       @RolesAllowed({"crud", "read-only"})
        public List&lt;Movie&gt; getListOfMovies() {
            return moviesBean.getMovies();
        }
 
        @GET
-       @Path(&quot;/movies/{id}&quot;)
-       @RolesAllowed({&quot;crud&quot;, &quot;read-only&quot;})
-       public Movie getMovie(@PathParam(&quot;id&quot;) int id) {
+       @Path("/movies/{id}")
+       @RolesAllowed({"crud", "read-only"})
+       public Movie getMovie(@PathParam("id") int id) {
            return moviesBean.getMovie(id);
        }
 
        @POST
-       @Path(&quot;/movies&quot;)
-       @RolesAllowed(&quot;crud&quot;)
+       @Path("/movies")
+       @RolesAllowed("crud")
        public void addMovie(Movie newMovie) {
            moviesBean.addMovie(newMovie);
        }
 
        @DELETE
-       @Path(&quot;/movies/{id}&quot;)
-       @RolesAllowed(&quot;crud&quot;)
-       public void deleteMovie(@PathParam(&quot;id&quot;) int id) {
+       @Path("/movies/{id}")
+       @RolesAllowed("crud")
+       public void deleteMovie(@PathParam("id") int id) {
            moviesBean.deleteMovie(id);
        }
 
        @PUT
-       @Path(&quot;/movies&quot;)
-       @RolesAllowed(&quot;crud&quot;)
+       @Path("/movies")
+       @RolesAllowed("crud")
        public void updateMovie(Movie updatedMovie) {
            moviesBean.updateMovie(updatedMovie);
        }
@@ -215,50 +247,85 @@ public class MoviesMPJWTConfigurationPro
    }
 
  @Inject
- @ConfigProperty(name = &quot;java.runtime.version&quot;)
- private String javaVersion;
-</code></pre>
-<h2>About the Test architecture</h2>
-<p>The test cases from this project are builded using Arquillian. The 
arquillian configuration can be found 
in<br/><code>src/test/resources/arquillian.xml</code></p>
-<p>The class <code>TokenUtils.java</code> is used during the test to act as an 
Authorization server who generates <code>Access Tokens</code> based on the 
configuration files 
<code>privateKey.pem</code>,<code>publicKey.pem</code>,<code>Token1.json</code>,
 and <code>Token2.json</code>.<br/><code>nimbus-jose-jwt</code> is the library 
used for JWT generation during the tests.</p>
+ @ConfigProperty(name = "java.runtime.version")
+ private String javaVersion;</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_about_the_test_architecture">About the Test architecture</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>The test cases from this project are builded using Arquillian. The
+arquillian configuration can be found in
+<code>src/test/resources/arquillian.xml</code></p>
+</div>
+<div class="paragraph">
+<p>The class <code>TokenUtils.java</code> is used during the test to act as an
+Authorization server who generates <code>Access Tokens</code> based on the
+configuration files 
<code>privateKey.pem</code>,<code>publicKey.pem</code>,<code>Token1.json</code>,
 and
+<code>Token2.json</code>.<br>
+<code>nimbus-jose-jwt</code> is the library used for JWT generation during the
+tests.</p>
+</div>
+<div class="paragraph">
 <p><code>Token1.json</code></p>
-<pre><code>{
-    &quot;iss&quot;: &quot;https://server.example.com&quot;,
-    &quot;jti&quot;: &quot;a-123&quot;,
-    &quot;sub&quot;: &quot;24400320&quot;,
-    &quot;upn&quot;: &quot;[email protected]&quot;,
-    &quot;preferred_username&quot;: &quot;jdoe&quot;,
-    &quot;aud&quot;: &quot;s6BhdRkqt3&quot;,
-    &quot;exp&quot;: 1311281970,
-    &quot;iat&quot;: 1311280970,
-    &quot;auth_time&quot;: 1311280969,
-    &quot;groups&quot;: [
-        &quot;group1&quot;,
-        &quot;group2&quot;,
-        &quot;crud&quot;,
-        &quot;read-only&quot;
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>{
+    "iss": "https://server.example.com";,
+    "jti": "a-123",
+    "sub": "24400320",
+    "upn": "[email protected]",
+    "preferred_username": "jdoe",
+    "aud": "s6BhdRkqt3",
+    "exp": 1311281970,
+    "iat": 1311280970,
+    "auth_time": 1311280969,
+    "groups": [
+        "group1",
+        "group2",
+        "crud",
+        "read-only"
     ]
-}
-</code></pre>
+}</pre>
+</div>
+</div>
+<div class="paragraph">
 <p><code>Token2.json</code></p>
-<pre><code>{
-  &quot;iss&quot;: &quot;https://server.example.com&quot;,
-  &quot;jti&quot;: &quot;a-123&quot;,
-  &quot;sub&quot;: &quot;24400320&quot;,
-  &quot;upn&quot;: &quot;[email protected]&quot;,
-  &quot;preferred_username&quot;: &quot;alice&quot;,
-  &quot;aud&quot;: &quot;s6BhdRkqt3&quot;,
-  &quot;exp&quot;: 1311281970,
-  &quot;iat&quot;: 1311280970,
-  &quot;auth_time&quot;: 1311280969,
-  &quot;groups&quot;: [
-    &quot;read-only&quot;
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>{
+  "iss": "https://server.example.com";,
+  "jti": "a-123",
+  "sub": "24400320",
+  "upn": "[email protected]",
+  "preferred_username": "alice",
+  "aud": "s6BhdRkqt3",
+  "exp": 1311281970,
+  "iat": 1311280970,
+  "auth_time": 1311280969,
+  "groups": [
+    "read-only"
   ]
-}
-</code></pre>
-<h2>Test Scenarios</h2>
-<p><code>MovieTest.java</code> contains 4 OAuth2 scenarios for different JWT 
combinations.</p>
-<pre><code>package org.superbiz.moviefun;
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_test_scenarios">Test Scenarios</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p><code>MovieTest.java</code> contains 4 OAuth2 scenarios for different JWT
+combinations.</p>
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.moviefun;
 
 import org.apache.cxf.feature.LoggingFeature;
 import org.apache.cxf.jaxrs.client.WebClient;
@@ -289,11 +356,11 @@ public class MoviesTest {
 
     @Deployment(testable = false)
     public static WebArchive createDeployment() {
-        final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, 
&quot;test.war&quot;)
+        final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, 
"test.war")
                                                 .addClasses(Movie.class, 
MoviesBean.class, MoviesTest.class)
                                                 .addClasses(MoviesRest.class, 
ApplicationConfig.class)
                                                 
.addClass(MoviesMPJWTConfigurationProvider.class)
-                                                .addAsWebInfResource(new 
StringAsset(&quot;&lt;beans/&gt;&quot;), &quot;beans.xml&quot;);
+                                                .addAsWebInfResource(new 
StringAsset("&lt;beans/&gt;"), "beans.xml");
 
         System.out.println(webArchive.toString(true));
 
@@ -315,19 +382,19 @@ public class MoviesTest {
 
 
         //Testing rest endpoint deployment (GET  without security header)
-        String responsePayload = 
webClient.reset().path(&quot;/rest/cinema/&quot;).get(String.class);
-        LOGGER.info(&quot;responsePayload = &quot; + responsePayload);
-        assertTrue(responsePayload.equalsIgnoreCase(&quot;ok&quot;));
+        String responsePayload = 
webClient.reset().path("/rest/cinema/").get(String.class);
+        LOGGER.info("responsePayload = " + responsePayload);
+        assertTrue(responsePayload.equalsIgnoreCase("ok"));
 
 
         //POST (Using token1.json with group of claims: [CRUD])
-        Movie newMovie = new Movie(1, &quot;David Dobkin&quot;, &quot;Wedding 
Crashers&quot;);
+        Movie newMovie = new Movie(1, "David Dobkin", "Wedding Crashers");
         Response response = webClient.reset()
-                                     .path(&quot;/rest/cinema/movies&quot;)
-                                     .header(&quot;Content-Type&quot;, 
&quot;application/json&quot;)
-                                     .header(&quot;Authorization&quot;, 
&quot;Bearer &quot; + token(1))
+                                     .path("/rest/cinema/movies")
+                                     .header("Content-Type", 
"application/json")
+                                     .header("Authorization", "Bearer " + 
token(1))
                                      .post(newMovie);
-        LOGGER.info(&quot;responseCode = &quot; + response.getStatus());
+        LOGGER.info("responseCode = " + response.getStatus());
         assertTrue(response.getStatus() == 204);
 
 
@@ -335,31 +402,31 @@ public class MoviesTest {
         //This test should be updated to use token2.json once TOMEE- gets 
resolved.
         Collection&lt;? extends Movie&gt; movies = webClient
                 .reset()
-                .path(&quot;/rest/cinema/movies&quot;)
-                .header(&quot;Content-Type&quot;, &quot;application/json&quot;)
-                .header(&quot;Authorization&quot;, &quot;Bearer &quot; + 
token(1))
+                .path("/rest/cinema/movies")
+                .header("Content-Type", "application/json")
+                .header("Authorization", "Bearer " + token(1))
                 .getCollection(Movie.class);
         LOGGER.info(movies.toString());
         assertTrue(movies.size() == 1);
 
 
         //Should return a 403 since POST require group of claims: [crud] but 
Token 2 has only [read-only].
-        Movie secondNewMovie = new Movie(2, &quot;Todd Phillips&quot;, 
&quot;Starsky &amp; Hutch&quot;);
+        Movie secondNewMovie = new Movie(2, "Todd Phillips", "Starsky &amp; 
Hutch");
         Response responseWithError = webClient.reset()
-                                              
.path(&quot;/rest/cinema/movies&quot;)
-                                              
.header(&quot;Content-Type&quot;, &quot;application/json&quot;)
-                                              
.header(&quot;Authorization&quot;, &quot;Bearer &quot; + token(2))
+                                              .path("/rest/cinema/movies")
+                                              .header("Content-Type", 
"application/json")
+                                              .header("Authorization", "Bearer 
" + token(2))
                                               .post(secondNewMovie);
-        LOGGER.info(&quot;responseCode = &quot; + 
responseWithError.getStatus());
+        LOGGER.info("responseCode = " + responseWithError.getStatus());
         assertTrue(responseWithError.getStatus() == 403);
 
 
         //Should return a 401 since the header Authorization is not part of 
the POST request.
         Response responseWith401Error = webClient.reset()
-                                                 
.path(&quot;/rest/cinema/movies&quot;)
-                                                 
.header(&quot;Content-Type&quot;, &quot;application/json&quot;)
+                                                 .path("/rest/cinema/movies")
+                                                 .header("Content-Type", 
"application/json")
                                                  .post(new Movie());
-        LOGGER.info(&quot;responseCode = &quot; + 
responseWith401Error.getStatus());
+        LOGGER.info("responseCode = " + responseWith401Error.getStatus());
         assertTrue(responseWith401Error.getStatus() == 401);
 
     }
@@ -368,14 +435,17 @@ public class MoviesTest {
     private String token(int token_type) throws Exception {
         HashMap&lt;String, Long&gt; timeClaims = new HashMap&lt;&gt;();
         if (token_type == 1) {
-            return TokenUtils.generateTokenString(&quot;/Token1.json&quot;, 
null, timeClaims);
+            return TokenUtils.generateTokenString("/Token1.json", null, 
timeClaims);
         } else {
-            return TokenUtils.generateTokenString(&quot;/Token2.json&quot;, 
null, timeClaims);
+            return TokenUtils.generateTokenString("/Token2.json", null, 
timeClaims);
         }
     }
 
-}
-</code></pre>
+}</pre>
+</div>
+</div>
+</div>
+</div>
             </div>
             
         </div>

Modified: tomee/site/trunk/content/sitemap.xml
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/content/sitemap.xml?rev=1849998&r1=1849997&r2=1849998&view=diff
==============================================================================
--- tomee/site/trunk/content/sitemap.xml (original)
+++ tomee/site/trunk/content/sitemap.xml Sun Dec 30 19:02:51 2018
@@ -3332,11 +3332,6 @@
     </url>
 
     <url>
-       
<loc>http://tomee.apache.org/latest/examples/cdi-alternative-and-stereotypes.html</loc>
-       
-    </url>
-
-    <url>
        
<loc>http://tomee.apache.org/latest/examples/cdi-application-scope.html</loc>
        
     </url>
@@ -3372,6 +3367,11 @@
     </url>
 
     <url>
+       
<loc>http://tomee.apache.org/latest/examples/cdi-session-scope.html</loc>
+       
+    </url>
+
+    <url>
        <loc>http://tomee.apache.org/latest/examples/change-jaxws-url.html</loc>
        
     </url>
@@ -3962,11 +3962,6 @@
     </url>
 
     <url>
-       
<loc>http://tomee.apache.org/master/examples/cdi-alternative-and-stereotypes.html</loc>
-       
-    </url>
-
-    <url>
        
<loc>http://tomee.apache.org/master/examples/cdi-application-scope.html</loc>
        
     </url>
@@ -4002,6 +3997,11 @@
     </url>
 
     <url>
+       
<loc>http://tomee.apache.org/master/examples/cdi-session-scope.html</loc>
+       
+    </url>
+
+    <url>
        <loc>http://tomee.apache.org/master/examples/change-jaxws-url.html</loc>
        
     </url>
@@ -5642,11 +5642,6 @@
     </url>
 
     <url>
-       
<loc>http://tomee.apache.org/tomee-8.0/examples/cdi-alternative-and-stereotypes.html</loc>
-       
-    </url>
-
-    <url>
        
<loc>http://tomee.apache.org/tomee-8.0/examples/cdi-application-scope.html</loc>
        
     </url>
@@ -5681,6 +5676,11 @@
        
     </url>
 
+    <url>
+       
<loc>http://tomee.apache.org/tomee-8.0/examples/cdi-session-scope.html</loc>
+       
+    </url>
+
     <url>
        
<loc>http://tomee.apache.org/tomee-8.0/examples/change-jaxws-url.html</loc>
        

Modified: tomee/site/trunk/content/tomee-8.0/docs/developer/ide/index.html
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/content/tomee-8.0/docs/developer/ide/index.html?rev=1849998&r1=1849997&r2=1849998&view=diff
==============================================================================
--- tomee/site/trunk/content/tomee-8.0/docs/developer/ide/index.html (original)
+++ tomee/site/trunk/content/tomee-8.0/docs/developer/ide/index.html Sun Dec 30 
19:02:51 2018
@@ -125,15 +125,15 @@
 <h2 id="_eclipse">Eclipse</h2>
 <div class="sectionbody">
 <div class="paragraph">
-<p>Be the first to write this part!</p>
+<p>Eclipse is an integrated development environment used in computer 
programming, and is the most widely used Java IDE. It contains a base workspace 
and an extensible plug-in system for customizing the environment. <a 
href="https://en.wikipedia.org/wiki/Eclipse_(software)">Wikipedia</a></p>
 </div>
 </div>
 </div>
 <div class="sect1">
-<h2 id="_idea">Idea</h2>
+<h2 id="_intellij_idea">IntelliJ IDEA</h2>
 <div class="sectionbody">
 <div class="paragraph">
-<p>Be the first to write this part!</p>
+<p>IntelliJ IDEA is a Java integrated development environment for developing 
computer software. It is developed by JetBrains, and is available as an Apache 
2 Licensed community edition, and in a proprietary commercial edition. Both can 
be used for commercial development. <a 
href="https://en.wikipedia.org/wiki/IntelliJ_IDEA";>Wikipedia</a></p>
 </div>
 </div>
 </div>
@@ -141,7 +141,7 @@
 <h2 id="_netbeans">Netbeans</h2>
 <div class="sectionbody">
 <div class="paragraph">
-<p>Be the first to write this part!</p>
+<p>NetBeans is an integrated development environment for Java. NetBeans allows 
applications to be developed from a set of modular software components called 
modules. NetBeans runs on Microsoft Windows, macOS, Linux and Solaris. <a 
href="https://en.wikipedia.org/wiki/NetBeans";>Wikipedia</a></p>
 </div>
 </div>
 </div>

Modified: tomee/site/trunk/content/tomee-8.0/examples/cdi-application-scope.html
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/content/tomee-8.0/examples/cdi-application-scope.html?rev=1849998&r1=1849997&r2=1849998&view=diff
==============================================================================
--- tomee/site/trunk/content/tomee-8.0/examples/cdi-application-scope.html 
(original)
+++ tomee/site/trunk/content/tomee-8.0/examples/cdi-application-scope.html Sun 
Dec 30 19:02:51 2018
@@ -95,12 +95,33 @@
         <div class="row">
             
             <div class="col-md-12">
-                <p>This example show the use of 
<code>@ApplicationScoped</code> annotation for injected objects. An object 
which is defined as <code>@ApplicationScoped</code> is created once for the 
duration of the application.</p>
-<h1>Example</h1>
-<p>This example depicts a similar scenario to cdi-request-scope. A restaurant 
guest orders a soup from the waiter. The waiter then delivers the soup back to 
the guest. Another guest can order the same soup that was ordered by the 
previous client - this is where the application scope is used. </p>
-<h2>Waiter</h2>
-<p>The <code>Waiter</code> session bean receives a request from the test class 
via the <code>orderSoup()</code> method and sets the name for the 
<code>soup</code> field. The <code>orderWhatTheOtherGuyHad()</code> method 
returns the name of the <code>soup</code> field.</p>
-<pre><code>@Stateless
+                <div id="preamble">
+<div class="sectionbody">
+<div class="paragraph">
+<p>This example show the use of <code>@ApplicationScoped</code> annotation for 
injected objects. An object
+which is defined as <code>@ApplicationScoped</code> is created once for the 
duration of the application.</p>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_example">Example</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>This example depicts a similar scenario to cdi-request-scope. A restaurant 
guest orders
+a soup from the waiter. The waiter then delivers the soup back to the guest. 
Another
+guest can order the same soup that was ordered by the previous client - this 
is where
+the application scope is used.</p>
+</div>
+<div class="sect2">
+<h3 id="_waiter">Waiter</h3>
+<div class="paragraph">
+<p>The <code>Waiter</code> session bean receives a request from the test class 
via the <code>orderSoup()</code> method
+and sets the name for the <code>soup</code> field. The 
<code>orderWhatTheOtherGuyHad()</code> method returns
+the name of the <code>soup</code> field.</p>
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>@Stateless
 public class Waiter {
 
     @Inject
@@ -115,18 +136,27 @@ public class Waiter {
         String name = soup.getName();
         return name;
     }
-}
-</code></pre>
-<h2>Soup</h2>
-<p>The <code>Soup</code> class is an injectable POJO, defined as 
<code>@ApplicationScoped</code>. This means that an instance will be created 
only once for the duration of the whole application. Try changing the 
<code>@ApplicationScoped</code> annotation to <code>@RequestScoped</code> and 
see what happens.</p>
-<pre><code>@ApplicationScoped
+}</pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_soup">Soup</h3>
+<div class="paragraph">
+<p>The <code>Soup</code> class is an injectable POJO, defined as 
<code>@ApplicationScoped</code>. This means that an instance
+will be created only once for the duration of the whole application. Try 
changing the <code>@ApplicationScoped</code>
+annotation to <code>@RequestScoped</code> and see what happens.</p>
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>@ApplicationScoped
 public class Soup {
 
-    private String name = &quot;Soup of the day&quot;;
+    private String name = "Soup of the day";
 
     @PostConstruct
     public void afterCreate() {
-        System.out.println(&quot;Soup created&quot;);
+        System.out.println("Soup created");
     }
 
     public String getName() {
@@ -136,13 +166,25 @@ public class Soup {
     public void setName(String name){
         this.name = name;
     }
-}
-</code></pre>
-<h1>Test Case</h1>
-<p>This is the entry class for this example. First a soup is ordered via 
<code>orderSoup()</code> method. This initiates the <code>soup</code> field. 
Next, <code>orderWhatTheOtherGuyHad()</code> method returns the soup from the 
application context.</p>
-<pre><code>public class RestaurantTest {
+}</pre>
+</div>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_test_case">Test Case</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>This is the entry class for this example. First a soup is ordered via 
<code>orderSoup()</code> method.
+This initiates the <code>soup</code> field. Next, 
<code>orderWhatTheOtherGuyHad()</code> method returns the soup
+from the application context.</p>
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>public class RestaurantTest {
 
-    private static String TOMATO_SOUP = &quot;Tomato Soup&quot;;
+    private static String TOMATO_SOUP = "Tomato Soup";
     private EJBContainer container;
 
     @EJB
@@ -151,7 +193,7 @@ public class Soup {
     @Before
     public void startContainer() throws Exception {
         container = EJBContainer.createEJBContainer();
-        container.getContext().bind(&quot;inject&quot;, this);
+        container.getContext().bind("inject", this);
     }
 
     @Test
@@ -167,11 +209,21 @@ public class Soup {
     public void closeContainer() throws Exception {
         container.close();
     }
-}
-</code></pre>
-<h1>Running</h1>
-<p>In the output you can see that there is just one <code>Soup</code> instance 
created - one for the whole application.</p>
-<pre><code>-------------------------------------------------------
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_running">Running</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>In the output you can see that there is just one <code>Soup</code> instance 
created - one for
+the whole application.</p>
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>-------------------------------------------------------
  T E S T S
 -------------------------------------------------------
 Running org.superbiz.cdi.applicationscope.RestaurantTest
@@ -179,7 +231,7 @@ Apache OpenEJB 7.0.0-SNAPSHOT    build:
 http://tomee.apache.org/
 INFO - openejb.home = 
C:\Users\Daniel\workspaces\openejb\openejb\examples\cdi-application-scope
 INFO - openejb.base = 
C:\Users\Daniel\workspaces\openejb\openejb\examples\cdi-application-scope
-INFO - Using &#39;javax.ejb.embeddable.EJBContainer=true&#39;
+INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
 INFO - Configuring Service(id=Default Security Service, type=SecurityService, 
provider-id=Default Security Service)
 INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
 INFO - Found EjbModule in classpath: 
c:\Users\Daniel\workspaces\openejb\openejb\examples\cdi-application-scope\target\classes
@@ -189,10 +241,10 @@ INFO - Configuring Service(id=Default Ma
 INFO - Auto-creating a container for bean cdi-application-scope.Comp: 
Container(type=MANAGED, id=Default Managed Container)
 INFO - Configuring Service(id=Default Stateless Container, type=Container, 
provider-id=Default Stateless Container)
 INFO - Auto-creating a container for bean Waiter: Container(type=STATELESS, 
id=Default Stateless Container)
-INFO - Enterprise application 
&quot;c:\Users\Daniel\workspaces\openejb\openejb\examples\cdi-application-scope&quot;
 loaded.
+INFO - Enterprise application 
"c:\Users\Daniel\workspaces\openejb\openejb\examples\cdi-application-scope" 
loaded.
 INFO - Assembling app: 
c:\Users\Daniel\workspaces\openejb\openejb\examples\cdi-application-scope
-INFO - 
Jndi(name=&quot;java:global/cdi-application-scope/Waiter!org.superbiz.cdi.applicationscope.Waiter&quot;)
-INFO - Jndi(name=&quot;java:global/cdi-application-scope/Waiter&quot;)
+INFO - 
Jndi(name="java:global/cdi-application-scope/Waiter!org.superbiz.cdi.applicationscope.Waiter")
+INFO - Jndi(name="java:global/cdi-application-scope/Waiter")
 INFO - Created Ejb(deployment-id=Waiter, ejb-name=Waiter, container=Default 
Stateless Container)
 INFO - Started Ejb(deployment-id=Waiter, ejb-name=Waiter, container=Default 
Stateless Container)
 INFO - Deployed 
Application(path=c:\Users\Daniel\workspaces\openejb\openejb\examples\cdi-application-scope)
@@ -202,8 +254,11 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
 
 Results :
 
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
-</code></pre>
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0</pre>
+</div>
+</div>
+</div>
+</div>
             </div>
             
         </div>

Modified: tomee/site/trunk/content/tomee-8.0/examples/cdi-basic.html
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/content/tomee-8.0/examples/cdi-basic.html?rev=1849998&r1=1849997&r2=1849998&view=diff
==============================================================================
--- tomee/site/trunk/content/tomee-8.0/examples/cdi-basic.html (original)
+++ tomee/site/trunk/content/tomee-8.0/examples/cdi-basic.html Sun Dec 30 
19:02:51 2018
@@ -95,13 +95,48 @@
         <div class="row">
             
             <div class="col-md-12">
-                <p>To use <code>@Inject</code>, the first thing you need is a 
<code>META-INF/beans.xml</code> file in the module or jar. This effectively 
turns on CDI and allows the <code>@Inject</code> references to work. No 
<code>META-INF/beans.xml</code> no injection, period. This may seem overly 
strict, but it is not without reason. The CDI API is a bit greedy and does 
consume a fair amount of resources by design.</p>
-<p>When the container constructs a bean with an <code>@Inject</code> 
reference, it will first find or create the object that will be injected. For 
the sake of simplicity, the is example has a basic <code>Faculty</code> pojo 
with a no-arg constructor. Anyone referencing <code>@Inject Faculty</code> will 
get their own instance of <code>Faculty</code>. If the desire is to share the 
same instance of <code>Faculty</code>, see the concept of <code>scopes</code> 
-- this is exactly what scopes are for.</p>
-<h1>Example</h1>
-<p>In this example, we have an <code>@Stateless</code> bean 
<code>Course</code> with an <code>@Inject</code> reference to an object of type 
<code>Faculty</code>. When <code>Course</code> is created, the container will 
also create an instance of <code>Faculty</code>. The 
<code>@PostConstruct</code> will be called on the <code>Faculty</code>, then 
the <code>Faculty</code> instance will be injected into the <code>Course</code> 
bean. Finally, the<br/><code>@PostConstruct</code> will be invoked on 
<code>Course</code> and then we're done. All instances will<br/>have been 
created.</p>
-<p>The <code>CourseTest</code> test case drives this creation process by 
having <code>Course</code> injected in its <code>@Setup</code> method. By the 
time our <code>@Test</code> method is invoked, all the real work should be done 
and we should be ready to go. In the test case we do some basic asserts to 
ensure everything was constructed, all <code>@PostConstruct</code> methods 
called and everything injected.</p>
-<h2>Faculty <small>a basic injectable pojo</small></h2>
-<pre><code>public class Faculty {
+                <div id="preamble">
+<div class="sectionbody">
+<div class="paragraph">
+<p>To use <code>@Inject</code>, the first thing you need is a 
<code>META-INF/beans.xml</code> file in the module
+or jar.  This effectively turns on CDI and allows the <code>@Inject</code> 
references to work.
+No <code>META-INF/beans.xml</code> no injection, period.  This may seem overly 
strict,
+but it is not without reason.  The CDI API is a bit greedy and does consume a 
fair
+amount of resources by design.</p>
+</div>
+<div class="paragraph">
+<p>When the container constructs a bean with an <code>@Inject</code> reference,
+it will first find or create the object that will be injected.  For the sake of
+simplicity, the is example has a basic <code>Faculty</code> pojo with a no-arg 
constructor.  Anyone
+referencing <code>@Inject Faculty</code> will get their own instance of 
<code>Faculty</code>.  If the desire
+is to share the same instance of <code>Faculty</code>, see the concept of 
<code>scopes</code>&#8201;&#8212;&#8201;this is
+exactly what scopes are for.</p>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_example">Example</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>In this example, we have an <code>@Stateless</code> bean 
<code>Course</code> with an <code>@Inject</code> reference to an
+object of type <code>Faculty</code>.  When <code>Course</code> is created, the 
container will also create an
+instance of <code>Faculty</code>.  The <code>@PostConstruct</code> will be 
called on the <code>Faculty</code>,
+then the <code>Faculty</code> instance will be injected into the 
<code>Course</code> bean.  Finally, the
+<code>@PostConstruct</code> will be invoked on <code>Course</code> and then 
we&#8217;re done.  All instances will
+have been created.</p>
+</div>
+<div class="paragraph">
+<p>The <code>CourseTest</code> test case drives this creation process by 
having <code>Course</code> injected
+in its <code>@Setup</code> method.  By the time our <code>@Test</code> method 
is invoked,
+all the real work should be done and we should be ready to go.  In the test 
case we do
+some basic asserts to ensure everything was constructed, all 
<code>@PostConstruct</code> methods
+called and everything injected.</p>
+</div>
+<div class="sect2">
+<h3 id="_faculty_small_a_basic_injectable_pojo_small">Faculty <small>a basic 
injectable pojo</small></h3>
+<div class="literalblock">
+<div class="content">
+<pre>public class Faculty {
 
     private List&lt;String&gt; facultyMembers;
 
@@ -110,9 +145,9 @@
     @PostConstruct
     public void initialize() {
         this.facultyMembers = new ArrayList&lt;String&gt;();
-        facultyMembers.add(&quot;Ian Schultz&quot;);
-        facultyMembers.add(&quot;Diane Reyes&quot;);
-        facultyName = &quot;Computer Science&quot;;
+        facultyMembers.add("Ian Schultz");
+        facultyMembers.add("Diane Reyes");
+        facultyName = "Computer Science";
     }
 
     public List&lt;String&gt; getFacultyMembers() {
@@ -123,10 +158,15 @@
         return facultyName;
     }
 
-}
-</code></pre>
-<h2>Course <small>a simple session bean</small></h2>
-<pre><code>@Stateless
+}</pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_course_small_a_simple_session_bean_small">Course <small>a simple 
session bean</small></h3>
+<div class="literalblock">
+<div class="content">
+<pre>@Stateless
 public class Course {
 
     @Inject
@@ -141,8 +181,8 @@ public class Course {
         assert faculty != null;
 
         // These strings can be externalized
-        // We&#39;ll see how to do that later
-        this.courseName = &quot;CDI 101 - Introduction to CDI&quot;;
+        // We'll see how to do that later
+        this.courseName = "CDI 101 - Introduction to CDI";
         this.capacity = 100;
     }
 
@@ -157,17 +197,25 @@ public class Course {
     public Faculty getFaculty() {
         return faculty;
     }
-}
-</code></pre>
-<h1>Test Case</h1>
-<pre><code>public class CourseTest extends TestCase {
+}</pre>
+</div>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_test_case">Test Case</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>public class CourseTest extends TestCase {
 
     @EJB
     private Course course;
 
     @Before
     public void setUp() throws Exception {
-        
EJBContainer.createEJBContainer().getContext().bind(&quot;inject&quot;, this);
+        EJBContainer.createEJBContainer().getContext().bind("inject", this);
     }
 
     @Test
@@ -185,13 +233,20 @@ public class Course {
         assertTrue(faculty != null);
 
         // Was the @PostConstruct called on Faculty?
-        assertEquals(faculty.getFacultyName(), &quot;Computer Science&quot;);
+        assertEquals(faculty.getFacultyName(), "Computer Science");
         assertEquals(faculty.getFacultyMembers().size(), 2);
     }
-}
-</code></pre>
-<h1>Running</h1>
-<pre><code>-------------------------------------------------------
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_running">Running</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>-------------------------------------------------------
  T E S T S
 -------------------------------------------------------
 Running org.superbiz.cdi.basic.CourseTest
@@ -199,7 +254,7 @@ Apache OpenEJB 4.0.0-beta-1    build: 20
 http://tomee.apache.org/
 INFO - openejb.home = /Users/dblevins/examples/cdi-basic
 INFO - openejb.base = /Users/dblevins/examples/cdi-basic
-INFO - Using &#39;javax.ejb.embeddable.EJBContainer=true&#39;
+INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
 INFO - Configuring Service(id=Default Security Service, type=SecurityService, 
provider-id=Default Security Service)
 INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
 INFO - Found EjbModule in classpath: 
/Users/dblevins/examples/cdi-basic/target/classes
@@ -209,14 +264,14 @@ INFO - Configuring Service(id=Default Ma
 INFO - Auto-creating a container for bean cdi-basic.Comp: 
Container(type=MANAGED, id=Default Managed Container)
 INFO - Configuring Service(id=Default Stateless Container, type=Container, 
provider-id=Default Stateless Container)
 INFO - Auto-creating a container for bean Course: Container(type=STATELESS, 
id=Default Stateless Container)
-INFO - Enterprise application &quot;/Users/dblevins/examples/cdi-basic&quot; 
loaded.
+INFO - Enterprise application "/Users/dblevins/examples/cdi-basic" loaded.
 INFO - Assembling app: /Users/dblevins/examples/cdi-basic
-INFO - 
Jndi(name=&quot;java:global/cdi-basic/cdi-basic.Comp!org.apache.openejb.BeanContext$Comp&quot;)
-INFO - Jndi(name=&quot;java:global/cdi-basic/cdi-basic.Comp&quot;)
-INFO - 
Jndi(name=&quot;java:global/cdi-basic/Course!org.superbiz.cdi.basic.Course&quot;)
-INFO - Jndi(name=&quot;java:global/cdi-basic/Course&quot;)
-INFO - 
Jndi(name=&quot;java:global/EjbModule1833350875/org.superbiz.cdi.basic.CourseTest!org.superbiz.cdi.basic.CourseTest&quot;)
-INFO - 
Jndi(name=&quot;java:global/EjbModule1833350875/org.superbiz.cdi.basic.CourseTest&quot;)
+INFO - 
Jndi(name="java:global/cdi-basic/cdi-basic.Comp!org.apache.openejb.BeanContext$Comp")
+INFO - Jndi(name="java:global/cdi-basic/cdi-basic.Comp")
+INFO - Jndi(name="java:global/cdi-basic/Course!org.superbiz.cdi.basic.Course")
+INFO - Jndi(name="java:global/cdi-basic/Course")
+INFO - 
Jndi(name="java:global/EjbModule1833350875/org.superbiz.cdi.basic.CourseTest!org.superbiz.cdi.basic.CourseTest")
+INFO - 
Jndi(name="java:global/EjbModule1833350875/org.superbiz.cdi.basic.CourseTest")
 INFO - Created Ejb(deployment-id=Course, ejb-name=Course, container=Default 
Stateless Container)
 INFO - Created Ejb(deployment-id=cdi-basic.Comp, ejb-name=cdi-basic.Comp, 
container=Default Managed Container)
 INFO - Created Ejb(deployment-id=org.superbiz.cdi.basic.CourseTest, 
ejb-name=org.superbiz.cdi.basic.CourseTest, container=Default Managed Container)
@@ -228,8 +283,11 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
 
 Results :
 
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
-</code></pre>
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0</pre>
+</div>
+</div>
+</div>
+</div>
             </div>
             
         </div>

Modified: tomee/site/trunk/content/tomee-8.0/examples/cdi-events.html
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/content/tomee-8.0/examples/cdi-events.html?rev=1849998&r1=1849997&r2=1849998&view=diff
==============================================================================
--- tomee/site/trunk/content/tomee-8.0/examples/cdi-events.html (original)
+++ tomee/site/trunk/content/tomee-8.0/examples/cdi-events.html Sun Dec 30 
19:02:51 2018
@@ -88,26 +88,73 @@
           <div class="col-md-12">
             <div class='page-header'>
               
-              <h1>CDI Events</h1>
+              <h1>CDI Events - Loose Coupling and Extensibility</h1>
             </div>
           </div>
         </div>
         <div class="row">
             
             <div class="col-md-12">
-                <h1>CDI events: loose coupling and extensibility</h1>
+                <div id="preamble">
+<div class="sectionbody">
+<div class="paragraph">
 <p>CDI allows you to extend business code by the Notifier/Observer pattern.</p>
-<p>To do it you simply inject a field <code>Event</code> in the notifier 
class. This class is a template and the parameter type is the object type to 
fire. Then when you want to notify observers you simply call the method fire of 
the event object passing as a parameter the event itself<br/>(your own 
class!).</p>
-<p>On the other side you annotated a method parameter <code>@Observes</code> 
and the parameter type is the sent type by the notifier.</p>
-<p>Note: of course you can add qualifiers to be more precise on your 
events.</p>
-<h1>The example</h1>
-<p>The example is pretty simple: an ejb uses the <code>@Schedule</code> 
annotation to get a notification each second. The each second this EJB will 
send the current date through CDI events.</p>
+</div>
+<div class="paragraph">
+<p>To do it you simply inject a field <code>Event</code> in the notifier 
class. This class is a template
+and the parameter type is the object type to fire. Then when you want to 
notify observers
+you simply call the method fire of the event object passing as a parameter the 
event itself
+(your own class!).</p>
+</div>
+<div class="paragraph">
+<p>On the other side you annotated a method parameter <code>@Observes</code> 
and the parameter type is the sent type
+by the notifier.</p>
+</div>
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+of course you can add qualifiers to be more precise on your events.
+</td>
+</tr>
+</table>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_example">Example</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>The example is pretty simple: an ejb uses the <code>@Schedule</code> 
annotation to get a notification each second.
+The each second this EJB will send the current date through CDI events.</p>
+</div>
+<div class="paragraph">
 <p>This is our "business" code. It is a simple behavior (nothing).</p>
-<p>In our test (which is considered as an extension) we created an observer 
(<code>Observer</code> class) which simply store and log each received date.</p>
+</div>
+<div class="paragraph">
+<p>In our test (which is considered as an extension) we created an observer 
(<code>Observer</code> class)
+which simply store and log each received date.</p>
+</div>
+<div class="paragraph">
 <p>The test itself (<code>EventTest</code>) simply verifies the dates were 
received.</p>
-<h1>Conclusion</h1>
-<p>CDI let's you implement very easily plugins through this event mecanism.</p>
-<p>If you go further and look at CDI plugin API you'll realize it is simply 
the same kind of events. CDI events is really the basis of CDI.</p>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_conclusion">Conclusion</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>CDI let&#8217;s you implement very easily plugins through this event 
mecanism.</p>
+</div>
+<div class="paragraph">
+<p>If you go further and look at CDI plugin API you&#8217;ll realize it is 
simply the same kind
+of events. CDI events is really the basis of CDI.</p>
+</div>
+</div>
+</div>
             </div>
             
         </div>

Modified: tomee/site/trunk/content/tomee-8.0/examples/cdi-interceptors.html
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/content/tomee-8.0/examples/cdi-interceptors.html?rev=1849998&r1=1849997&r2=1849998&view=diff
==============================================================================
--- tomee/site/trunk/content/tomee-8.0/examples/cdi-interceptors.html (original)
+++ tomee/site/trunk/content/tomee-8.0/examples/cdi-interceptors.html Sun Dec 
30 19:02:51 2018
@@ -95,102 +95,186 @@
         <div class="row">
             
             <div class="col-md-12">
-                <p>Let's write a simple application that would allow us to 
book tickets for a movie show. As with all applications, logging is one 
cross-cutting concern that we have. Apart from that, there are some methods in 
our application, that can be accessed only in the working hours. If accessed at 
non-working-hours we'll throw out an AccessDeniedException.</p>
-<p>How do we mark which methods are to be intercepted? Wouldn't it be handy to 
annotate a method like</p>
-<pre><code>@Log
-public void aMethod(){...}
-</code></pre>
+                <div id="preamble">
+<div class="sectionbody">
+<div class="paragraph">
+<p>Let&#8217;s write a simple application that would allow us to book tickets 
for a movie show. As with all applications, logging is one cross-cutting 
concern that we have. Apart from that, there are some methods in our 
application, that can be accessed only in the working hours. If accessed at 
non-working-hours we&#8217;ll throw out an AccessDeniedException.</p>
+</div>
+<div class="paragraph">
+<p>How do we mark which methods are to be intercepted? Wouldn&#8217;t it be 
handy to annotate a method like</p>
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>@Log
+public void aMethod(){...}</pre>
+</div>
+</div>
+<div class="paragraph">
 <p>or</p>
-<pre><code>@TimeRestricted
-public void bMethod(){...}
-</code></pre>
-<p>Let's create these annotations that would "mark" a method for 
interception.</p>
-<pre><code>@InterceptorBinding
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>@TimeRestricted
+public void bMethod(){...}</pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Let&#8217;s create these annotations that would "mark" a method for 
interception.</p>
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>@InterceptorBinding
 @Target({ TYPE, METHOD })
 @Retention(RUNTIME)
 public @interface Log {
-}
-</code></pre>
+}</pre>
+</div>
+</div>
+<div class="paragraph">
 <p>And</p>
-<pre><code>@InterceptorBinding
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>@InterceptorBinding
 @Target({ TYPE, METHOD })
 @Retention(RUNTIME)
 public @interface TimeRestricted {
-}
-</code></pre>
-<p>Sure, you haven't missed the <code>@InterceptorBinding</code> annotation 
above! Now that our custom annotations are created, lets attach them (or to use 
a better term for it, "bind them") to interceptors.</p>
-<p>So here's our logging interceptor. An <code>@AroundInvoke</code> method and 
we are almost done.</p>
-<pre><code>@Interceptor
+}</pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Sure, you haven&#8217;t missed the <code>@InterceptorBinding</code> 
annotation above! Now that our custom annotations are created, lets attach them 
(or to use a better term for it, "bind them") to interceptors.</p>
+</div>
+<div class="paragraph">
+<p>So here&#8217;s our logging interceptor. An <code>@AroundInvoke</code> 
method and we are almost done.</p>
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>@Interceptor
 @Log  //binding the interceptor here. now any method annotated with @Log would 
be intercepted by logMethodEntry
 public class BookForAShowLoggingInterceptor implements Serializable {
     private static final long serialVersionUID = 8139854519874743530L;
-    private Logger logger = 
Logger.getLogger(&quot;BookForAShowApplicationLogger&quot;);
+    private Logger logger = Logger.getLogger("BookForAShowApplicationLogger");
     @AroundInvoke
     public Object logMethodEntry(InvocationContext ctx) throws Exception {
-        logger.info(&quot;Before entering method:&quot; + 
ctx.getMethod().getName());
+        logger.info("Before entering method:" + ctx.getMethod().getName());
         
InterceptionOrderTracker.getMethodsInterceptedList().add(ctx.getMethod().getName());
         
InterceptionOrderTracker.getInterceptedByList().add(this.getClass().getSimpleName());
         return ctx.proceed();
     }
-}
-</code></pre>
+}</pre>
+</div>
+</div>
+<div class="paragraph">
 <p>Now the <code>@Log</code> annotation we created is bound to this 
interceptor. (Likewise we bind <code>@TimeRestrict</code> for 
<code>TimeBasedRestrictingInterceptor</code>. See links below for source)</p>
-<p>That done, let's annotate at class-level or method-level and have fun 
intercepting!</p>
-<pre><code>@Log
+</div>
+<div class="paragraph">
+<p>That done, let&#8217;s annotate at class-level or method-level and have fun 
intercepting!</p>
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>@Log
 @Stateful
 public class BookForAShowOneInterceptorApplied implements Serializable {
     private static final long serialVersionUID = 6350400892234496909L;
     public List&lt;String&gt; getMoviesList() {
         List&lt;String&gt; moviesAvailable = new ArrayList&lt;String&gt;();
-        moviesAvailable.add(&quot;12 Angry Men&quot;);
-        moviesAvailable.add(&quot;Kings speech&quot;);
+        moviesAvailable.add("12 Angry Men");
+        moviesAvailable.add("Kings speech");
         return moviesAvailable;
     }
     public Integer getDiscountedPrice(int ticketPrice) {
         return ticketPrice - 50;
     }
     // assume more methods are present
-}
-</code></pre>
+}</pre>
+</div>
+</div>
+<div class="paragraph">
 <p>The <code>@Log</code> annotation applied at class level denotes that all 
the methods should be intercepted with 
<code>BookForAShowLoggingInterceptor</code>.</p>
-<p>Before we say "all done" there's one last thing we are left with! To enable 
the interceptors!</p>
+</div>
+<div class="paragraph">
+<p>Before we say "all done" there&#8217;s one last thing we are left with! To 
enable the interceptors!</p>
+</div>
+<div class="paragraph">
 <p>Lets quickly put up a <code>beans.xml</code> file like the following in 
<code>src/main/resources/META-INF/beans.xml</code>:</p>
-<pre><code>&lt;beans&gt;
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>&lt;beans&gt;
   &lt;interceptors&gt;
     
&lt;class&gt;org.superbiz.cdi.bookshow.interceptors.BookForAShowLoggingInterceptor
     &lt;/class&gt;
     
&lt;class&gt;org.superbiz.cdi.bookshow.interceptors.TimeBasedRestrictingInterceptor
     &lt;/class&gt;
   &lt;/interceptors&gt;
-&lt;/beans&gt;
-</code></pre>
-<p>By default, a bean archive has no enabled interceptors; an interceptor must 
be explicitly enabled by listing its class in the <code>beans.xml</code>.</p>
-<p>The order of the interceptor annotations has no real significance. Eg:</p>
-<pre><code>@TimeRestrict
+&lt;/beans&gt;</pre>
+</div>
+</div>
+<div class="paragraph">
+<p>By default, a bean archive has no enabled interceptors; an interceptor must 
be explicitly enabled by listing its class
+in the <code>beans.xml</code>.</p>
+</div>
+<div class="paragraph">
+<p>The order of the interceptor annotations has no real significance.
+Eg:</p>
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>@TimeRestrict
 @Log
-void cMethod(){}
-</code></pre>
+void cMethod(){}</pre>
+</div>
+</div>
+<div class="paragraph">
 <p>It is the <code>interceptor</code> elements in <code>beans.xml</code> that 
not only "enable" the interceptors, but also define the "order of execution" of 
the interceptors. In this case the <code>BookForAShowLoggingInterceptor</code> 
would be applied first and then <code>TimeBasedRestrictingInterceptor</code></p>
+</div>
+<div class="paragraph">
 <p>So now you know that the order is only determined by the order within the 
<code>interceptors</code> element within the <code>beans.xml</code>. The rule 
is simple, interceptors which occur earlier in the list are called first.</p>
+</div>
+<div class="paragraph">
 <p>Also note that a method can be marked for interception using multiple 
interceptors by applying multiple annotations as above.</p>
-<p>This brings us to another question. In the above case there were two 
interceptors applied together. What if I would require about 4 such 
interceptors that would go along.... Having to annotate so much makes the code 
a little clumsy?</p>
+</div>
+<div class="paragraph">
+<p>This brings us to another question. In the above case there were two 
interceptors applied together. What if I would require about 4 such 
interceptors that would go along&#8230;&#8203;. Having to annotate so much 
makes the code a little clumsy?</p>
+</div>
+<div class="paragraph">
 <p>No worries! Just create a custom annotation which inherits from others</p>
-<pre><code>@Inherited
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>@Inherited
 @InterceptorBinding
 @Target({ TYPE, METHOD })
 @Retention(RUNTIME)
 @Log
 @TimeRestricted
 public @interface TimeRestrictAndLog {
-}
-</code></pre>
+}</pre>
+</div>
+</div>
+<div class="paragraph">
 <p>This is interceptor binding inheritance.</p>
+</div>
+<div class="paragraph">
 <p>The code below demonstrates the many cases that we have discussed.</p>
+</div>
+<div class="paragraph">
 <p>Not to forget, the old style binding with 
<code>@Interceptors(WhicheverInterceptor.class)</code> is also supported. Have 
a look at <code>BookForAShowOldStyleInterceptorBinding</code> where the 
comments explain how the newer way discussed above is better.</p>
-<h1>The Code</h1>
-<h2>BookForAShowOneInterceptorApplied</h2>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_the_code">The Code</h2>
+<div class="sectionbody">
+<div class="sect2">
+<h3 
id="_bookforashowoneinterceptorapplied">BookForAShowOneInterceptorApplied</h3>
+<div class="paragraph">
 <p><code>BookForAShowOneInterceptorApplied</code> shows a simple 
<code>@Log</code> interceptor applied.</p>
-<pre><code>package org.superbiz.cdi.bookshow.beans;
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.bookshow.beans;
 
 import org.superbiz.cdi.bookshow.interceptorbinding.Log;
 
@@ -206,19 +290,26 @@ public class BookForAShowOneInterceptorA
 
     public List&lt;String&gt; getMoviesList() {
         List&lt;String&gt; moviesAvailable = new ArrayList&lt;String&gt;();
-        moviesAvailable.add(&quot;12 Angry Men&quot;);
-        moviesAvailable.add(&quot;Kings speech&quot;);
+        moviesAvailable.add("12 Angry Men");
+        moviesAvailable.add("Kings speech");
         return moviesAvailable;
     }
 
     public Integer getDiscountedPrice(int ticketPrice) {
         return ticketPrice - 50;
     }
-}
-</code></pre>
-<h2>BookForAShowTwoInterceptorsApplied</h2>
+}</pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 
id="_bookforashowtwointerceptorsapplied">BookForAShowTwoInterceptorsApplied</h3>
+<div class="paragraph">
 <p><code>BookForAShowTwoInterceptorsApplied</code> shows both 
<code>@Log</code> and <code>@TimeRestricted</code> being applied.</p>
-<pre><code>package org.superbiz.cdi.bookshow.beans;
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.bookshow.beans;
 
 import org.superbiz.cdi.bookshow.interceptorbinding.Log;
 import org.superbiz.cdi.bookshow.interceptorbinding.TimeRestricted;
@@ -235,8 +326,8 @@ public class BookForAShowTwoInterceptors
 
     public List&lt;String&gt; getMoviesList() {
         List&lt;String&gt; moviesAvailable = new ArrayList&lt;String&gt;();
-        moviesAvailable.add(&quot;12 Angry Men&quot;);
-        moviesAvailable.add(&quot;Kings speech&quot;);
+        moviesAvailable.add("12 Angry Men");
+        moviesAvailable.add("Kings speech");
         return moviesAvailable;
     }
 
@@ -244,11 +335,18 @@ public class BookForAShowTwoInterceptors
     public Integer getDiscountedPrice(int ticketPrice) {
         return ticketPrice - 50;
     }
-}
-</code></pre>
-<h2>BookShowInterceptorBindingInheritanceExplored</h2>
-<p><code>BookShowInterceptorBindingInheritanceExplored</code> shows how 
<code>@TimeRestrictAndLog</code> (interceptor-binding-inheritance) can be used 
as an alternative for annotating a method with multiple annotations 
explicitly.</p>
-<pre><code>package org.superbiz.cdi.bookshow.beans;
+}</pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 
id="_bookshowinterceptorbindinginheritanceexplored">BookShowInterceptorBindingInheritanceExplored</h3>
+<div class="paragraph">
+<p><code>BookShowInterceptorBindingInheritanceExplored</code> shows how 
<code>@TimeRestrictAndLog</code> (interceptor-binding-inheritance) can  be used 
as an alternative for annotating a method with multiple annotations 
explicitly.</p>
+</div>
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.bookshow.beans;
 
 import org.superbiz.cdi.bookshow.interceptorbinding.TimeRestrictAndLog;
 
@@ -263,8 +361,8 @@ public class BookShowInterceptorBindingI
 
     public List&lt;String&gt; getMoviesList() {
         List&lt;String&gt; moviesAvailable = new ArrayList&lt;String&gt;();
-        moviesAvailable.add(&quot;12 Angry Men&quot;);
-        moviesAvailable.add(&quot;Kings speech&quot;);
+        moviesAvailable.add("12 Angry Men");
+        moviesAvailable.add("Kings speech");
         return moviesAvailable;
     }
 
@@ -272,8 +370,12 @@ public class BookShowInterceptorBindingI
     public Integer getDiscountedPrice(int ticketPrice) {
         return ticketPrice - 50;
     }
-}
-</code></pre>
+}</pre>
+</div>
+</div>
+</div>
+</div>
+</div>
             </div>
             
         </div>

Modified: tomee/site/trunk/content/tomee-8.0/examples/cdi-produces-disposes.html
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/content/tomee-8.0/examples/cdi-produces-disposes.html?rev=1849998&r1=1849997&r2=1849998&view=diff
==============================================================================
--- tomee/site/trunk/content/tomee-8.0/examples/cdi-produces-disposes.html 
(original)
+++ tomee/site/trunk/content/tomee-8.0/examples/cdi-produces-disposes.html Sun 
Dec 30 19:02:51 2018
@@ -95,16 +95,42 @@
         <div class="row">
             
             <div class="col-md-12">
-                <p>This example shows how the @Produces and @Disposes 
annotations work. A LogFactory creates an instance of the LogHandler depending 
on a "type" attribute. For the purposes of this example, the type is hard-coded 
to a specific value. A Logger implementation shall contain a list of 
LogHandlers. We shall have three implementations of the LogHandler 
interface.</p>
+                <div id="preamble">
+<div class="sectionbody">
+<div class="paragraph">
+<p>This example shows how the @Produces and @Disposes annotations work. A 
LogFactory creates an instance of the LogHandler
+depending on a "type" attribute. For the purposes of this example, the type is 
hard-coded to a specific value.
+A Logger implementation shall contain a list of LogHandlers. We shall have 
three implementations of the LogHandler interface.</p>
+</div>
+<div class="ulist">
 <ul>
-  <li>A DatabaseHandler</li>
-  <li>A FileHandler</li>
-  <li>A ConsoleHandler</li>
+<li>
+<p>A DatabaseHandler</p>
+</li>
+<li>
+<p>A FileHandler</p>
+</li>
+<li>
+<p>A ConsoleHandler</p>
+</li>
 </ul>
-<p>The DatabaseHandler would seemingly write the logs to a database. The 
FileHandler would write the same logs to a file. The ConsoleHandler would just 
print the logs to a console (Standard out). This example is just an 
illustration of how the concepts within CDI work and is not intended to provide 
a logging framework design/implementation.</p>
+</div>
+<div class="paragraph">
+<p>The DatabaseHandler would seemingly write the logs to a database. The 
FileHandler would write the same logs to a file.
+The ConsoleHandler would just print the logs to a console (Standard out). This 
example is just an illustration of how
+the concepts within CDI work and is not intended to provide a logging 
framework design/implementation.</p>
+</div>
+<div class="paragraph">
 <p><em>Help us finish documenting this example! Click the blue pencil icon in 
the upper right to edit this page.</em></p>
-<h2>ConsoleHandler</h2>
-<pre><code>package org.superbiz.cdi.produces.disposes;
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_consolehandler">ConsoleHandler</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.produces.disposes;
 
 public class ConsoleHandler implements LogHandler {
 
@@ -121,12 +147,19 @@ public class ConsoleHandler implements L
 
     @Override
     public void writeLog(String s) {
-        System.out.printf(&quot;##### Handler: %s, Writing to the 
console!\n&quot;, getName());
+        System.out.printf("##### Handler: %s, Writing to the console!\n", 
getName());
     }
-}
-</code></pre>
-<h2>DatabaseHandler</h2>
-<pre><code>package org.superbiz.cdi.produces.disposes;
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_databasehandler">DatabaseHandler</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.produces.disposes;
 
 public class DatabaseHandler implements LogHandler {
 
@@ -143,13 +176,20 @@ public class DatabaseHandler implements
 
     @Override
     public void writeLog(String s) {
-        System.out.printf(&quot;##### Handler: %s, Writing to the 
database!\n&quot;, getName());
+        System.out.printf("##### Handler: %s, Writing to the database!\n", 
getName());
         // Use connection to write log to database
     }
-}
-</code></pre>
-<h2>FileHandler</h2>
-<pre><code>package org.superbiz.cdi.produces.disposes;
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_filehandler">FileHandler</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.produces.disposes;
 
 public class FileHandler implements LogHandler {
 
@@ -166,13 +206,20 @@ public class FileHandler implements LogH
 
     @Override
     public void writeLog(String s) {
-        System.out.printf(&quot;##### Handler: %s, Writing to the 
file!\n&quot;, getName());
+        System.out.printf("##### Handler: %s, Writing to the file!\n", 
getName());
         // Write to log file
     }
-}
-</code></pre>
-<h2>LogFactory</h2>
-<pre><code>package org.superbiz.cdi.produces.disposes;
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_logfactory">LogFactory</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.produces.disposes;
 
 import javax.enterprise.inject.Disposes;
 import javax.enterprise.inject.Produces;
@@ -185,47 +232,61 @@ public class LogFactory {
     public LogHandler getLogHandler() {
         switch (type) {
             case 1:
-                return new FileHandler(&quot;@Produces created 
FileHandler!&quot;);
+                return new FileHandler("@Produces created FileHandler!");
             case 2:
-                return new DatabaseHandler(&quot;@Produces created 
DatabaseHandler!&quot;);
+                return new DatabaseHandler("@Produces created 
DatabaseHandler!");
             case 3:
             default:
-                return new ConsoleHandler(&quot;@Produces created 
ConsoleHandler!&quot;);
+                return new ConsoleHandler("@Produces created ConsoleHandler!");
         }
     }
 
     public void closeLogHandler(@Disposes LogHandler handler) {
         switch (type) {
             case 1:
-                System.out.println(&quot;Closing File handler!&quot;);
+                System.out.println("Closing File handler!");
                 break;
             case 2:
-                System.out.println(&quot;Closing DB handler!&quot;);
+                System.out.println("Closing DB handler!");
                 break;
             case 3:
             default:
-                System.out.println(&quot;Closing Console handler!&quot;);
+                System.out.println("Closing Console handler!");
         }
     }
-}
-</code></pre>
-<h2>Logger</h2>
-<pre><code>package org.superbiz.cdi.produces.disposes;
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_logger">Logger</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.produces.disposes;
 
 public interface Logger {
 
     public void log(String s);
 
     public LogHandler getHandler();
-}
-</code></pre>
-<h2>LoggerImpl</h2>
-<pre><code>package org.superbiz.cdi.produces.disposes;
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_loggerimpl">LoggerImpl</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.produces.disposes;
 
 import javax.inject.Inject;
 import javax.inject.Named;
 
-@Named(&quot;logger&quot;)
+@Named("logger")
 public class LoggerImpl implements Logger {
 
     @Inject
@@ -239,27 +300,48 @@ public class LoggerImpl implements Logge
     public LogHandler getHandler() {
         return handler;
     }
-}
-</code></pre>
-<h2>LogHandler</h2>
-<pre><code>package org.superbiz.cdi.produces.disposes;
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_loghandler">LogHandler</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.produces.disposes;
 
 public interface LogHandler {
 
     public String getName();
 
     public void writeLog(String s);
-}
-</code></pre>
-<h2>beans.xml</h2>
-<pre><code>&lt;beans xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot; 
xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
-       xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee
-                            
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd&quot;&gt;
-
-&lt;/beans&gt;
-</code></pre>
-<h2>LoggerTest</h2>
-<pre><code>package org.superbiz.cdi.produces.disposes;
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_beans_xml">beans.xml</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>&lt;beans xmlns="http://java.sun.com/xml/ns/javaee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+                            
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"&gt;
+
+&lt;/beans&gt;</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_loggertest">LoggerTest</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.produces.disposes;
 
 import org.junit.After;
 import org.junit.Before;
@@ -284,7 +366,7 @@ public class LoggerTest {
     public void setUp() {
         try {
             ctxt = EJBContainer.createEJBContainer().getContext();
-            ctxt.bind(&quot;inject&quot;, this);
+            ctxt.bind("inject", this);
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -293,7 +375,7 @@ public class LoggerTest {
     @After
     public void cleanUp() {
         try {
-            ctxt.unbind(&quot;inject&quot;);
+            ctxt.unbind("inject");
             ctxt.close();
         } catch (Exception e) {
             e.printStackTrace();
@@ -303,17 +385,22 @@ public class LoggerTest {
     @Test
     public void testLogHandler() {
         assertNotNull(logger);
-        assertFalse(&quot;Handler should not be a ConsoleHandler&quot;, 
logger.getHandler() instanceof ConsoleHandler);
-        assertFalse(&quot;Handler should not be a FileHandler&quot;, 
logger.getHandler() instanceof FileHandler);
-        assertTrue(&quot;Handler should be a DatabaseHandler&quot;, 
logger.getHandler() instanceof DatabaseHandler);
-        logger.log(&quot;##### Testing write\n&quot;);
+        assertFalse("Handler should not be a ConsoleHandler", 
logger.getHandler() instanceof ConsoleHandler);
+        assertFalse("Handler should not be a FileHandler", logger.getHandler() 
instanceof FileHandler);
+        assertTrue("Handler should be a DatabaseHandler", logger.getHandler() 
instanceof DatabaseHandler);
+        logger.log("##### Testing write\n");
         logger = null;
     }
 
-}
-</code></pre>
-<h1>Running</h1>
-<pre><code>-------------------------------------------------------
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<h1 id="_running" class="sect0">Running</h1>
+<div class="literalblock">
+<div class="content">
+<pre>-------------------------------------------------------
  T E S T S
 -------------------------------------------------------
 Running org.superbiz.cdi.produces.disposes.LoggerTest
@@ -321,7 +408,7 @@ Apache OpenEJB 4.0.0-beta-1    build: 20
 http://tomee.apache.org/
 INFO - openejb.home = /Users/dblevins/examples/cdi-produces-disposes
 INFO - openejb.base = /Users/dblevins/examples/cdi-produces-disposes
-INFO - Using &#39;javax.ejb.embeddable.EJBContainer=true&#39;
+INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
 INFO - Configuring Service(id=Default Security Service, type=SecurityService, 
provider-id=Default Security Service)
 INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
 INFO - Found EjbModule in classpath: 
/Users/dblevins/examples/cdi-produces-disposes/target/classes
@@ -329,12 +416,12 @@ INFO - Beginning load: /Users/dblevins/e
 INFO - Configuring enterprise application: 
/Users/dblevins/examples/cdi-produces-disposes
 INFO - Configuring Service(id=Default Managed Container, type=Container, 
provider-id=Default Managed Container)
 INFO - Auto-creating a container for bean cdi-produces-disposes.Comp: 
Container(type=MANAGED, id=Default Managed Container)
-INFO - Enterprise application 
&quot;/Users/dblevins/examples/cdi-produces-disposes&quot; loaded.
+INFO - Enterprise application "/Users/dblevins/examples/cdi-produces-disposes" 
loaded.
 INFO - Assembling app: /Users/dblevins/examples/cdi-produces-disposes
-INFO - 
Jndi(name=&quot;java:global/cdi-produces-disposes/cdi-produces-disposes.Comp!org.apache.openejb.BeanContext$Comp&quot;)
-INFO - 
Jndi(name=&quot;java:global/cdi-produces-disposes/cdi-produces-disposes.Comp&quot;)
-INFO - 
Jndi(name=&quot;java:global/EjbModule10202458/org.superbiz.cdi.produces.disposes.LoggerTest!org.superbiz.cdi.produces.disposes.LoggerTest&quot;)
-INFO - 
Jndi(name=&quot;java:global/EjbModule10202458/org.superbiz.cdi.produces.disposes.LoggerTest&quot;)
+INFO - 
Jndi(name="java:global/cdi-produces-disposes/cdi-produces-disposes.Comp!org.apache.openejb.BeanContext$Comp")
+INFO - 
Jndi(name="java:global/cdi-produces-disposes/cdi-produces-disposes.Comp")
+INFO - 
Jndi(name="java:global/EjbModule10202458/org.superbiz.cdi.produces.disposes.LoggerTest!org.superbiz.cdi.produces.disposes.LoggerTest")
+INFO - 
Jndi(name="java:global/EjbModule10202458/org.superbiz.cdi.produces.disposes.LoggerTest")
 INFO - Created Ejb(deployment-id=cdi-produces-disposes.Comp, 
ejb-name=cdi-produces-disposes.Comp, container=Default Managed Container)
 INFO - Created 
Ejb(deployment-id=org.superbiz.cdi.produces.disposes.LoggerTest, 
ejb-name=org.superbiz.cdi.produces.disposes.LoggerTest, container=Default 
Managed Container)
 INFO - Started Ejb(deployment-id=cdi-produces-disposes.Comp, 
ejb-name=cdi-produces-disposes.Comp, container=Default Managed Container)
@@ -345,8 +432,9 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
 
 Results :
 
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
-</code></pre>
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0</pre>
+</div>
+</div>
             </div>
             
         </div>

Modified: tomee/site/trunk/content/tomee-8.0/examples/cdi-produces-field.html
URL: 
http://svn.apache.org/viewvc/tomee/site/trunk/content/tomee-8.0/examples/cdi-produces-field.html?rev=1849998&r1=1849997&r2=1849998&view=diff
==============================================================================
--- tomee/site/trunk/content/tomee-8.0/examples/cdi-produces-field.html 
(original)
+++ tomee/site/trunk/content/tomee-8.0/examples/cdi-produces-field.html Sun Dec 
30 19:02:51 2018
@@ -88,23 +88,52 @@
           <div class="col-md-12">
             <div class='page-header'>
               
-              <h1>CDI field producer</h1>
+              <h1>CDI Field Producer</h1>
             </div>
           </div>
         </div>
         <div class="row">
             
             <div class="col-md-12">
-                <p>This example shows the usage of the @Produces annotation. 
@Produces is a CDI mechanism which allows defining a source<br/> for injection. 
This example shows one of two ways of declaring a producer. Instead of a 
producer method (see CDI-produces-disposes example)<br/>a producer field can be 
used. A producer field can be used instead of a simple getter method. It could 
be used to inject resources, such as persistence contexts. One caveat to using 
producer fields over producer<br/> methods is that a @Disposes method cannot be 
used in conjunction with @Produces field.</p>
-<p>For the purposes of this example, the type is hard-coded to a specific 
value. A Logger implementation shall contain a list of LogHandlers. We shall 
have three implementations of the LogHandler interface.</p>
+                <div id="preamble">
+<div class="sectionbody">
+<div class="paragraph">
+<p>This example shows the usage of the @Produces annotation. @Produces is a 
CDI mechanism which allows defining a source
+ for injection. This example shows one of two ways of declaring a producer. 
Instead of a producer method (see CDI-produces-disposes example)
+a producer field can be used. A producer field can be used instead of a simple 
getter method. It could be used to
+inject resources, such as persistence contexts. One caveat to using producer 
fields over producer
+ methods is that a @Disposes method cannot be used in conjunction with 
@Produces field.</p>
+</div>
+<div class="paragraph">
+<p>For the purposes of this example, the type is hard-coded to a specific 
value.
+A Logger implementation shall contain a list of LogHandlers. We shall have 
three implementations of the LogHandler interface.</p>
+</div>
+<div class="ulist">
 <ul>
-  <li>A DatabaseHandler</li>
-  <li>A FileHandler</li>
-  <li>A ConsoleHandler</li>
+<li>
+<p>A DatabaseHandler</p>
+</li>
+<li>
+<p>A FileHandler</p>
+</li>
+<li>
+<p>A ConsoleHandler</p>
+</li>
 </ul>
-<p>The DatabaseHandler would seemingly write the logs to a database. The 
FileHandler would write the same logs to a file. The ConsoleHandler would just 
print the logs to a console (Standard out). This example is just an 
illustration of how the concepts within CDI work and is not intended to provide 
a logging framework design/implementation.</p>
-<h2>ConsoleHandler</h2>
-<pre><code>package org.superbiz.cdi.produces.field;
+</div>
+<div class="paragraph">
+<p>The DatabaseHandler would seemingly write the logs to a database. The 
FileHandler would write the same logs to a file.
+The ConsoleHandler would just print the logs to a console (Standard out). This 
example is just an illustration of how
+the concepts within CDI work and is not intended to provide a logging 
framework design/implementation.</p>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_consolehandler">ConsoleHandler</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.produces.field;
 
 public class ConsoleHandler implements LogHandler {
 
@@ -121,12 +150,19 @@ public class ConsoleHandler implements L
 
     @Override
     public void writeLog(String s) {
-        System.out.printf(&quot;##### Handler: %s, Writing to the 
console!\n&quot;, getName());
+        System.out.printf("##### Handler: %s, Writing to the console!\n", 
getName());
     }
-}
-</code></pre>
-<h2>DatabaseHandler</h2>
-<pre><code>package org.superbiz.cdi.produces.field;
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_databasehandler">DatabaseHandler</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.produces.field;
 
 public class DatabaseHandler implements LogHandler {
 
@@ -143,13 +179,20 @@ public class DatabaseHandler implements
 
     @Override
     public void writeLog(String s) {
-        System.out.printf(&quot;##### Handler: %s, Writing to the 
database!\n&quot;, getName());
+        System.out.printf("##### Handler: %s, Writing to the database!\n", 
getName());
         // Use connection to write log to database
     }
-}
-</code></pre>
-<h2>FileHandler</h2>
-<pre><code>package org.superbiz.cdi.produces.field;
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_filehandler">FileHandler</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.produces.field;
 
 public class FileHandler implements LogHandler {
 
@@ -166,13 +209,20 @@ public class FileHandler implements LogH
 
     @Override
     public void writeLog(String s) {
-        System.out.printf(&quot;##### Handler: %s, Writing to the 
file!\n&quot;, getName());
+        System.out.printf("##### Handler: %s, Writing to the file!\n", 
getName());
         // Write to log file
     }
-}
-</code></pre>
-<h2>LogFactory</h2>
-<pre><code>package org.superbiz.cdi.produces.field;
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_logfactory">LogFactory</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.produces.field;
 
 import javax.enterprise.inject.Produces;
 
@@ -184,40 +234,54 @@ public class LogFactory {
     LogHandler handler;
 
     public LogFactory(){
-        handler = getLogHandler();
+       handler = getLogHandler();
     }
 
     public LogHandler getLogHandler() {
         switch (type) {
             case 1:
-                return new FileHandler(&quot;@Produces created 
FileHandler!&quot;);
+                return new FileHandler("@Produces created FileHandler!");
             case 2:
-                return new DatabaseHandler(&quot;@Produces created 
DatabaseHandler!&quot;);
+                return new DatabaseHandler("@Produces created 
DatabaseHandler!");
             case 3:
             default:
-                return new ConsoleHandler(&quot;@Produces created 
ConsoleHandler!&quot;);
+                return new ConsoleHandler("@Produces created ConsoleHandler!");
         }
 
     }
-}
-</code></pre>
-<h2>Logger</h2>
-<pre><code>package org.superbiz.cdi.produces.field;
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_logger">Logger</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.produces.field;
 
 public interface Logger {
 
     public void log(String s);
 
     public LogHandler getHandler();
-}
-</code></pre>
-<h2>LoggerImpl</h2>
-<pre><code>package org.superbiz.cdi.produces.field;
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_loggerimpl">LoggerImpl</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.produces.field;
 
 import javax.inject.Inject;
 import javax.inject.Named;
 
-@Named(&quot;logger&quot;)
+@Named("logger")
 public class LoggerImpl implements Logger {
 
     @Inject
@@ -231,27 +295,48 @@ public class LoggerImpl implements Logge
     public LogHandler getHandler() {
         return handler;
     }
-}
-</code></pre>
-<h2>LogHandler</h2>
-<pre><code>package org.superbiz.cdi.produces.field;
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_loghandler">LogHandler</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.produces.field;
 
 public interface LogHandler {
 
     public String getName();
 
     public void writeLog(String s);
-}
-</code></pre>
-<h2>beans.xml</h2>
-<pre><code>&lt;beans xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot; 
xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
-       xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee
-                            
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd&quot;&gt;
-
-&lt;/beans&gt;
-</code></pre>
-<h2>LoggerTest</h2>
-<pre><code>package org.superbiz.cdi.produces.field;
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_beans_xml">beans.xml</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>&lt;beans xmlns="http://java.sun.com/xml/ns/javaee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+                            
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"&gt;
+
+&lt;/beans&gt;</pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_loggertest">LoggerTest</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre>package org.superbiz.cdi.produces.field;
 
 import org.junit.After;
 import org.junit.Before;
@@ -276,7 +361,7 @@ public class LoggerTest {
     public void setUp() {
         try {
             ctxt = EJBContainer.createEJBContainer().getContext();
-            ctxt.bind(&quot;inject&quot;, this);
+            ctxt.bind("inject", this);
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -285,7 +370,7 @@ public class LoggerTest {
     @After
     public void cleanUp() {
         try {
-            ctxt.unbind(&quot;inject&quot;);
+            ctxt.unbind("inject");
             ctxt.close();
         } catch (Exception e) {
             e.printStackTrace();
@@ -295,17 +380,22 @@ public class LoggerTest {
     @Test
     public void testLogHandler() {
         assertNotNull(logger);
-        assertFalse(&quot;Handler should not be a ConsoleHandler&quot;, 
logger.getHandler() instanceof ConsoleHandler);
-        assertFalse(&quot;Handler should not be a FileHandler&quot;, 
logger.getHandler() instanceof FileHandler);
-        assertTrue(&quot;Handler should be a DatabaseHandler&quot;, 
logger.getHandler() instanceof DatabaseHandler);
-        logger.log(&quot;##### Testing write\n&quot;);
+        assertFalse("Handler should not be a ConsoleHandler", 
logger.getHandler() instanceof ConsoleHandler);
+        assertFalse("Handler should not be a FileHandler", logger.getHandler() 
instanceof FileHandler);
+        assertTrue("Handler should be a DatabaseHandler", logger.getHandler() 
instanceof DatabaseHandler);
+        logger.log("##### Testing write\n");
         logger = null;
     }
 
-}
-</code></pre>
-<h1>Running</h1>
-<pre><code>-------------------------------------------------------
+}</pre>
+</div>
+</div>
+</div>
+</div>
+<h1 id="_running" class="sect0">Running</h1>
+<div class="literalblock">
+<div class="content">
+<pre>-------------------------------------------------------
  T E S T S
 -------------------------------------------------------
 Running org.superbiz.cdi.produces.field.LoggerTest
@@ -321,13 +411,13 @@ INFO - openejb.home = /home/daniel/proje
 INFO - openejb.base = 
/home/daniel/projects/openejb/source/openejb/examples/cdi-produces-field
 INFO - Created new singletonService 
org.apache.openejb.cdi.ThreadSingletonServiceImpl@a81b1fb
 INFO - succeeded in installing singleton service
-INFO - Using &#39;javax.ejb.embeddable.EJBContainer=true&#39;
+INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
 INFO - Cannot find the configuration file [conf/openejb.xml].  Will attempt to 
create one for the beans deployed.
 INFO - Configuring Service(id=Default Security Service, type=SecurityService, 
provider-id=Default Security Service)
 INFO - Configuring Service(id=Default Transaction Manager, 
type=TransactionManager, provider-id=Default Transaction Manager)
 INFO - Creating TransactionManager(id=Default Transaction Manager)
 INFO - Creating SecurityService(id=Default Security Service)
-INFO - Inspecting classpath for applications: 26 urls. Consider adjusting your 
exclude/include.  Current settings: 
openejb.deployments.classpath.exclude=&#39;&#39;, 
openejb.deployments.classpath.include=&#39;.*&#39;
+INFO - Inspecting classpath for applications: 26 urls. Consider adjusting your 
exclude/include.  Current settings: openejb.deployments.classpath.exclude='', 
openejb.deployments.classpath.include='.*'
 INFO - Searched 26 classpath urls in 2015 milliseconds.  Average 77 
milliseconds per url.
 INFO - Beginning load: 
/home/daniel/projects/openejb/source/openejb/examples/cdi-produces-field/target/classes
 INFO - Configuring enterprise application: 
/home/daniel/projects/openejb/source/openejb/examples/cdi-produces-field
@@ -336,7 +426,7 @@ INFO - Configuring Service(id=Default Ma
 INFO - Auto-creating a container for bean cdi-produces-field.Comp: 
Container(type=MANAGED, id=Default Managed Container)
 INFO - Creating Container(id=Default Managed Container)
 INFO - Using directory /tmp for stateful session passivation
-INFO - Enterprise application 
&quot;/home/daniel/projects/openejb/source/openejb/examples/cdi-produces-field&quot;
 loaded.
+INFO - Enterprise application 
"/home/daniel/projects/openejb/source/openejb/examples/cdi-produces-field" 
loaded.
 INFO - Assembling app: 
/home/daniel/projects/openejb/source/openejb/examples/cdi-produces-field
 INFO - ignoreXmlConfiguration == true
 INFO - ignoreXmlConfiguration == true
@@ -352,8 +442,9 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
 
 Results :
 
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
-</code></pre>
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0</pre>
+</div>
+</div>
             </div>
             
         </div>


Reply via email to