Updated Branches:
  refs/heads/master a3e57603f -> 8076947db

Update CDI example to use CDI 1.1 with Weld


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

Branch: refs/heads/master
Commit: 8076947dba3d6076593d4766aa63cc756facf249
Parents: a3e5760
Author: Martin Tzvetanov Grigorov <[email protected]>
Authored: Thu Jun 27 11:21:50 2013 +0300
Committer: Martin Tzvetanov Grigorov <[email protected]>
Committed: Thu Jun 27 11:21:50 2013 +0300

----------------------------------------------------------------------
 wicket-examples/pom.xml                         | 23 +++----------
 .../wicket/examples/cdi/CdiApplication.java     | 13 +++----
 wicket-examples/src/main/webapp/WEB-INF/web.xml | 36 +++++++++++---------
 .../wicket/cdi/weld/WeldCdiContainer.java       |  6 ++--
 4 files changed, 31 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/8076947d/wicket-examples/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-examples/pom.xml b/wicket-examples/pom.xml
index 26f9941..699886f 100644
--- a/wicket-examples/pom.xml
+++ b/wicket-examples/pom.xml
@@ -127,29 +127,14 @@
                        <artifactId>slf4j-log4j12</artifactId>
                </dependency>
                <dependency>
-                       <groupId>org.jboss.weld</groupId>
-                       <artifactId>weld-core</artifactId>
-                       <version>1.1.9.Final</version>
-               </dependency>
-               <dependency>
                        <groupId>org.jboss.weld.servlet</groupId>
-                       <artifactId>weld-servlet-core</artifactId>
-                       <version>1.1.9.Final</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.jboss.seam.conversation</groupId>
-                       <artifactId>seam-conversation-weld</artifactId>
-                       <version>3.0.0.Final</version>
-                       <exclusions>
-                               <exclusion>
-                                       
<groupId>org.jboss.spec.javax.servlet</groupId>
-                                       
<artifactId>jboss-servlet-api_3.0_spec</artifactId>
-                               </exclusion>
-                       </exclusions>
+                       <artifactId>weld-servlet</artifactId>
+                       <version>2.0.0.SP1</version>
                </dependency>
                <dependency>
                        <groupId>org.apache.wicket</groupId>
-                       <artifactId>wicket-cdi</artifactId>
+                       <artifactId>wicket-cdi-1.1-weld</artifactId>
+                       <version>0.1-SNAPSHOT</version>
                </dependency>
                <dependency>
                        <groupId>javax.el</groupId>

http://git-wip-us.apache.org/repos/asf/wicket/blob/8076947d/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/CdiApplication.java
----------------------------------------------------------------------
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/CdiApplication.java
 
b/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/CdiApplication.java
index 3f8e688..31e4ba2 100644
--- 
a/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/CdiApplication.java
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/CdiApplication.java
@@ -16,12 +16,10 @@
  */
 package org.apache.wicket.examples.cdi;
 
-import javax.enterprise.inject.spi.BeanManager;
-
 import org.apache.wicket.Page;
 import org.apache.wicket.cdi.CdiConfiguration;
+import org.apache.wicket.cdi.ConversationPropagation;
 import org.apache.wicket.protocol.http.WebApplication;
-import org.jboss.weld.environment.servlet.Listener;
 
 public class CdiApplication extends WebApplication
 {
@@ -37,12 +35,9 @@ public class CdiApplication extends WebApplication
        {
                super.init();
 
-               // lookup bean manager from Weld's servlet listener
-               BeanManager manager = 
(BeanManager)getServletContext().getAttribute(
-                       Listener.BEAN_MANAGER_ATTRIBUTE_NAME);
-
-               // configure wicket/cdi
-               new CdiConfiguration(manager).configure(this);
+               CdiConfiguration.get()
+                               
.setPropagation(ConversationPropagation.NONBOOKMARKABLE)
+                               .configure(this);
 
                mountPage("injection", InjectionPage.class);
                mountPage("conversation", ConversationPage1.class);

http://git-wip-us.apache.org/repos/asf/wicket/blob/8076947d/wicket-examples/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/webapp/WEB-INF/web.xml 
b/wicket-examples/src/main/webapp/WEB-INF/web.xml
index 38799f0..b823524 100644
--- a/wicket-examples/src/main/webapp/WEB-INF/web.xml
+++ b/wicket-examples/src/main/webapp/WEB-INF/web.xml
@@ -770,26 +770,30 @@
                <url-pattern>/cdi/*</url-pattern>
        </filter-mapping>
 
-       <!-- CDI EXAMPLE APPLICATION -->
-       <filter>
-               <filter-name>BeanValidation</filter-name>
-               
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
-               <init-param>
-                 <param-name>applicationClassName</param-name>
-                 
<param-value>org.apache.wicket.examples.bean.validation.BeanValidationApplication</param-value>
-               </init-param>
-       </filter>
-       <filter-mapping>
-               <filter-name>BeanValidation</filter-name>
-               <url-pattern>/bean-validation/*</url-pattern>
-       </filter-mapping>
-
        <listener>
                <!-- initialize Weld in servlet environment -->
                
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
        </listener>
-       <!-- END CDI EXAMPLE APPLICATION -->
-
+    <resource-env-ref>
+        <description>Object factory for the CDI Bean Manager</description>
+        <resource-env-ref-name>BeanManager</resource-env-ref-name>
+        
<resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
+    </resource-env-ref>
+    <!-- END CDI EXAMPLE APPLICATION -->
+
+    <!-- Bean Validation EXAMPLE APPLICATION -->
+    <filter>
+        <filter-name>BeanValidation</filter-name>
+        
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+        <init-param>
+            <param-name>applicationClassName</param-name>
+            
<param-value>org.apache.wicket.examples.bean.validation.BeanValidationApplication</param-value>
+        </init-param>
+    </filter>
+    <filter-mapping>
+        <filter-name>BeanValidation</filter-name>
+        <url-pattern>/bean-validation/*</url-pattern>
+    </filter-mapping>
 
        <!-- LISTENER -->
        <listener>

http://git-wip-us.apache.org/repos/asf/wicket/blob/8076947d/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/main/java/org/apache/wicket/cdi/weld/WeldCdiContainer.java
----------------------------------------------------------------------
diff --git 
a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/main/java/org/apache/wicket/cdi/weld/WeldCdiContainer.java
 
b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/main/java/org/apache/wicket/cdi/weld/WeldCdiContainer.java
index b186ca9..61ea380 100644
--- 
a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/main/java/org/apache/wicket/cdi/weld/WeldCdiContainer.java
+++ 
b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/main/java/org/apache/wicket/cdi/weld/WeldCdiContainer.java
@@ -33,7 +33,7 @@ import org.jboss.weld.context.http.HttpConversationContext;
 public class WeldCdiContainer extends AbstractCdiContainer
 {
        @Inject 
-       Instance<HttpConversationContext> conversationContextSource;
+       private Instance<HttpConversationContext> conversationContextSource;
        
        /**
         * Deactivates conversational context
@@ -42,9 +42,9 @@ public class WeldCdiContainer extends AbstractCdiContainer
         */
        @Override
        public void deactivateConversationalContext(RequestCycle cycle)
-       {           
+       {
                HttpConversationContext conversationContext = 
conversationContextSource.get(); 
-               conversationContext.deactivate();                   
+               conversationContext.deactivate();
                conversationContext.dissociate(getRequest(cycle));
        }
 

Reply via email to