You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by pa...@apache.org on 2013/11/26 09:09:33 UTC

[2/4] git commit: Updated the cdi example to wicket-cdi-1.1

Updated the cdi example to wicket-cdi-1.1


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

Branch: refs/heads/wicket-6.x
Commit: a742c6e598f54b31c5cdfdf4be98ca14397a54f8
Parents: 5133c75
Author: Emond Papegaaij <em...@topicus.nl>
Authored: Tue Nov 26 07:51:10 2013 +0100
Committer: Emond Papegaaij <em...@topicus.nl>
Committed: Tue Nov 26 09:09:16 2013 +0100

----------------------------------------------------------------------
 pom.xml                                         | 37 +++++++++++++
 wicket-examples/pom.xml                         | 46 ++--------------
 wicket-examples/src/main/java/log4j.properties  |  1 +
 .../examples/cdi/AutoConversationPage1.html     | 19 +++++++
 .../examples/cdi/AutoConversationPage1.java     | 57 ++++++++++++++++++++
 .../examples/cdi/AutoConversationPage2.html     | 17 ++++++
 .../examples/cdi/AutoConversationPage2.java     | 43 +++++++++++++++
 .../wicket/examples/cdi/CdiApplication.java     |  6 +--
 .../apache/wicket/examples/cdi/CdiHomePage.html |  3 ++
 9 files changed, 181 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/a742c6e5/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 55ea42b..44ae648 100644
--- a/pom.xml
+++ b/pom.xml
@@ -341,6 +341,11 @@
 				<version>0.15-SNAPSHOT</version>
 			</dependency>
 			<dependency>
+				<groupId>org.apache.wicket</groupId>
+				<artifactId>wicket-cdi-1.1</artifactId>
+				<version>0.2-SNAPSHOT</version>
+			</dependency>
+			<dependency>
 				<groupId>junit</groupId>
 				<artifactId>junit</artifactId>
 				<version>4.10</version>
@@ -860,6 +865,38 @@
 						</execution>
 					</executions>
 				</plugin>
+				
+				<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+				<plugin>
+					<groupId>org.eclipse.m2e</groupId>
+					<artifactId>lifecycle-mapping</artifactId>
+					<version>1.0.0</version>
+					<configuration>
+						<lifecycleMappingMetadata>
+							<pluginExecutions>
+								<pluginExecution>
+									<pluginExecutionFilter>
+										<groupId>
+											org.apache.felix
+										</groupId>
+										<artifactId>
+											maven-bundle-plugin
+										</artifactId>
+										<versionRange>
+											[2.3.7,)
+										</versionRange>
+										<goals>
+											<goal>manifest</goal>
+										</goals>
+									</pluginExecutionFilter>
+									<action>
+										<ignore />
+									</action>
+								</pluginExecution>
+							</pluginExecutions>
+						</lifecycleMappingMetadata>
+					</configuration>
+				</plugin>
 			</plugins>
 		</pluginManagement>
 	</build>

http://git-wip-us.apache.org/repos/asf/wicket/blob/a742c6e5/wicket-examples/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-examples/pom.xml b/wicket-examples/pom.xml
index 07747fb..0763a80 100644
--- a/wicket-examples/pom.xml
+++ b/wicket-examples/pom.xml
@@ -124,21 +124,16 @@
 		<dependency>
 			<groupId>org.jboss.weld</groupId>
 			<artifactId>weld-core</artifactId>
-			<version>1.1.9.Final</version>
+			<version>2.1.0.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>
+			<version>2.1.0.Final</version>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.wicket</groupId>
-			<artifactId>wicket-cdi</artifactId>
+			<artifactId>wicket-cdi-1.1</artifactId>
 		</dependency>
 		<dependency>
 			<groupId>javax.el</groupId>
@@ -216,40 +211,5 @@
 				<artifactId>jetty-maven-plugin</artifactId>
 			</plugin>
 		</plugins>
-		<pluginManagement>
-			<plugins>
-				<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
-				<plugin>
-					<groupId>org.eclipse.m2e</groupId>
-					<artifactId>lifecycle-mapping</artifactId>
-					<version>1.0.0</version>
-					<configuration>
-						<lifecycleMappingMetadata>
-							<pluginExecutions>
-								<pluginExecution>
-									<pluginExecutionFilter>
-										<groupId>
-											org.apache.felix
-										</groupId>
-										<artifactId>
-											maven-bundle-plugin
-										</artifactId>
-										<versionRange>
-											[2.3.7,)
-										</versionRange>
-										<goals>
-											<goal>manifest</goal>
-										</goals>
-									</pluginExecutionFilter>
-									<action>
-										<ignore />
-									</action>
-								</pluginExecution>
-							</pluginExecutions>
-						</lifecycleMappingMetadata>
-					</configuration>
-				</plugin>
-			</plugins>
-		</pluginManagement>
 	</build>
 </project>

http://git-wip-us.apache.org/repos/asf/wicket/blob/a742c6e5/wicket-examples/src/main/java/log4j.properties
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/java/log4j.properties b/wicket-examples/src/main/java/log4j.properties
index cde4162..7996b37 100644
--- a/wicket-examples/src/main/java/log4j.properties
+++ b/wicket-examples/src/main/java/log4j.properties
@@ -5,6 +5,7 @@ log4j.logger.org=INFO
 log4j.logger.com=INFO
 log4j.logger.net=INFO
 log4j.logger.nl=INFO
+log4j.logger.jndi=INFO
 
 log4j.logger.org.apache.wicket=WARN
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/a742c6e5/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/AutoConversationPage1.html
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/AutoConversationPage1.html b/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/AutoConversationPage1.html
new file mode 100644
index 0000000..6411b05
--- /dev/null
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/AutoConversationPage1.html
@@ -0,0 +1,19 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
+<body>
+<wicket:extend>
+	<p>
+		This page demonstrates automatic conversation managed. Below is a counter
+		that is conversation-scoped. Click increment a couple of times and then click
+		the 'Continue to next page', the counter value should persist on the
+		next page.
+	</p>
+	<p>
+		Current counter value is: <span wicket:id="count">100</span>
+		<a wicket:id="increment">increment</a>
+	</p>
+	<p>
+		<a wicket:id="next">Continue to next page</a>
+	</p>
+</wicket:extend>
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/a742c6e5/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/AutoConversationPage1.java
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/AutoConversationPage1.java b/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/AutoConversationPage1.java
new file mode 100644
index 0000000..2020638
--- /dev/null
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/AutoConversationPage1.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.examples.cdi;
+
+import javax.enterprise.context.Conversation;
+import javax.inject.Inject;
+
+import org.apache.wicket.cdi.ConversationalComponent;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.model.PropertyModel;
+
+public class AutoConversationPage1 extends CdiExamplePage implements ConversationalComponent
+{
+	@Inject
+	ConversationCounter counter;
+
+	@Inject
+	Conversation conversation;
+
+	public AutoConversationPage1()
+	{
+		add(new Label("count", new PropertyModel(this, "counter.count")));
+
+		add(new Link<Void>("increment")
+		{
+			@Override
+			public void onClick()
+			{
+				counter.increment();
+			}
+		});
+
+		add(new Link<Void>("next")
+		{
+			@Override
+			public void onClick()
+			{
+				setResponsePage(new AutoConversationPage2());
+			}
+		});
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/a742c6e5/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/AutoConversationPage2.html
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/AutoConversationPage2.html b/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/AutoConversationPage2.html
new file mode 100644
index 0000000..bb2d4e1
--- /dev/null
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/AutoConversationPage2.html
@@ -0,0 +1,17 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
+<body>
+<wicket:extend>
+	<p>
+		This page is not marked with ConversationalComponent. Therefore, the conversation that was
+		started on the previous page is ended. Notice the conversational counter injected into this
+		page initially has the same value as in the	previous page, this is because the conversation
+		was still active in the request that rendered this page. However, clicking 'refresh' below,
+		will reset the counter to 0.
+	</p>
+	<p>
+		Current counter value is: <span wicket:id="count">100</span>
+		<a wicket:id="refresh">refresh</a>
+	</p>
+</wicket:extend>
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/a742c6e5/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/AutoConversationPage2.java
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/AutoConversationPage2.java b/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/AutoConversationPage2.java
new file mode 100644
index 0000000..4f08401
--- /dev/null
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/AutoConversationPage2.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.examples.cdi;
+
+import javax.inject.Inject;
+
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.model.PropertyModel;
+
+public class AutoConversationPage2 extends CdiExamplePage
+{
+	@Inject
+	ConversationCounter counter;
+
+	public AutoConversationPage2()
+	{
+		add(new Label("count", new PropertyModel(this, "counter.count")));
+
+		add(new Link<Void>("refresh")
+		{
+			@Override
+			public void onClick()
+			{
+			}
+		});
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/a742c6e5/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 91ed38d..c56d2e7 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
@@ -37,12 +37,8 @@ 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);
+		new CdiConfiguration().configure(this);
 	}
 
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/a742c6e5/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/CdiHomePage.html
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/CdiHomePage.html b/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/CdiHomePage.html
index ef2431a..d750a11 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/CdiHomePage.html
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/CdiHomePage.html
@@ -9,6 +9,9 @@
 		<li>
 			<a href="ConversationPage1.html">Conversation Propagation Example</a>
 		</li>
+		<li>
+			<a href="AutoConversationPage1.html">Automatic Conversation Management Example</a>
+		</li>
 	</ul>
 	</wicket:link>
 </wicket:extend>