index.xhtml
01 <?xml version='1.0' encoding='UTF-8' ?>
02 <!--
03 
04     DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
05 
06     Copyright (c2018 Oracle and/or its affiliates. All rights reserved.
07 
08     The contents of this file are subject to the terms of either the GNU
09     General Public License Version only ("GPL"or the Common Development
10     and Distribution License("CDDL") (collectively, the "License").  You
11     may not use this file except in compliance with the License.  You can
12     obtain a copy of the License at
13     https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
14     or packager/legal/LICENSE.txt.  See the License for the specific
15     language governing permissions and limitations under the License.
16 
17     When distributing the software, include this License Header Notice in each
18     file and include the License file at packager/legal/LICENSE.txt.
19 
20     GPL Classpath Exception:
21     Oracle designates this particular file as subject to the "Classpath"
22     exception as provided by Oracle in the GPL Version section of the License
23     file that accompanied this code.
24 
25     Modifications:
26     If applicable, add the following below the License Header, with the fields
27     enclosed by brackets [] replaced by your own identifying information:
28     "Portions Copyright [year] [name of copyright owner]"
29 
30     Contributor(s):
31     If you wish your version of this file to be governed by only the CDDL or
32     only the GPL Version 2, indicate your decision by adding "[Contributor]
33     elects to include this software in this distribution under the [CDDL or GPL
34     Version 2] license."  If you don't indicate a single choice of license, a
35     recipient has the option to distribute your version of this file under
36     either the CDDL, the GPL Version or to extend the choice of license to
37     its licensees as provided above.  However, if you add GPL Version code
38     and therefore, elected the GPL Version license, then the option applies
39     only if the new code is made subject to such option by the copyright
40     holder.
41 
42 -->
43 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
44   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
45 
46 <html xmlns="http://www.w3.org/1999/xhtml"
47       xmlns:h="http://java.sun.com/jsf/html"
48       xmlns:ui="http://java.sun.com/jsf/facelets"
49       xmlns:p="http://xmlns.jcp.org/jsf/passthrough">
50 
51 <ui:composition template="template.xhtml">
52   <ui:define name="title">
53     <h:outputText value="Interception Factory in CDI 2.0"></h:outputText>
54   </ui:define>
55 
56   <ui:define name="body">
57     <h3>Interception Factory Introduction</h3>
58 
59     <p>CDI 2.0 introduces the <code>javax.enterprise.inject.spi.InterceptionFactory&lt;T&gt; </code> interface,
60       which allows to create a wrapper instance whose method invocations are intercepted by method
61       interceptors and forwarded to a provided instance. </p>
62     <p>An InterceptionFactory can be obtained by calling <code>BeanManager.createInterceptionFactory()</code> as
63       defined in Obtain an InterceptionFactory.</p>
64 
65     <h3>Description of the Example</h3>
66     <p>This example demonstrates a producer method definition using <code>InterceptionFactory</code>. The
67       produced bean instance will be a wrapper of <code>MyGreetingImpl</code> with single interceptor associated by
68       <code>HelloAdder</code>. First please enter a name, then click the <strong>Submit</strong> button. A complete
69       message including your input and the wrapped message will be displayed.
70     </p>
71 
72     <h3>Use This Example</h3>
73     <h:form id="main">
74       <p>
75         <h:panelGrid columns="2">
76           <h:outputLabel for="name" value="Name: "/>
77           <h:inputText id="name" value="#{webController.name}" size="30" maxlength="60"
78                        p:autofocus="true" p:required="true" p:type="text"/>
79         </h:panelGrid>
80         <h:commandButton id="submit" value="Submit" action="#{webController.message}"/>
81       </p>
82     </h:form>
83     <h:messages globalOnly="true"/>
84   </ui:define>
85 </ui:composition>
86 </html>