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/11 09:36:21 UTC

[1/3] Merged pull request #50

Updated Branches:
  refs/heads/wicket-6.x 92a5bdbdb -> 62fed8f5f


http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/TestCdiConfiguration.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/TestCdiConfiguration.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/TestCdiConfiguration.java
new file mode 100644
index 0000000..0fd63f5
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/TestCdiConfiguration.java
@@ -0,0 +1,87 @@
+/*
+ * 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.cdi.util.tester;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Specializes;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.cdi.Auto;
+import org.apache.wicket.cdi.CdiConfiguration;
+import org.apache.wicket.cdi.ConfigurationParameters;
+import org.apache.wicket.cdi.IConversationPropagation;
+import org.apache.wicket.cdi.IgnoreList;
+import org.apache.wicket.cdi.Propagation;
+
+/**
+ * Specializes the CdiConfigration to allow the ConfigurationParams key to be
+ * remapped after the Application is used to construct the WicketTester.
+ * This is needed because WicketTester generates the ApplicationKey during construction
+ * and does not contain a mechanism to override the name.  In the normal code the WicketFilter
+ * sets the key to the filtername so remapping is not necessary.
+ *
+ * @author jsarman
+ */
+@ApplicationScoped
+@Alternative
+@Specializes
+public class TestCdiConfiguration extends CdiConfiguration
+{
+
+	@PostConstruct
+	@Override
+	public void init()
+	{
+		super.init();
+	}
+
+	public
+	@Produces
+	@Propagation
+	IConversationPropagation getPropagation()
+	{
+		return super.getPropagation();
+	}
+
+
+	public
+	@Produces
+	@Auto
+	@Override
+	Boolean isAutoConversationManagement()
+	{
+		return super.isAutoConversationManagement();
+	}
+
+	public
+	@Produces
+	@IgnoreList
+	@Override
+	String[] getPackagesToIgnore()
+	{
+		return super.getPackagesToIgnore();
+	}
+
+	public void remapApplicationKey(String key, Application app)
+	{
+		ConfigurationParameters cp = parameters.remove(key);
+		parameters.put(app.getApplicationKey(), cp);
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/TestComponentInjector.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/TestComponentInjector.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/TestComponentInjector.java
new file mode 100644
index 0000000..d43448e
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/TestComponentInjector.java
@@ -0,0 +1,50 @@
+/*
+ * 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.cdi.util.tester;
+
+import java.lang.reflect.Modifier;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Specializes;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.cdi.ComponentInjector;
+
+/**
+ * Injects components with CDI dependencies
+ *
+ * @author igor
+ */
+@ApplicationScoped
+@Alternative
+@Specializes
+public class TestComponentInjector extends ComponentInjector
+{
+
+	@Override
+	public void onInstantiation(Component component)
+	{
+		Class instanceClass = component.getClass();
+		if (instanceClass.isAnonymousClass() ||
+				(instanceClass.isMemberClass() && Modifier.isStatic(instanceClass.getModifiers()) == false))
+		{
+			return;
+		}
+		inject(component);
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/TestFilterConfig.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/TestFilterConfig.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/TestFilterConfig.java
new file mode 100644
index 0000000..27a2238
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/TestFilterConfig.java
@@ -0,0 +1,89 @@
+/*
+ * 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.cdi.util.tester;
+
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.UUID;
+
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
+
+/**
+ * @author jsarman
+ */
+public class TestFilterConfig implements FilterConfig
+{
+
+	private String filterName = "CdiApp" + UUID.randomUUID();
+	private Map<String, String> params;
+
+	public TestFilterConfig()
+	{
+		this(null);
+	}
+
+	public TestFilterConfig(Map<String, String> initialParams)
+	{
+		this.params = new TreeMap<String, String>();
+		this.params.put("applicationName", "mockApp");
+		if (initialParams != null)
+		{
+			this.params.putAll(initialParams);
+		}
+	}
+
+	public void put(String paramName, String value)
+	{
+		params.put(paramName, value);
+	}
+
+	public void remove(String paramName)
+	{
+		params.remove(paramName);
+	}
+
+	public void putAll(Map<String, String> additionalParams)
+	{
+		params.putAll(additionalParams);
+	}
+
+	@Override
+	public String getFilterName()
+	{
+		return filterName;
+	}
+
+	@Override
+	public ServletContext getServletContext()
+	{
+		throw new UnsupportedOperationException("This is not supported.");
+	}
+
+	@Override
+	public String getInitParameter(String name)
+	{
+		return params.get(name);
+	}
+
+	@Override
+	public Enumeration<String> getInitParameterNames()
+	{
+		throw new UnsupportedOperationException("This is not Supported.");
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/simplelogger.properties
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/simplelogger.properties b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/simplelogger.properties
new file mode 100644
index 0000000..17c5fe6
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/simplelogger.properties
@@ -0,0 +1 @@
+org.slf4j.simpleLogger.log.org.apache.wicket.cdi=info
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/pom.xml b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/pom.xml
index ddd1ae6..98f8b3f 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/pom.xml
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/pom.xml
@@ -15,73 +15,74 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	<parent>
-		<groupId>org.apache.wicket</groupId>
-		<artifactId>wicket-cdi-1.1</artifactId>
-		<version>0.2-SNAPSHOT</version>
-		<relativePath>../pom.xml</relativePath>
-	</parent>
-	<artifactId>wicket-cdi-1.1-weld</artifactId>
-	<packaging>jar</packaging>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent> 
+        <groupId>org.apache.wicket</groupId>
+        <artifactId>wicket-cdi-1.1</artifactId>
         <version>0.2-SNAPSHOT</version>
-	<name>Wicket CDI 1.1 Weld</name>
-	<description>
-		Provides integration between Wicket and CDI containers. Adds support for weld
-                based containers.
-	</description>
-	<dependencies>
-		<dependency>
-			<groupId>org.apache.wicket</groupId>
-			<artifactId>wicket-cdi-1.1-core</artifactId>   
-			<version>0.2-SNAPSHOT</version>                     
-		</dependency>		
-		<dependency>
-			<groupId>org.jboss.weld</groupId>
-			<artifactId>weld-api</artifactId>
-			<version>2.0.Final</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>javax.el</groupId>
-			<artifactId>javax.el-api</artifactId>
-			<version>2.2.4</version>
-			<scope>test</scope>
-		</dependency>
-	</dependencies>
-	<build>
-		<pluginManagement>
-			<plugins>
-				<plugin>
-					<groupId>org.codehaus.mojo</groupId>
-					<artifactId>clirr-maven-plugin</artifactId>
-					<executions>
-						<execution>
-							<id>clirr-check</id>
-							<phase>compile</phase>
-							<goals>
-								<goal>check</goal>
-							</goals>
-							<configuration>
-								<comparisonVersion>6.1.0</comparisonVersion>
-								<failOnError>true</failOnError>
-								<logResults>true</logResults>
-							</configuration>
-						</execution>
-					</executions>
-					<configuration>
-						<comparisonVersion>6.1.0</comparisonVersion>
-						<failOnError>true</failOnError>
-						<logResults>true</logResults>
-					</configuration>
-				</plugin>
-			</plugins>
-		</pluginManagement>
-	</build>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <artifactId>wicket-cdi-1.1-weld</artifactId>
+    <packaging>jar</packaging>
+    <version>0.2-SNAPSHOT</version>
+    <name>Wicket CDI 1.1 Weld</name>
+    <description>
+        Provides integration between Wicket and CDI containers. Adds support for weld
+        based containers.
+    </description>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.wicket</groupId>
+            <artifactId>wicket-cdi-1.1-core</artifactId>
+            <version>0.2-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.weld</groupId>
+            <artifactId>weld-api</artifactId>
+            <version>2.0.Final</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.el</groupId>
+            <artifactId>javax.el-api</artifactId>
+            <version>2.2.4</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>clirr-maven-plugin</artifactId>
+                    <executions>
+                        <execution>
+                            <id>clirr-check</id>
+                            <phase>compile</phase>
+                            <goals>
+                                <goal>check</goal>
+                            </goals>
+                            <configuration>
+                                <comparisonVersion>6.1.0</comparisonVersion>
+                                <failOnError>true</failOnError>
+                                <logResults>true</logResults>
+                            </configuration>
+                        </execution>
+                    </executions>
+                    <configuration>
+                        <comparisonVersion>6.1.0</comparisonVersion>
+                        <failOnError>true</failOnError>
+                        <logResults>true</logResults>
+                    </configuration>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
 </project>

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/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 61ea380..6289074 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
@@ -17,61 +17,49 @@
 package org.apache.wicket.cdi.weld;
 
 import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Instance;
+import javax.enterprise.context.Conversation;
 import javax.inject.Inject;
+
 import org.apache.wicket.cdi.AbstractCdiContainer;
 import org.apache.wicket.request.cycle.RequestCycle;
 import org.jboss.weld.context.http.HttpConversationContext;
 
 /**
  * Provides access to CDI features from inside a Wicket request
- * 
+ *
  * @author jsarman
- * 
  */
 @ApplicationScoped
 public class WeldCdiContainer extends AbstractCdiContainer
-{
-	@Inject 
-	private Instance<HttpConversationContext> conversationContextSource;
-       
-	/**
-	 * Deactivates conversational context
-	 * 
-	 * @param cycle
-	 */
-	@Override
-	public void deactivateConversationalContext(RequestCycle cycle)
-	{
-		HttpConversationContext conversationContext = conversationContextSource.get(); 
-		conversationContext.deactivate();
-		conversationContext.dissociate(getRequest(cycle));
-	}
+{	
+	@Inject
+	private HttpConversationContext conversationContext;
 
 	/**
 	 * Activates the conversational context and starts the conversation with the specified cid
-	 * 
+	 *
 	 * @param cycle
 	 * @param cid
 	 */
 	@Override
 	public void activateConversationalContext(RequestCycle cycle, String cid)
 	{
-		HttpConversationContext conversationContext = conversationContextSource.get();               
-		conversationContext.associate(getRequest(cycle)); 
-		if(conversationContext.isActive())
+		conversationContext.associate(getRequest(cycle));
+		if (conversationContext.isActive())
 		{
-			// Only reactivate if transient and cid is set
-			if(conversationContext.getCurrentConversation().isTransient() 
-				&& cid != null && !cid.isEmpty())
-			{
-				conversationContext.deactivate();
-				conversationContext.activate(cid);                                                             
-			}                
-		} 
-		else
+			conversationContext.invalidate();
+			conversationContext.deactivate();
+			conversationContext.activate(cid);
+		} else
 		{
-			conversationContext.activate(cid);         
+			conversationContext.activate(cid);
 		}
 	}
+
+	@Override
+	public Conversation getCurrentConversation()
+	{
+		return conversationContext.getCurrentConversation();
+	}
+
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/test/java/org/apache/wicket/cdi/weld/ApacheLicenceHeaderTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/test/java/org/apache/wicket/cdi/weld/ApacheLicenceHeaderTest.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/test/java/org/apache/wicket/cdi/weld/ApacheLicenceHeaderTest.java
index bb5a6de..2c10f27 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/test/java/org/apache/wicket/cdi/weld/ApacheLicenceHeaderTest.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/test/java/org/apache/wicket/cdi/weld/ApacheLicenceHeaderTest.java
@@ -23,7 +23,7 @@ import org.apache.wicket.util.license.ApacheLicenseHeaderTestCase;
 /**
  * Test that the license headers are in place in this project. The tests are run from
  * {@link ApacheLicenseHeaderTestCase}, but you can add project specific tests here if needed.
- * 
+ *
  * @author Frank Bille Jensen (frankbille)
  */
 public class ApacheLicenceHeaderTest extends ApacheLicenseHeaderTestCase


[3/3] git commit: Merged pull request #50

Posted by pa...@apache.org.
Merged pull request #50


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

Branch: refs/heads/wicket-6.x
Commit: 62fed8f5fd9c6fa428c09a914ab159fd1aa62662
Parents: 92a5bdb
Author: John Sarman <jo...@gmail.com>
Authored: Tue Jul 16 13:06:10 2013 -0400
Committer: Emond Papegaaij <em...@topicus.nl>
Committed: Mon Nov 11 09:35:13 2013 +0100

----------------------------------------------------------------------
 .../apache/wicket/cdi/AbstractCdiContainer.java |  30 +-
 .../org/apache/wicket/cdi/AbstractInjector.java |  37 +-
 .../apache/wicket/cdi/ApplicationQualifier.java |  44 ++
 .../main/java/org/apache/wicket/cdi/Auto.java   |  11 +-
 .../org/apache/wicket/cdi/BehaviorInjector.java |   8 +-
 .../org/apache/wicket/cdi/CdiConfiguration.java | 514 +++++++++++++++----
 .../apache/wicket/cdi/CdiShutdownCleaner.java   |   6 +-
 .../wicket/cdi/CdiWebApplicationFactory.java    | 207 ++++++++
 .../org/apache/wicket/cdi/CdiWicketFilter.java  |  48 ++
 .../apache/wicket/cdi/ComponentInjector.java    |   9 +-
 .../wicket/cdi/ConfigurationParameters.java     | 161 ++++++
 .../cdi/ConversationExpiredException.java       |   2 +-
 .../wicket/cdi/ConversationExpiryChecker.java   |  24 +-
 .../apache/wicket/cdi/ConversationManager.java  | 123 +++++
 .../wicket/cdi/ConversationPropagation.java     |  88 ++--
 .../wicket/cdi/ConversationPropagator.java      | 346 +++++++------
 .../org/apache/wicket/cdi/Conversational.java   |  41 ++
 .../wicket/cdi/ConversationalComponent.java     |   3 +-
 .../java/org/apache/wicket/cdi/DetachEvent.java |   3 +-
 .../apache/wicket/cdi/DetachEventEmitter.java   |  13 +-
 .../cdi/ICdiAwareRequestCycleListener.java      |  39 --
 .../wicket/cdi/IConversationPropagation.java    |  15 +-
 .../wicket/cdi/INonContextualManager.java       |  11 +-
 .../java/org/apache/wicket/cdi/IgnoreList.java  |  11 +-
 .../org/apache/wicket/cdi/NonContextual.java    |  20 +-
 .../apache/wicket/cdi/NonContextualManager.java |   7 +-
 .../java/org/apache/wicket/cdi/Propagation.java |   8 +-
 .../org/apache/wicket/cdi/SessionInjector.java  |   3 +-
 .../java/org/apache/wicket/cdi/WicketApp.java   |  49 ++
 .../apache/wicket/cdi/AbstractInjectorTest.java |  57 ++
 .../wicket/cdi/ApacheLicenceHeaderTest.java     |   2 +-
 .../apache/wicket/cdi/CdiConfigurationTest.java | 211 +++++++-
 .../wicket/cdi/ComponentInjectorTest.java       | 102 ----
 .../wicket/cdi/ConversationManagerTest.java     |  92 ++++
 .../wicket/cdi/ConversationPropagatorTest.java  | 211 ++++++++
 .../org/apache/wicket/cdi/MockCdiContainer.java |  33 +-
 .../apache/wicket/cdi/WicketCdiTestCase.java    |  97 +++-
 .../wicket/cdi/testapp/TestApplication.java     |  11 +-
 .../cdi/testapp/TestCdiAdditionApplication.java |  58 +++
 .../wicket/cdi/testapp/TestCdiApplication.java  |  58 +++
 .../cdi/testapp/TestConversationBean.java       |   8 +
 .../cdi/testapp/TestConversationPage.html       |   2 +-
 .../cdi/testapp/TestConversationPage.java       |  28 +-
 .../cdi/testapp/TestConversationalPage.html     |  12 +
 .../cdi/testapp/TestConversationalPage.java     |  84 +++
 .../testapp/TestNonAutoConversationalPage.html  |  12 +
 .../testapp/TestNonAutoConversationalPage.java  |  92 ++++
 .../cdi/testapp/TestNonConversationalPage.html  |  11 +
 .../cdi/testapp/TestNonConversationalPage.java  |  59 +++
 .../wicket/cdi/util/tester/CdiWicketTester.java | 137 +++++
 .../cdi/util/tester/ConfigurationFilter.java    |  38 ++
 .../wicket/cdi/util/tester/ContextManager.java  |  98 ++++
 .../cdi/util/tester/FilterConfigProducer.java   |  62 +++
 .../cdi/util/tester/TestBehaviorInjector.java   |  50 ++
 .../cdi/util/tester/TestCdiConfiguration.java   |  87 ++++
 .../cdi/util/tester/TestComponentInjector.java  |  50 ++
 .../cdi/util/tester/TestFilterConfig.java       |  89 ++++
 .../src/test/java/simplelogger.properties       |   1 +
 .../wicket-cdi-1.1/wicket-cdi-1.1-weld/pom.xml  | 137 ++---
 .../wicket/cdi/weld/WeldCdiContainer.java       |  54 +-
 .../cdi/weld/ApacheLicenceHeaderTest.java       |   2 +-
 61 files changed, 3197 insertions(+), 729 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractCdiContainer.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractCdiContainer.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractCdiContainer.java
index f30666c..48f94bc 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractCdiContainer.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractCdiContainer.java
@@ -16,45 +16,45 @@
  */
 package org.apache.wicket.cdi;
 
+import javax.enterprise.context.Conversation;
 import javax.servlet.http.HttpServletRequest;
+
 import org.apache.wicket.Page;
 import org.apache.wicket.request.cycle.RequestCycle;
 import org.apache.wicket.util.lang.Args;
 
 /**
  * Provides access to CDI features from inside a Wicket request
- * 
+ *
  * @author igor
- * 
  */
 public abstract class AbstractCdiContainer
 {
 
 	/**
-	 * Deactivates conversational context
-	 * 
-	 * @param cycle
-	 */
-	public abstract void deactivateConversationalContext(RequestCycle cycle);
-
-	/**
 	 * Activates the conversational context and starts the conversation with the specified cid
-	 * 
+	 *
 	 * @param cycle
 	 * @param cid
 	 */
 	public abstract void activateConversationalContext(RequestCycle cycle, String cid);
 
+	/**
+	 * Retrieve the current conversation associated with the ConversationContext
+	 *
+	 * @return The current Conversation attached to the current Conversation Context
+	 */
+	public abstract Conversation getCurrentConversation();
+
 	protected HttpServletRequest getRequest(RequestCycle cycle)
 	{
-		return (HttpServletRequest)cycle.getRequest().getContainerRequest();
+		return (HttpServletRequest) cycle.getRequest().getContainerRequest();
 	}
 
 	/**
 	 * Retrieves a conversation id, if any, that is associated with a {@link Page} instance
-	 * 
-	 * @param page
-	 *            page instance
+	 *
+	 * @param page page instance
 	 * @return conversation id, if any
 	 */
 	public String getConversationMarker(Page page)
@@ -66,7 +66,7 @@ public abstract class AbstractCdiContainer
 	 * Removes conversation marker from the page instance which prevents the conversation from
 	 * propagating to the page. This method should usually be called from page's {@code onDetach()}
 	 * method.
-	 * 
+	 *
 	 * @param page
 	 */
 	public void removeConversationMarker(Page page)

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractInjector.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractInjector.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractInjector.java
index a9a528b..bec113a 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractInjector.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractInjector.java
@@ -18,6 +18,7 @@ package org.apache.wicket.cdi;
 
 import javax.enterprise.inject.Instance;
 import javax.inject.Inject;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -26,21 +27,27 @@ import org.slf4j.LoggerFactory;
  * 
  * @author igor
  */
-class AbstractInjector <T>
+public class AbstractInjector<T>
 {
-    
+
 	private static final Logger LOG = LoggerFactory.getLogger(AbstractInjector.class);
 
 	@Inject
+	AbstractCdiContainer cdiContainer;
+
+	@Inject
 	INonContextualManager nonContextualManager;
 
-	@Inject	
+	@Inject
+	CdiConfiguration cdiConfiguration;
+
+	@Inject
 	@IgnoreList
 	Instance<String[]> ignorePackages;
 
 	protected void postConstruct(T instance)
 	{
-		if(!ignore(instance.getClass()))
+		if (!ignore(instance.getClass()))
 		{
 			nonContextualManager.postConstruct(instance);
 		}
@@ -48,33 +55,31 @@ class AbstractInjector <T>
 
 	protected void inject(T instance)
 	{
-		
-		if(!ignore(instance.getClass()))
+
+		if (!ignore(instance.getClass()))
 		{
 			nonContextualManager.inject(instance);
 		}
 	}
-        
-        
-	private boolean ignore(Class<?> instanceClass)
+
+	protected boolean ignore(Class<?> instanceClass)
 	{
 		String packageName = instanceClass.getPackage().getName();
-		for(String ignore:ignorePackages.get())
+		for (String ignore : ignorePackages.get())
 		{
-			if(packageName.contains(ignore))
+
+			if (instanceClass.getName().equals(ignore) || packageName.contains(ignore))
 			{
-				LOG.debug("Skipping {} which is in a package to ignore {}",instanceClass,packageName);	
+				LOG.debug("Skipping {} which is set to ignore {}", instanceClass, packageName);
 				return true;
 			}
-		}           
-                        
+		}
 		return false;
-		
 	}
 
 	public String[] getIgnorePackages()
 	{
 		return ignorePackages.get();
 	}
-        
+
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ApplicationQualifier.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ApplicationQualifier.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ApplicationQualifier.java
new file mode 100644
index 0000000..d62681f
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ApplicationQualifier.java
@@ -0,0 +1,44 @@
+/*
+ * 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.cdi;
+
+import javax.enterprise.util.AnnotationLiteral;
+
+/**
+ * Allows for Programmatic lookup of WebApplications based on the Named Annotation.
+ *
+ * @author jsarman
+ */
+public class ApplicationQualifier extends AnnotationLiteral<WicketApp> implements WicketApp
+{
+	private static final long serialVersionUID = 1L;
+	
+	private String value;
+
+	public ApplicationQualifier(String value)
+	{
+		super();
+		this.value = value;
+	}
+
+	@Override
+	public String value()
+	{
+		return value;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/Auto.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/Auto.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/Auto.java
index 65a7abf..384c775 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/Auto.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/Auto.java
@@ -21,17 +21,18 @@ import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
+
 import javax.inject.Qualifier;
 
 /**
- * Qualifier for injecting the Automatic Conversation begin boolean 
- * 
+ * Qualifier for injecting the Automatic Conversation begin boolean
+ *
  * @author jsarman
  */
 @Qualifier
-@Target( { ElementType.TYPE,ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD })
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
 @Retention(RetentionPolicy.RUNTIME)
-public @interface Auto 
+public @interface Auto
 {
-    
+
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/BehaviorInjector.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/BehaviorInjector.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/BehaviorInjector.java
index 372e74d..f163c3a 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/BehaviorInjector.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/BehaviorInjector.java
@@ -17,19 +17,19 @@
 package org.apache.wicket.cdi;
 
 import javax.enterprise.context.ApplicationScoped;
+
 import org.apache.wicket.IBehaviorInstantiationListener;
 import org.apache.wicket.behavior.Behavior;
 
 /**
  * Injects components with CDI dependencies
- * 
+ *
  * @author igor
- * 
  */
 @ApplicationScoped
-class BehaviorInjector extends AbstractInjector<Behavior> implements IBehaviorInstantiationListener
+public class BehaviorInjector extends AbstractInjector<Behavior> implements IBehaviorInstantiationListener
 {
-	
+
 	@Override
 	public void onInstantiation(Behavior behavior)
 	{

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
index 0c2ef3e..dc23e1e 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
@@ -18,52 +18,59 @@ package org.apache.wicket.cdi;
 
 import java.util.Arrays;
 import java.util.Iterator;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.Map;
+import java.util.TreeMap;
 
 import javax.annotation.PostConstruct;
 import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.Instance;
 import javax.enterprise.inject.Produces;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanManager;
 import javax.inject.Inject;
 
 import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentOnBeforeRenderListener;
+import org.apache.wicket.request.IRequestHandler;
+import org.apache.wicket.request.Url;
+import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
+import org.apache.wicket.request.cycle.IRequestCycleListener;
+import org.apache.wicket.request.cycle.RequestCycle;
 import org.apache.wicket.request.cycle.RequestCycleListenerCollection;
+import org.apache.wicket.util.lang.Args;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Configures CDI integration
- *
+ * 
  * @author igor
+ * @author jsarman
  */
 @ApplicationScoped
 public class CdiConfiguration
 {
-	private static final String[] defaultIgnoredPackages = new String[]
-			{
-					"org.apache.wicket.markup",
-					"org.apache.wicket.protocol.http",
-					"org.apache.wicket.behavior",
-			};
-
-	private IConversationPropagation propagation = ConversationPropagation.NONBOOKMARKABLE;
+	private static final Logger logger = LoggerFactory.getLogger(CdiConfiguration.class);
+	private static final String[] defaultIgnoredPackages = new String[] {
+			"org.apache.wicket.markup", "org.apache.wicket.protocol.http",
+			"org.apache.wicket.behavior", };
 
 	@Inject
-	BeanManager beanManager;
+	AbstractCdiContainer container;
 
 	@Inject
 	INonContextualManager nonContextualManager;
 
 	@Inject
-	Instance<ConversationPropagator> conversationPropagatorSource;
+	ConversationPropagator conversationPropagator;
 
 	@Inject
-	Instance<ConversationExpiryChecker> conversationExpiryCheckerSource;
+	ConversationExpiryChecker conversationExpiryChecker;
 
 	@Inject
-	Instance<DetachEventEmitter> detachEventEmitterSource;
+	DetachEventEmitter detachEventEmitter;
 
 	@Inject
 	BehaviorInjector behaviorInjector;
@@ -74,197 +81,407 @@ public class CdiConfiguration
 	@Inject
 	SessionInjector sessionInjector;
 
-	private boolean injectComponents = true;
-	private boolean injectApplication = true;
-	private boolean injectSession = true;
-	private boolean injectBehaviors = true;
-	private boolean autoConversationManagement = false;
-	private boolean configured = false;
-	private Set<String> ignoredPackages;
+	@Inject
+	ConversationManager conversationManager;
+
+	protected Map<String, ConfigurationParameters> parameters;
+
+	/**
+	 * Not intended for public use. Use {@link #get()}
+	 */
+	public CdiConfiguration()
+	{
+	}
+
 
 	@PostConstruct
 	public void init()
 	{
-		ignoredPackages = new TreeSet<String>();
-		ignoredPackages.addAll(Arrays.asList(defaultIgnoredPackages));
+		parameters = new TreeMap<String, ConfigurationParameters>();
+	}
+
+	public boolean isInjectComponents()
+	{
+		return getApplicationParameters().isInjectComponents();
 	}
 
 	/**
-	 * Gets the configured bean manager
-	 *
-	 * @return bean manager or {@code null} if none
+	 * Flag to set if ComponentInjection is enabled.
+	 * <p/>
+	 * This method will throw IllegalStateException if called after configured.
+	 * 
+	 * @param injectComponents
+	 * @return {@code this} for easy chaining
+	 * @deprecated Application Level Configuration replaced with
+	 *             {@link CdiWicketFilter}
 	 */
-	public BeanManager getBeanManager()
+	@Deprecated
+	public CdiConfiguration setInjectComponents(boolean injectComponents)
 	{
-		return beanManager;
+		ConfigurationParameters params = getApplicationParameters();
+		if (params.isConfigured())
+		{
+			throw new IllegalStateException(
+					"Component Injection can only be changed before configure is called");
+		}
+		params.setInjectComponents(injectComponents);
+		return this;
 	}
 
-	public
-	@Produces
-	@Propagation
-	IConversationPropagation getPropagation()
+	public boolean isInjectApplication()
 	{
-		return propagation;
+		return getApplicationParameters().isInjectApplication();
 	}
 
 	/**
-	 * Checks if auto conversation management is enabled. See
-	 * {@link #setAutoConversationManagement(boolean)} for details.
+	 * Flag to set if ApplicationInjection is enabled.
+	 * <p/>
+	 * This method will throw IllegalStateException if called after configured.
+	 * 
+	 * @param injectApplication
+	 * @return {@code this} for easy chaining
+	 * @deprecated Application Level Configuration replaced with
+	 *             {@link CdiWicketFilter}
 	 */
-	public
-	@Produces
-	@Auto
-	Boolean isAutoConversationManagement()
+	@Deprecated
+	public CdiConfiguration setInjectApplication(boolean injectApplication)
+	{
+		ConfigurationParameters params = getApplicationParameters();
+		if (params.isConfigured())
+		{
+			throw new IllegalStateException(
+					"Application Injection can only be changed before configure is called");
+		}
+		params.setInjectApplication(injectApplication);
+		return this;
+	}
+
+	public boolean isInjectSession()
 	{
-		return autoConversationManagement;
+		return getApplicationParameters().isInjectSession();
 	}
 
 	/**
-	 * Toggles automatic conversation management feature.
-	 * <p/>
-	 * Automatic conversation management controls the lifecycle of the conversation based on
-	 * presence of components implementing the {@link ConversationalComponent} interface. If such
-	 * components are found in the page a conversation is marked persistent, and if they are not the
-	 * conversation is marked transient. This greatly simplifies the management of conversation
-	 * lifecycle.
+	 * Flag to set if SessionInjection is enabled.
 	 * <p/>
-	 * Sometimes it is necessary to manually control the application. For these cases, once a
-	 * conversation is started {@link AutoConversation} bean can be used to mark the conversation as
-	 * manually-managed.
-	 *
-	 * @param enabled
+	 * This method will throw IllegalStateException if called after configured.
+	 * 
+	 * @param injectSession
 	 * @return {@code this} for easy chaining
+	 * @deprecated Application Level Configuration replaced with
+	 *             {@link CdiWicketFilter}
 	 */
-	public CdiConfiguration setAutoConversationManagement(boolean enabled)
+	@Deprecated
+	public CdiConfiguration setInjectSession(boolean injectSession)
 	{
-		autoConversationManagement = enabled;
+		ConfigurationParameters params = getApplicationParameters();
+		if (params.isConfigured())
+		{
+			throw new IllegalStateException(
+					"Session Injection can only be changed before configure is called");
+		}
+		params.setInjectSession(injectSession);
 		return this;
 	}
 
-	public CdiConfiguration setPropagation(IConversationPropagation propagation)
+	public boolean isInjectBehaviors()
 	{
-		this.propagation = propagation;
-		return this;
+		return getApplicationParameters().isInjectBehaviors();
 	}
 
-	public INonContextualManager getNonContextualManager()
+	/**
+	 * Flag to set if BehaviorInjection is enabled.
+	 * <p/>
+	 * This method will throw IllegalStateException if called after configured.
+	 * 
+	 * @param injectBehaviors
+	 * @return {@code this} for easy chaining
+	 * @deprecated Application Level Configuration replaced with
+	 *             {@link CdiWicketFilter}
+	 */
+	@Deprecated
+	public CdiConfiguration setInjectBehaviors(boolean injectBehaviors)
 	{
-		return nonContextualManager;
+		ConfigurationParameters params = getApplicationParameters();
+		if (params.isConfigured())
+		{
+			throw new IllegalStateException(
+					"Behavior Injection can only be changed before configure is called");
+		}
+		params.setInjectBehaviors(injectBehaviors);
+		return this;
 	}
 
 
-	public boolean isInjectComponents()
+	public @Produces
+	@Propagation
+	IConversationPropagation getPropagation()
 	{
-		return injectComponents;
+		return getApplicationParameters().getPropagation();
 	}
 
-	public CdiConfiguration setInjectComponents(boolean injectComponents)
+
+	public @Produces
+	@Auto
+	Boolean isAutoConversationManagement()
 	{
-		this.injectComponents = injectComponents;
-		return this;
+		return getApplicationParameters().isAutoConversationManagement();
 	}
 
-	public boolean isInjectApplication()
+	/**
+	 * Toggles automatic conversation management feature.
+	 * <p/>
+	 * Automatic conversation management controls the lifecycle of the
+	 * conversation based on presence of components implementing the
+	 * {@link ConversationalComponent} interface. If such components are found
+	 * in the page a conversation is marked persistent, and if they are not the
+	 * conversation is marked transient. This greatly simplifies the management
+	 * of conversation lifecycle.
+	 * <p/>
+	 * ConversationManagement can also be enable per Conversation after
+	 * configured. Once the CdiConfiguration is configured this call is passed
+	 * to {@link ConversationManager#setManageConversation(java.lang.Boolean) }
+	 * for the ConversationManager in the current ConversationScope. This allows
+	 * for ConversationManagement per active Conversation.
+	 * <p/>
+	 * 
+	 * @param enabled
+	 * @return {@code this} for easy chaining
+	 */
+	public CdiConfiguration setAutoConversationManagement(boolean enabled)
 	{
-		return injectApplication;
+		ConfigurationParameters params = getApplicationParameters();
+		if (params.isConfigured())
+		{
+			if (container.getCurrentConversation().isTransient())
+			{
+				logger.warn("Not setting AutoConversationManagement because the conversation context is transient.");
+				return this;
+			}
+			conversationManager.setManageConversation(enabled);
+		}
+		else
+		{
+			params.setAutoConversationManagement(enabled);
+		}
+		return this;
 	}
 
-	public CdiConfiguration setInjectApplication(boolean injectApplication)
+	/**
+	 * Method to set the ConversationPropagation.
+	 * <p/>
+	 * 
+	 * @param propagation
+	 * @return {@code this} for easy chaining
+	 */
+	public CdiConfiguration setPropagation(IConversationPropagation propagation)
 	{
-		this.injectApplication = injectApplication;
+		Args.notNull(propagation, "propagation");
+
+		ConfigurationParameters params = getApplicationParameters();
+		if (params.isConfigured())
+		{
+			if (container.getCurrentConversation().isTransient())
+			{
+				logger.warn("Not setting propagation because the conversation context is transient.");
+				return this;
+			}
+			conversationManager.setPropagation(propagation);
+		}
+		else
+		{
+			params.setPropagation(propagation);
+		}
 		return this;
 	}
 
-	public boolean isInjectSession()
+	public INonContextualManager getNonContextualManager()
 	{
-		return injectSession;
+		return nonContextualManager;
 	}
 
-	public CdiConfiguration setInjectSession(boolean injectSession)
+	/**
+	 * @return true if configured for Application
+	 */
+	public boolean isConfigured()
 	{
-		this.injectSession = injectSession;
-		return this;
+		return getApplicationParameters().isConfigured();
 	}
 
-	public boolean isInjectBehaviors()
+	public @Produces
+	@IgnoreList
+	String[] getPackagesToIgnore()
 	{
-		return injectBehaviors;
+		ConfigurationParameters params = getApplicationParameters();
+
+		String[] ignore = new String[params.getIgnoredPackages().size()];
+		return params.getIgnoredPackages().toArray(ignore);
 	}
 
-	public CdiConfiguration setInjectBehaviors(boolean injectBehaviors)
+	/**
+	 * Allows for addition of individual classes to be ignored during injection.
+	 * 
+	 * @param classes
+	 * @return {@code this} for easy chaining
+	 */
+	public CdiConfiguration addClassesToIgnore(Class<?>... classes)
 	{
-		this.injectBehaviors = injectBehaviors;
+		if (classes != null && classes.length > 0)
+		{
+			ConfigurationParameters params = getApplicationParameters();
+			for (Class<?> clazz : classes)
+			{
+				params.getIgnoredPackages().add(clazz.getName());
+			}
+		}
 		return this;
 	}
 
-	public
-	@Produces
-	@IgnoreList
-	String[] getPackagesToIgnore()
+	/**
+	 * Remove one or more Classes from Ignore list
+	 * 
+	 * @param classes
+	 * @return {@code this} for easy chaining
+	 */
+	public CdiConfiguration removeClassesToIgnore(Class<?>... classes)
 	{
-		String[] ignore = new String[ignoredPackages.size()];
-		return ignoredPackages.toArray(ignore);
+		if (classes != null && classes.length > 0)
+		{
+			ConfigurationParameters params = getApplicationParameters();
+			for (Class<?> clazz : classes)
+			{
+				params.getIgnoredPackages().remove(clazz.getName());
+			}
+		}
+		return this;
 	}
 
+	/**
+	 * Allows for addition of one or more packages to be ignored during
+	 * injection.
+	 * 
+	 * @param packageNames
+	 * @return {@code this} for easy chaining
+	 */
 	public CdiConfiguration addPackagesToIgnore(String... packageNames)
 	{
-		ignoredPackages.addAll(Arrays.asList(packageNames));
+		if (packageNames != null && packageNames.length > 0)
+		{
+			getApplicationParameters().getIgnoredPackages().addAll(Arrays.asList(packageNames));
+		}
 		return this;
 	}
 
+	/**
+	 * Remove one or more Package from Ignore list
+	 * 
+	 * @param packageNames
+	 * @return {@code this} for easy chaining
+	 */
 	public CdiConfiguration removePackagesToIgnore(String... packageNames)
 	{
-		ignoredPackages.removeAll(Arrays.asList(packageNames));
+		if (packageNames != null && packageNames.length > 0)
+		{
+			getApplicationParameters().getIgnoredPackages().removeAll(Arrays.asList(packageNames));
+		}
 		return this;
 	}
 
+	protected ConfigurationParameters getApplicationParameters()
+	{
+		ConfigurationParameters params = parameters.get(Application.get().getApplicationKey());
+		if (params == null)
+		{
+			try
+			{
+				Application app = Application.get();
+				if (app.getApplicationKey() == null)
+				{
+					throw new WicketRuntimeException();
+				}
+				params = new ConfigurationParameters();
+				parameters.put(app.getApplicationKey(), params);
+			}
+			catch (WicketRuntimeException wre)
+			{
+				throw new IllegalStateException("Application is not ready.");
+			}
+		}
+		return params;
+	}
+
 	/**
-	 * Configures the specified application
-	 *
+	 * Configures the specified application. This method allows for
+	 * CdiConfiguration to be setup at the Application Level. Use the
+	 * {@link CdiWicketFilter} as the filterClass or add the
+	 * {@link CdiWebApplicationFactory} to the Standard WicketFilter with
+	 * init-param applicationFactoryClassName for setup during Application
+	 * Initialization. This allows for Injected classes in the WebApplication to
+	 * be ready before init() is called.
+	 * 
 	 * @param application
 	 * @return
+	 * @deprecated Application Level Configuration replaced with
+	 *             {@link CdiWicketFilter}
 	 */
-	public synchronized void configure(Application application)
+	@Deprecated
+	public void configure(Application application)
+	{
+		ConfigurationParameters params = getApplicationParameters();
+		configure(application.getApplicationKey(), application, params);
+	}
+
+	protected synchronized void configure(String appKey, Application application,
+			ConfigurationParameters params)
 	{
-		if (configured)
+
+		if (parameters.containsKey(appKey))
+		{
+			params = parameters.get(appKey);
+			if (params.isConfigured())
+			{
+				throw new IllegalStateException("Cannot configure CdiConfiguration multiple times");
+			}
+		}
+		else
 		{
-			throw new IllegalStateException("Cannot configure CdiConfiguration multiple times");
+			parameters.put(appKey, params);
 		}
+		params.getIgnoredPackages().addAll(Arrays.asList(defaultIgnoredPackages));
+
 
 		RequestCycleListenerCollection listeners = new RequestCycleListenerCollection();
 		application.getRequestCycleListeners().add(listeners);
 
 		// enable conversation propagation
-		if (getPropagation() != ConversationPropagation.NONE)
+		if (params.getPropagation() != ConversationPropagation.NONE)
 		{
-			listeners.add(conversationPropagatorSource.get());
-			application.getComponentPreOnBeforeRenderListeners().add(
-					conversationExpiryCheckerSource.get());
+			enablePropagation(params, application);
 		}
 
 		// enable detach event
-		listeners.add(detachEventEmitterSource.get());
+		listeners.add(detachEventEmitter);
 
 
 		// inject application instance
-		if (isInjectApplication())
+		if (params.isInjectApplication())
 		{
 			nonContextualManager.postConstruct(application);
 		}
 
 		// enable injection of various framework components
 
-		if (isInjectSession())
+		if (params.isInjectSession())
 		{
 			application.getSessionListeners().add(sessionInjector);
 		}
 
-		if (isInjectComponents())
+		if (params.isInjectComponents())
 		{
 			application.getComponentInstantiationListeners().add(componentInjector);
 		}
 
-		if (isInjectBehaviors())
+		if (params.isInjectBehaviors())
 		{
 			application.getBehaviorInstantiationListeners().add(behaviorInjector);
 		}
@@ -272,12 +489,18 @@ public class CdiConfiguration
 		// enable cleanup
 
 		application.getApplicationListeners().add(
-				new CdiShutdownCleaner(isInjectApplication()));
+				new CdiShutdownCleaner(params.isInjectApplication()));
 
-		configured = true;
 
+		params.setConfigured(true);
 	}
 
+	/**
+	 * Convenience Method to get an Injected Instance of CdiConfiguration
+	 * programmatically.
+	 * 
+	 * @return
+	 */
 	@SuppressWarnings("unchecked")
 	public static CdiConfiguration get()
 	{
@@ -287,9 +510,90 @@ public class CdiConfiguration
 		{
 			throw new IllegalStateException("CDI BeanManager cannot find CdiConfiguration");
 		}
-		Bean<CdiConfiguration> bean = (Bean<CdiConfiguration>) iter.next();
+		Bean<CdiConfiguration> bean = (Bean<CdiConfiguration>)iter.next();
 		CreationalContext<CdiConfiguration> ctx = beanManager.createCreationalContext(bean);
-		return (CdiConfiguration) beanManager.getReference(bean, CdiConfiguration.class, ctx);
+		return (CdiConfiguration)beanManager.getReference(bean, CdiConfiguration.class, ctx);
+	}
+
+	private void enablePropagation(ConfigurationParameters params, Application application)
+	{
+		disablePropagation(params); // Force remove active listeners if any
+		IRequestCycleListener requestCycleListener = conversationPropagator;// new
+																			// RequestCycleListenerWrapper();
+		application.getRequestCycleListeners().add(requestCycleListener);
+		params.setActiveRequestCycleListener(requestCycleListener);
+
+		IComponentOnBeforeRenderListener componentOnBeforeRenderListener = new ComponentOnBeforeRenderListenerWrapper();
+		application.getComponentPreOnBeforeRenderListeners().add(componentOnBeforeRenderListener);
+		params.setActiveComponentOnBeforeRenderListener(componentOnBeforeRenderListener);
+	}
+
+	private void disablePropagation(ConfigurationParameters params)
+	{
+		IRequestCycleListener requestCycleListener = params.getActiveRequestCycleListener();
+		if (requestCycleListener != null)
+		{
+			Application.get().getRequestCycleListeners().remove(requestCycleListener);
+			params.setActiveRequestCycleListener(null);
+		}
+		IComponentOnBeforeRenderListener componentOnBeforeRenderListener = params
+				.getActiveComponentOnBeforeRenderListener();
+		if (componentOnBeforeRenderListener != null)
+		{
+			Application.get().getComponentPreOnBeforeRenderListeners()
+					.remove(componentOnBeforeRenderListener);
+			params.setActiveComponentOnBeforeRenderListener(null);
+		}
+	}
+
+	/**
+	 * Wrapper for the Current ConversationPropagator which allows the removal
+	 * of the listener.
+	 */
+	class RequestCycleListenerWrapper extends AbstractRequestCycleListener
+	{
+
+		@Override
+		public void onEndRequest(RequestCycle cycle)
+		{
+			conversationPropagator.onEndRequest(cycle);
+		}
+
+		@Override
+		public void onRequestHandlerScheduled(RequestCycle cycle, IRequestHandler handler)
+		{
+			conversationPropagator.onRequestHandlerScheduled(cycle, handler);
+		}
+
+		@Override
+		public void onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler)
+		{
+			conversationPropagator.onRequestHandlerResolved(cycle, handler);
+		}
+
+		@Override
+		public void onRequestHandlerExecuted(RequestCycle cycle, IRequestHandler handler)
+		{
+			conversationPropagator.onRequestHandlerExecuted(cycle, handler);
+		}
+
+		@Override
+		public void onUrlMapped(RequestCycle cycle, IRequestHandler handler, Url url)
+		{
+			conversationPropagator.onUrlMapped(cycle, handler, url);
+		}
+
+	}
+
+	class ComponentOnBeforeRenderListenerWrapper implements IComponentOnBeforeRenderListener
+	{
+
+		@Override
+		public void onBeforeRender(Component component)
+		{
+			conversationExpiryChecker.onBeforeRender(component);
+		}
+
 	}
 
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java
index 38c5351..676c346 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java
@@ -21,16 +21,16 @@ import org.apache.wicket.IApplicationListener;
 
 /**
  * Listens to application shutdown and cleans up
- * 
+ *
  * @author igor
  */
 class CdiShutdownCleaner implements IApplicationListener
 {
-	
+
 	private final boolean preDestroyApplication;
 
 	public CdiShutdownCleaner(boolean preDestroyApplication)
-	{		
+	{
 		this.preDestroyApplication = preDestroyApplication;
 	}
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiWebApplicationFactory.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiWebApplicationFactory.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiWebApplicationFactory.java
new file mode 100644
index 0000000..09c1b0e
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiWebApplicationFactory.java
@@ -0,0 +1,207 @@
+/*
+ * 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.cdi;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.UnsatisfiedResolutionException;
+import javax.inject.Inject;
+import javax.servlet.FilterConfig;
+
+import org.apache.wicket.protocol.http.ContextParamWebApplicationFactory;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.protocol.http.WicketFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * WebApplicationFactory designed for CDI Injection.
+ * <p/>
+ * This class can be added to the default WicketFilter by setting the init-param
+ * 'applicationFactoryClassName' with this classes fully qualified path. In this
+ * case the applicationClassName init-param is required. The CdiConfiguration is
+ * automatically configured and the Application class is postConstructed, unless
+ * overriding with the enableApplicationInjection init-param.
+ * <p/>
+ * This class is also used by CdiWicketFilter. When using CdiWicketFilter you do
+ * not need to use the applicationClassName init-param. CdiWicketFilter uses the
+ * Injected CdiWebApplicationFactory. When createApplication is called a
+ * WebApplication Instance iterator is searched to find the proper
+ * WebApplication. Search works by first looking up the init-param
+ * applicationName. If this is found then the WebApplication annotated with
+ * {@link WicketApp}('someApp') is selected. This allows for multiple
+ * WebApplications to exist in the classloader. If multiple WebApplication are
+ * in the classloader then the use of {@link WicketApp} is required. If the
+ * init-param applicationName is not set then the classloader is searched to
+ * verify there is only one WebApplication. If there is only one WebApplication
+ * then it is used. If there are no WebApplications or multiple Applications
+ * without applicationName being set then an exception will be thrown. When
+ * using CdiWicketFilter the Application is always Injected. When using this in
+ * a EE container like glassfish the {@link WicketApp} is required to let EE
+ * container manage the object.
+ * 
+ * @author jsarman
+ */
+@ApplicationScoped
+public class CdiWebApplicationFactory extends ContextParamWebApplicationFactory
+{
+
+	private final static Logger log = LoggerFactory.getLogger(CdiWebApplicationFactory.class);
+	static final String WICKET_APP_NAME = "applicationName";
+	static final String INJECT_APP = "enableApplicationInjection";
+	static final String INJECT_COMPONENT = "enableComponentInjection";
+	static final String INJECT_SESSION = "enableSessionInjection";
+	static final String INJECT_BEHAVIOR = "enableBehaviorInjecion";
+	static final String AUTO_CONVERSATION = "enableAutoConversationManagement";
+	static final String PROPAGATION = "initialConversationPropagation";
+	@Inject
+	@Any
+	Instance<WebApplication> applications;
+	private boolean overrideApplicationInjection;
+
+	public CdiWebApplicationFactory()
+	{
+	}
+
+	@Override
+	public WebApplication createApplication(WicketFilter filter)
+	{
+
+		WebApplication application;
+		if (applications == null)
+		{
+			application = super.createApplication(filter);
+		}
+		else
+		{
+			String appName = filter.getFilterConfig().getInitParameter(WICKET_APP_NAME);
+			if (appName != null)
+			{
+				try
+				{
+					ApplicationQualifier qualifier = new ApplicationQualifier(appName);
+					application = applications.select(qualifier).get();
+					log.info("Found WicketApp('{}') annotated WebApplication: {} ", appName,
+							application.getClass());
+				}
+				catch (IllegalArgumentException iae)
+				{
+					log.error(
+							"The init param {} set to {} is either has no @Named parameter or duplicates.",
+							WICKET_APP_NAME, appName);
+					throw iae;
+				}
+				catch (UnsatisfiedResolutionException ure)
+				{
+					log.error(
+							"The init param {} set to {} requires a WebApplication to be annotated with @Named(\"{}\").",
+							new Object[] { WICKET_APP_NAME, appName, appName });
+					throw ure;
+				}
+			}
+			else
+			{
+				Iterator<WebApplication> possibleApps = applications.iterator();
+				try
+				{
+					application = possibleApps.next();
+				}
+				catch (NoSuchElementException nsee)
+				{
+					log.error("The classLoader does not contain any WebApplications. Please create a WebApplication.");
+					throw new RuntimeException("Missing WebApplication");
+				}
+				if (possibleApps.hasNext())
+				{
+					log.error(
+							"Multiple WebApplications are in the classloader. This requires using @Named parameter on WebApplication"
+									+ " and setting the init-param {} with the matching name in web.xml",
+							WICKET_APP_NAME);
+					throw new IllegalArgumentException("Missing init-param " + WICKET_APP_NAME
+							+ " to match against multiple WebApplications in classLoader. ");
+				}
+				log.info("Found Single WebApplication: {}", application.getClass());
+			}
+			overrideApplicationInjection = true; // Already injected so don't
+													// let CdiConfiguration
+													// reinject it.
+		}
+
+		ConfigurationParameters parameters = buildParameters(filter.getFilterConfig());
+		CdiConfiguration.get().configure(filter.getFilterConfig().getFilterName(), application,
+				parameters);
+		return application;
+	}
+
+	private ConfigurationParameters buildParameters(FilterConfig filterConfig)
+	{
+		ConfigurationParameters parameters = new ConfigurationParameters();
+		if (!overrideApplicationInjection)
+		{
+			final String injectApp = filterConfig.getInitParameter(INJECT_APP);
+
+			if (injectApp != null)
+			{
+				parameters.setInjectApplication(Boolean.parseBoolean(injectApp));
+			}
+		}
+		else
+		{
+			parameters.setInjectApplication(false);
+		}
+		final String injectComponent = filterConfig.getInitParameter(INJECT_COMPONENT);
+		if (injectComponent != null)
+		{
+			parameters.setInjectComponents(Boolean.parseBoolean(injectComponent));
+		}
+		final String injectSession = filterConfig.getInitParameter(INJECT_SESSION);
+		if (injectSession != null)
+		{
+			parameters.setInjectSession(Boolean.parseBoolean(injectSession));
+		}
+		final String injectBehavior = filterConfig.getInitParameter(INJECT_BEHAVIOR);
+		if (injectBehavior != null)
+		{
+			parameters.setInjectBehaviors(Boolean.parseBoolean(injectBehavior));
+		}
+		final String autoConversation = filterConfig.getInitParameter(AUTO_CONVERSATION);
+		if (autoConversation != null)
+		{
+			parameters.setAutoConversationManagement(Boolean.parseBoolean(autoConversation));
+		}
+		final String propagation = filterConfig.getInitParameter(PROPAGATION);
+		if (propagation != null)
+		{
+			try
+			{
+				parameters.setPropagation(ConversationPropagation.valueOf(propagation));
+			}
+			catch (IllegalArgumentException iae)
+			{
+				log.warn("Init Param {} = {} is not a valid propagation type. Using Default {}",
+						new Object[] { PROPAGATION, propagation,
+								parameters.getPropagation().toString() });
+			}
+		}
+
+		return parameters;
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiWicketFilter.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiWicketFilter.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiWicketFilter.java
new file mode 100644
index 0000000..5803865
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiWicketFilter.java
@@ -0,0 +1,48 @@
+/*
+ * 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.cdi;
+
+import javax.inject.Inject;
+
+import org.apache.wicket.protocol.http.IWebApplicationFactory;
+import org.apache.wicket.protocol.http.WicketFilter;
+
+/**
+ * CdiWicketFilter is a Cdi Enabled version of WicketFilter. It uses the Managed Version of
+ * {@link CdiWebApplicationFactory} therefore the WebApplication is also Managed via the Cdi container.
+ *
+ * @author jsarman
+ */
+
+public class CdiWicketFilter extends WicketFilter
+{
+
+	@Inject
+	CdiWebApplicationFactory applicationFactory;
+
+	public CdiWicketFilter()
+	{
+	}
+
+
+	@Override
+	protected IWebApplicationFactory getApplicationFactory()
+	{
+		return applicationFactory;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ComponentInjector.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ComponentInjector.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ComponentInjector.java
index ab620bb..79e4b78 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ComponentInjector.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ComponentInjector.java
@@ -23,17 +23,16 @@ import org.apache.wicket.application.IComponentInstantiationListener;
 
 /**
  * Injects components with CDI dependencies
- * 
+ *
  * @author igor
- * 
  */
 @ApplicationScoped
-class ComponentInjector extends AbstractInjector<Component> implements IComponentInstantiationListener
+public class ComponentInjector extends AbstractInjector<Component> implements IComponentInstantiationListener
 {
 
 	@Override
 	public void onInstantiation(Component component)
-	{		
-			inject(component);		
+	{
+		inject(component);
 	}
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConfigurationParameters.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConfigurationParameters.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConfigurationParameters.java
new file mode 100644
index 0000000..0165d2a
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConfigurationParameters.java
@@ -0,0 +1,161 @@
+/*
+ * 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.cdi;
+
+import java.io.Serializable;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.wicket.application.IComponentOnBeforeRenderListener;
+import org.apache.wicket.request.cycle.IRequestCycleListener;
+
+/**
+ * Simple POJO bean for storing the initial configuration parameters as well as
+ * the state of the dynamic variables used by {@link CdiConfiguration}.
+ *
+ * @author jsarman
+ */
+public class ConfigurationParameters implements Serializable
+{
+	private static final long serialVersionUID = 1L;
+	
+	private IConversationPropagation propagation = ConversationPropagation.NONBOOKMARKABLE;
+	private boolean injectComponents = true;
+	private boolean injectApplication = true;
+	private boolean injectSession = true;
+	private boolean injectBehaviors = true;
+	private boolean autoConversationManagement = false;
+	private boolean configured = false;
+
+	private Set<String> ignoredPackages = new TreeSet<String>();
+	private IRequestCycleListener activeRequestCycleListener;
+	private IComponentOnBeforeRenderListener activeComponentOnBeforeRenderListener;
+
+	public ConfigurationParameters()
+	{
+
+	}
+
+
+	public IConversationPropagation getPropagation()
+	{
+		return propagation;
+	}
+
+	ConfigurationParameters setPropagation(IConversationPropagation propagation)
+	{
+		this.propagation = propagation;
+		return this;
+	}
+
+
+	public boolean isInjectComponents()
+	{
+		return injectComponents;
+	}
+
+	ConfigurationParameters setInjectComponents(boolean injectComponents)
+	{
+		this.injectComponents = injectComponents;
+		return this;
+	}
+
+	public boolean isInjectApplication()
+	{
+		return injectApplication;
+	}
+
+	ConfigurationParameters setInjectApplication(boolean injectApplication)
+	{
+		this.injectApplication = injectApplication;
+		return this;
+	}
+
+	public boolean isInjectSession()
+	{
+		return injectSession;
+	}
+
+	ConfigurationParameters setInjectSession(boolean injectSession)
+	{
+		this.injectSession = injectSession;
+		return this;
+	}
+
+	public boolean isInjectBehaviors()
+	{
+		return injectBehaviors;
+	}
+
+	ConfigurationParameters setInjectBehaviors(boolean injectBehaviors)
+	{
+		this.injectBehaviors = injectBehaviors;
+		return this;
+	}
+
+	public boolean isAutoConversationManagement()
+	{
+		return autoConversationManagement;
+	}
+
+	ConfigurationParameters setAutoConversationManagement(boolean autoConversationManagement)
+	{
+		this.autoConversationManagement = autoConversationManagement;
+		return this;
+	}
+
+	public Set<String> getIgnoredPackages()
+	{
+		return ignoredPackages;
+	}
+
+	void setIgnoredPackages(Set<String> ignoredPackages)
+	{
+		this.ignoredPackages = ignoredPackages;
+	}
+
+	IRequestCycleListener getActiveRequestCycleListener()
+	{
+		return activeRequestCycleListener;
+	}
+
+	void setActiveRequestCycleListener(IRequestCycleListener activeRequestCycleListener)
+	{
+		this.activeRequestCycleListener = activeRequestCycleListener;
+	}
+
+	IComponentOnBeforeRenderListener getActiveComponentOnBeforeRenderListener()
+	{
+		return activeComponentOnBeforeRenderListener;
+	}
+
+	void setActiveComponentOnBeforeRenderListener(IComponentOnBeforeRenderListener activeComponentOnBeforeRenderListener)
+	{
+		this.activeComponentOnBeforeRenderListener = activeComponentOnBeforeRenderListener;
+	}
+
+	public boolean isConfigured()
+	{
+		return configured;
+	}
+
+	void setConfigured(boolean configured)
+	{
+		this.configured = configured;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java
index ab62ff0..2b3e696 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java
@@ -28,7 +28,7 @@ public class ConversationExpiredException extends RuntimeException
 	private final IRequestHandler handler;
 
 	public ConversationExpiredException(Throwable cause, String cid, Page page,
-		IRequestHandler handler)
+	                                    IRequestHandler handler)
 	{
 		super(cause);
 		this.cid = cid;

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java
index b8c7871..989e344 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java
@@ -17,9 +17,9 @@
 package org.apache.wicket.cdi;
 
 import java.io.Serializable;
+
+import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.context.Conversation;
-import javax.enterprise.context.ConversationScoped;
-import javax.enterprise.inject.Instance;
 import javax.inject.Inject;
 
 import org.apache.wicket.Component;
@@ -34,28 +34,24 @@ import org.slf4j.LoggerFactory;
 /**
  * Checks for conversation expiration during page render and throws a
  * {@link ConversationExpiredException} when an expired conversation is detected.
- * 
+ * <p/>
  * For example a link that calls {@link Conversation#end()} but does not redirect to a
  * non-conversation-dependent page will be caught by this listener.
- * 
+ *
  * @author igor
- * 
  */
-@ConversationScoped
+@ApplicationScoped
 public class ConversationExpiryChecker implements IComponentOnBeforeRenderListener, Serializable
 {
 	private static final long serialVersionUID = 1L;
 	private static final Logger logger = LoggerFactory.getLogger(ConversationExpiryChecker.class);
-	
-	@Inject 
-	Instance<AbstractCdiContainer>  containerSource;
 
 	@Inject
-	private Conversation conversation;
+	AbstractCdiContainer container;
 
 	public ConversationExpiryChecker()
 	{
-		
+
 	}
 
 	@Override
@@ -64,12 +60,12 @@ public class ConversationExpiryChecker implements IComponentOnBeforeRenderListen
 		if (component instanceof Page || RequestCycle.get().find(AjaxRequestTarget.class) != null)
 		{
 			Page page = component.getPage();
-			String cid = containerSource.get().getConversationMarker(page);
-			if (cid != null && !Objects.isEqual(conversation.getId(), cid))
+			String cid = container.getConversationMarker(page);
+			if (cid != null && !Objects.isEqual(container.getCurrentConversation().getId(), cid))
 			{
 				logger.info("Conversation {} has expired for {}", cid, page);
 				throw new ConversationExpiredException(null, cid, page, RequestCycle.get()
-					.getActiveRequestHandler());
+						.getActiveRequestHandler());
 			}
 		}
 	}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationManager.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationManager.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationManager.java
new file mode 100644
index 0000000..d7b2885
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationManager.java
@@ -0,0 +1,123 @@
+/*
+ * 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.cdi;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+import javax.inject.Inject;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author jsarman
+ */
+@ConversationScoped
+public class ConversationManager implements Serializable
+{
+	private static final long serialVersionUID = 1L;
+
+	private static final Logger logger = LoggerFactory.getLogger(ConversationManager.class);
+
+	@Inject
+	AbstractCdiContainer container;
+
+	@Inject
+	@Auto
+	Boolean globalAuto;
+
+	@Inject
+	@Propagation
+	IConversationPropagation globalPropagation;
+
+	IConversationPropagation propagation;
+	Boolean manageConversation;
+
+	boolean terminateConversation;
+
+	@PostConstruct
+	public void init()
+	{
+		logger.debug("Starting new Conversation manager for id = {}", getConversation().getId());
+		propagation = globalPropagation;
+		manageConversation = globalAuto;
+		logger.debug("Setting initial values to auto = {} prop = {}", manageConversation, propagation);
+	}
+
+	private Conversation getConversation()
+	{
+		return container.getCurrentConversation();
+	}
+
+	public IConversationPropagation getPropagation()
+	{
+		return propagation;
+	}
+
+	public void setPropagation(IConversationPropagation propagation)
+	{
+		if (propagation == null)
+		{
+			throw new IllegalArgumentException("Propagation cannot be null");
+		}
+		if (this.propagation == propagation)
+		{
+			return;
+		}
+
+		logger.debug("Changing conversation dependent propagation to {} for id = {}",
+				propagation, getConversation().getId());
+
+		this.propagation = propagation;
+	}
+
+	public Boolean getManageConversation()
+	{
+		return manageConversation;
+	}
+
+	public void setManageConversation(boolean manageConversation)
+	{
+		if (this.manageConversation == manageConversation)
+		{
+			return;
+		}
+		logger.debug("Setting conversation dependent manageConversation to {} for id = {} ",
+				manageConversation, getConversation().getId());
+
+		this.manageConversation = manageConversation;
+	}
+
+	void cancelConversationEnd()
+	{
+		terminateConversation = false;
+	}
+
+	void scheduleConversationEnd()
+	{
+		terminateConversation = true;
+	}
+
+	boolean isConversationScheduledForEnd()
+	{
+		return terminateConversation;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java
index e9ef296..e59953d 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java
@@ -16,62 +16,66 @@
  */
 package org.apache.wicket.cdi;
 
-import javax.enterprise.context.ConversationScoped;
+
 import org.apache.wicket.Page;
 import org.apache.wicket.request.IRequestHandler;
 
 /**
  * Various modes of propagating persistent conversations across requests.
- * 
- * @see ConversationScoped
- * 
+ *
  * @author igor
  */
-public enum ConversationPropagation implements IConversationPropagation {
-	/** No conversational propagation takes place */
-	NONE {
-		@Override
-		public boolean propagatesViaPage(Page page, IRequestHandler handler)
-		{
-			return false;
-		}
+public enum ConversationPropagation implements IConversationPropagation
+{
+	/**
+	 * No conversational propagation takes place
+	 */
+	NONE
+			{
+				@Override
+				public boolean propagatesViaPage(Page page, IRequestHandler handler)
+				{
+					return false;
+				}
 
-		@Override
-		public boolean propagatesViaParameters(IRequestHandler handler)
-		{
-			return false;
-		}
-	},
+				@Override
+				public boolean propagatesViaParameters(IRequestHandler handler)
+				{
+					return false;
+				}
+			},
 	/**
 	 * Persistent conversations are propagated between non-bookmarkable pages only
 	 */
-	NONBOOKMARKABLE {
-		@Override
-		public boolean propagatesViaPage(Page page, IRequestHandler handler)
-		{
-			return true;
-		}
+	NONBOOKMARKABLE
+			{
+				@Override
+				public boolean propagatesViaPage(Page page, IRequestHandler handler)
+				{
+					return true;
+				}
 
-		@Override
-		public boolean propagatesViaParameters(IRequestHandler handler)
-		{
-			return false;
-		}
-	},
+				@Override
+				public boolean propagatesViaParameters(IRequestHandler handler)
+				{
+					return false;
+				}
+			},
 	/**
 	 * Persistent conversations are propagated between bookmarkable and non-bookmarkable pages
 	 */
-	ALL {
-		@Override
-		public boolean propagatesViaPage(Page page, IRequestHandler handler)
-		{
-			return true;
-		}
+	ALL
+			{
+				@Override
+				public boolean propagatesViaPage(Page page, IRequestHandler handler)
+				{
+					return true;
+				}
 
-		@Override
-		public boolean propagatesViaParameters(IRequestHandler handler)
-		{
-			return true;
-		}
-	};
+				@Override
+				public boolean propagatesViaParameters(IRequestHandler handler)
+				{
+					return true;
+				}
+			};
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
index 94991b4..7833cf7 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
@@ -16,13 +16,12 @@
  */
 package org.apache.wicket.cdi;
 
-import java.io.Serializable;
+
+import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.context.Conversation;
-import javax.enterprise.context.ConversationScoped;
 import javax.enterprise.context.NonexistentConversationException;
-import javax.enterprise.inject.Instance;
 import javax.inject.Inject;
-import org.apache.wicket.Application;
+
 import org.apache.wicket.Component;
 import org.apache.wicket.MetaDataKey;
 import org.apache.wicket.Page;
@@ -35,7 +34,6 @@ import org.apache.wicket.request.IRequestHandlerDelegate;
 import org.apache.wicket.request.Url;
 import org.apache.wicket.request.component.IRequestablePage;
 import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
-import org.apache.wicket.request.cycle.IRequestCycleListener;
 import org.apache.wicket.request.cycle.RequestCycle;
 import org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
@@ -49,77 +47,60 @@ import org.slf4j.LoggerFactory;
 
 /**
  * A request cycle listener that takes care of propagating persistent conversations.
- * 
- * @see ConversationScoped
- * 
+ *
  * @author igor
  */
-@ConversationScoped
-public class ConversationPropagator extends AbstractRequestCycleListener implements Serializable
+@ApplicationScoped
+public class ConversationPropagator extends AbstractRequestCycleListener
 {
-	private static final long serialVersionUID = 1L;
+
 	private static final Logger logger = LoggerFactory.getLogger(ConversationPropagator.class);
 
 	private static final MetaDataKey<String> CID_KEY = ConversationIdMetaKey.INSTANCE;
 
-	private static final MetaDataKey<Boolean> CONVERSATION_STARTED_KEY = new MetaDataKey<Boolean>()
-	{
-		private static final long serialVersionUID = 1L;
-	};
-
 	static final String CID_ATTR = "cid";
-       
-	@Inject
-	Instance<AbstractCdiContainer> containerSource;
 
-	/** propagation mode to use */
-	@Propagation
 	@Inject
-	Instance<IConversationPropagation> propagationSource;
-	
-	@Auto
+	CdiConfiguration cdiConfiguration;
+
 	@Inject
-	Instance<Boolean> auto;
+	AbstractCdiContainer container;
 
 	@Inject
-	Conversation conversation_;
+	ConversationManager conversationManager;
 
-	/**
-	 * Constructor
-	 * 
-	 * @param container
-	 * @param propagation
-	 */
-	public ConversationPropagator()
-	{
-	}
 
-        
-	private Conversation getConversation(RequestCycle cycle)
+	private Conversation getConversation()
 	{
-		return Boolean.TRUE.equals(cycle.getMetaData(CONVERSATION_STARTED_KEY)) ? conversation_
-			: null;
+		return container.getCurrentConversation();
 	}
 
 	@Override
 	public void onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler)
 	{
+		Conversation conversation = getConversation();
+		logger.debug("In onRequestHandlerResolved id = {}", conversation.getId());
 		String cid = cycle.getRequest().getRequestParameters().getParameterValue(CID_ATTR).toString();
 		Page page = getPage(handler);
 
-		if (cid == null && page != null)
+		if (page == null)
+		{
+			return;
+		}
+
+		if (cid == null)
 		{
 			cid = page.getMetaData(CID_KEY);
 		}
 
-		Conversation current = getConversation(cycle);
-		if (current != null && !Objects.isEqual(current.getId(), cid))
+
+		if (cid != null && !conversation.isTransient() && !Objects.isEqual(conversation.getId(), cid))
 		{
 			logger.info("Conversation {} has expired for {}", cid, page);
 			throw new ConversationExpiredException(null, cid, page, handler);
 		}
 
-		activateConversationIfNeeded(cycle, handler, cid);
+		activateConversationIfNeeded(page, cycle, handler, cid);
 	}
 
 	@Override
@@ -130,18 +111,18 @@ public class ConversationPropagator extends AbstractRequestCycleListener impleme
 
 		if (ex instanceof StalePageException)
 		{
-			IRequestablePage requestable = ((StalePageException)ex).getPage();
+			IRequestablePage requestable = ((StalePageException) ex).getPage();
 			if (requestable instanceof Page)
 			{
-				String cid = containerSource.get().getConversationMarker((Page)requestable);
+				Page page = (Page) requestable;
+				String cid = container.getConversationMarker(page);
 				if (cid != null)
 				{
 					try
 					{
-						activateConversationIfNeeded(cycle, null, cid);
+						activateConversationIfNeeded(page, cycle, null, cid);
 						return null;
-					}
-					catch (ConversationExpiredException e)
+					} catch (ConversationExpiredException e)
 					{
 						// ignore, we will start a new one below
 					}
@@ -149,59 +130,42 @@ public class ConversationPropagator extends AbstractRequestCycleListener impleme
 			}
 		}
 
-		activateConversationIfNeeded(cycle, null, null);
+		activateConversationIfNeeded(null, cycle, null, null);
 		return null;
 	}
 
-	private void activateConversationIfNeeded(RequestCycle cycle, IRequestHandler handler,
-		String cid)
+	private void activateConversationIfNeeded(Page page, RequestCycle cycle, IRequestHandler handler,
+	                                          String cid)
 	{
-		Conversation current = getConversation(cycle);
-
-		if (current != null || !activateForHandler(handler))
+		if (!activateForHandler(handler))
 		{
 			return;
 		}
 
-		logger.debug("Activating conversation {}", cid);
-
 		try
 		{
-			containerSource.get().activateConversationalContext(cycle, cid);
-			fireOnAfterConversationStarted(cycle);
-		}
-		catch (NonexistentConversationException e)
+			Conversation conversation = getConversation();
+
+			if (!(conversation.isTransient() && cid == null))
+			{
+				logger.debug("Activating conversation {}", cid);
+				container.activateConversationalContext(cycle, cid);
+			}
+
+		} catch (NonexistentConversationException e)
 		{
 			logger.info("Unable to restore conversation with id {}", cid, e.getMessage());
 			logger.debug("Unable to restore conversation", e);
-			fireOnAfterConversationStarted(cycle);
 			throw new ConversationExpiredException(e, cid, getPage(handler), handler);
 		}
 
-		cycle.setMetaData(CONVERSATION_STARTED_KEY, true);
-	}
-
-	private void fireOnAfterConversationStarted(RequestCycle cycle)
-	{
-		for (IRequestCycleListener listener : Application.get().getRequestCycleListeners())
-		{
-			if (listener instanceof ICdiAwareRequestCycleListener)
-			{
-				((ICdiAwareRequestCycleListener)listener).onAfterConversationActivated(cycle);
-			}
-		}
 	}
 
 	@Override
 	public void onRequestHandlerExecuted(RequestCycle cycle, IRequestHandler handler)
 	{
-		Conversation conversation = getConversation(cycle);
-
-		if (conversation == null)
-		{
-			return;
-		}
-
+		Conversation conversation = getConversation();
+		logger.debug("In onRequestHandlerExecuted id = {}", conversation.getId());
 		Page page = getPage(handler);
 
 		if (page == null)
@@ -209,15 +173,17 @@ public class ConversationPropagator extends AbstractRequestCycleListener impleme
 			return;
 		}
 
-		// apply auto semantics
-
-		autoEndIfNecessary(page, handler, conversation);
-		autoBeginIfNecessary(page, handler, conversation);
-
-		if (propagationSource.get().propagatesViaPage(page, handler))
+		if (autoEndIfNecessary(page, handler, conversation))
+		{
+			container.activateConversationalContext(cycle, null);
+		} else
+		{
+			autoBeginIfNecessary(page, handler);
+		}
+		if (getPropagation().propagatesViaPage(page, handler))
 		{
 			// propagate a conversation across non-bookmarkable page instances
-			setConversationOnPage(conversation, page);
+			setConversationOnPage(page);
 		}
 	}
 
@@ -226,113 +192,121 @@ public class ConversationPropagator extends AbstractRequestCycleListener impleme
 	{
 		// propagate current non-transient conversation to the newly scheduled page
 
-		Conversation conversation = getConversation(cycle);
-
-		if (conversation == null || conversation.isTransient())
+		Conversation conversation = getConversation();
+		logger.debug("In onRequestHandlerScheduled id = {}", conversation.getId());
+		if (conversation.isTransient())
 		{
 			return;
 		}
-
+		boolean propagated = false;
 		Page page = getPage(handler);
 		if (page != null)
 		{
-			if (propagationSource.get().propagatesViaPage(page, handler))
+			if (getPropagation().propagatesViaPage(page, handler))
 			{
 				// propagate a conversation across non-bookmarkable page instances
-				setConversationOnPage(conversation, page);
+				setConversationOnPage(page);
+				propagated = true;
 			}
 		}
 
-		if (propagationSource.get().propagatesViaParameters(handler))
+		if (getPropagation().propagatesViaParameters(handler))
 		{
 			// propagate cid to a scheduled bookmarkable page
 
 			logger.debug(
-				"Propagating non-transient conversation {} via page parameters of handler {}",
-				conversation.getId(), handler);
+					"Propagating non-transient conversation {} via page parameters of handler {}",
+					conversation.getId(), handler);
 
 			PageParameters parameters = getPageParameters(handler);
 			if (parameters != null)
 			{
 				parameters.set(CID_ATTR, conversation.getId());
+				propagated = true;
 			}
 		}
+		if (!propagated && getAuto())
+		{
+			getConversationManager().scheduleConversationEnd();
+		}
 	}
 
-	protected void setConversationOnPage(Conversation conversation, Page page)
+	protected void setConversationOnPage(Page page)
 	{
-		if (conversation == null || conversation.isTransient())
+		Conversation conversation = getConversation();
+		if (conversation.isTransient())
 		{
-			logger.debug("Detaching transient conversation {} via meta of page instance {}",
-				(conversation == null ? "null" : conversation.getId()), page);
-
-			page.setMetaData(CID_KEY, null);
-		}
-		else
+			clearConversationOnPage(page);
+		} else
 		{
 
 			logger.debug("Propagating non-transient conversation {} via meta of page instance {}",
-				conversation.getId(), page);
+					conversation.getId(), page);
 
 			page.setMetaData(CID_KEY, conversation.getId());
 		}
 	}
 
+	protected void clearConversationOnPage(Page page)
+	{
+		Conversation conversation = getConversation();
+		logger.debug("Detaching transient conversation {} via meta of page instance {}",
+				conversation.getId(), page);
+
+		page.setMetaData(CID_KEY, null);
+	}
+
 	@Override
 	public void onUrlMapped(RequestCycle cycle, IRequestHandler handler, Url url)
 	{
+		Conversation conversation = getConversation();
+		logger.debug("In onUrlMapped id = {}", conversation.getId());
 		// no need to propagate the conversation to packaged resources, they should never change
 		if (handler instanceof ResourceReferenceRequestHandler)
 		{
-			if (((ResourceReferenceRequestHandler)handler).getResourceReference() instanceof PackageResourceReference)
+			if (((ResourceReferenceRequestHandler) handler).getResourceReference() instanceof PackageResourceReference)
 			{
 				return;
 			}
 		}
 
-		Conversation conversation = getConversation(cycle);
 
-		if (conversation == null || conversation.isTransient())
+		if (conversation.isTransient())
 		{
 			return;
 		}
 
-		if (propagationSource.get().propagatesViaParameters(handler))
+		if (getPropagation().propagatesViaParameters(handler))
 		{
 			// propagate cid to bookmarkable pages via urls
 
 			logger.debug("Propagating non-transient conversation {} via url", conversation.getId());
 
 			url.setQueryParameter(CID_ATTR, conversation.getId());
-		}
-	}
-
-	@Override
-	public void onDetach(RequestCycle cycle)
-	{
-		Conversation conversation = getConversation(cycle);
-		if (conversation != null)
+		} else
 		{
-			logger.debug("Deactivating conversation {}", conversation.getId());
-
-			for (IRequestCycleListener listener : Application.get().getRequestCycleListeners())
+			//we did not propagate.
+			//Cancel scheduled conversation end if page is auto.
+			Page page = getPage(handler);
+			if (page != null)
 			{
-				if (listener instanceof ICdiAwareRequestCycleListener)
+				Conversational annotation = page.getClass().getAnnotation(Conversational.class);
+				if (annotation != null)
 				{
-					((ICdiAwareRequestCycleListener)listener).onBeforeConversationDeactivated(cycle);
+					if (annotation.auto() && getConversationManager().isConversationScheduledForEnd())
+					{
+						getConversationManager().cancelConversationEnd(); //was scheduled to end but next page is auto
+					}
 				}
 			}
-			containerSource.get().deactivateConversationalContext(cycle);
-
-			cycle.setMetaData(CONVERSATION_STARTED_KEY, null);
 		}
 	}
 
 	/**
-	 * Determines whether or not a conversation should be activated fro the specified handler. This
+	 * Determines whether or not a conversation should be activated for the specified handler. This
 	 * method is used to filter out conversation activation for utility handlers such as the
 	 * {@link BufferedResponseRequestHandler}
-	 * 
+	 *
 	 * @param handler
 	 * @return {@code true} iff a conversation should be activated
 	 */
@@ -349,40 +323,68 @@ public class ConversationPropagator extends AbstractRequestCycleListener impleme
 		return true;
 	}
 
-	protected void autoBeginIfNecessary(Page page, IRequestHandler handler,
-		Conversation conversation)
+	protected void autoBeginIfNecessary(Page page, IRequestHandler handler)
 	{
-		if (!auto.get() || conversation == null || !conversation.isTransient() || page == null ||
-			!propagationSource.get().propagatesViaPage(page, handler) || !hasConversationalComponent(page))
+
+		if (page == null)
 		{
 			return;
 		}
 
-		// auto activate conversation
+		Conversational annotation = page.getClass().getAnnotation(Conversational.class);
 
-		conversation.begin();
+		boolean auto = getAuto();
+		auto |= annotation == null ? false : annotation.auto();
 
-		logger.debug("Auto-began conversation {} for page {}", conversation.getId(), page);
-	}
-
-	protected void autoEndIfNecessary(Page page, IRequestHandler handler, Conversation conversation)
-	{
-		if (!auto.get() || conversation == null || conversation.isTransient() || page == null ||
-			!propagationSource.get().propagatesViaPage(page, handler) || hasConversationalComponent(page))
+		// possibly changing propagation and auto is not set
+		if (annotation == null && !auto)
 		{
 			return;
 		}
 
-		// auto de-activate conversation
-
-		String cid = conversation.getId();
+		if (getConversation().isTransient())
+		{
+			if (auto)
+			{
+				getConversation().begin();
+				logger.debug("Auto-began conversation {} for page {}", getConversation().getId(), page);
+			}
+		}
+		ConversationPropagation prop = annotation != null ? annotation.prop() : getPropagation();
+		// The conversationManager is attached to a conversation so update
+		if (!getConversation().isTransient())
+		{
+			getConversationManager().setPropagation(prop);
+			getConversationManager().setManageConversation(auto);
+		} else
+		{
+			if (prop != getPropagation())
+			{
+				logger.info("Not setting propagation to {} because no conversation is started.",
+						prop);
+			}
+		}
+	}
 
-		conversation.end();
+	protected boolean autoEndIfNecessary(Page page, IRequestHandler handler, Conversation conversation)
+	{
+		if (page == null || conversation.isTransient())
+		{
+			return false;
+		}
 
-		logger.debug("Auto-ended conversation {} for page {}", cid, page);
+		boolean endConversation = getConversationManager().isConversationScheduledForEnd();
+		if (endConversation)
+		{
+			String cid = conversation.getId();
+			getConversation().end();
+			logger.debug("Auto-ended conversation {} for page {}", cid, page);
+		}
+		return endConversation;
 	}
 
 
+	// Currently not being used will reinvestigate this concept.
 	protected boolean hasConversationalComponent(Page page)
 	{
 		Boolean hasConversational = Visits.visit(page, new IVisitor<Component, Boolean>()
@@ -390,7 +392,8 @@ public class ConversationPropagator extends AbstractRequestCycleListener impleme
 			@Override
 			public void component(Component object, IVisit<Boolean> visit)
 			{
-				if (object instanceof ConversationalComponent)
+				Conversational annotation = object.getClass().getAnnotation(Conversational.class);
+				if (annotation != null)
 				{
 					visit.stop(true);
 				}
@@ -402,7 +405,7 @@ public class ConversationPropagator extends AbstractRequestCycleListener impleme
 
 	/**
 	 * Resolves a page instance from the request handler iff the page instance is already created
-	 * 
+	 *
 	 * @param handler
 	 * @return page or {@code null} if none
 	 */
@@ -410,15 +413,15 @@ public class ConversationPropagator extends AbstractRequestCycleListener impleme
 	{
 		while (handler instanceof IRequestHandlerDelegate)
 		{
-			handler = ((IRequestHandlerDelegate)handler).getDelegateHandler();
+			handler = ((IRequestHandlerDelegate) handler).getDelegateHandler();
 		}
 
 		if (handler instanceof IPageRequestHandler)
 		{
-			IPageRequestHandler pageHandler = (IPageRequestHandler)handler;
+			IPageRequestHandler pageHandler = (IPageRequestHandler) handler;
 			if (pageHandler.isPageInstanceCreated())
 			{
-				return (Page)pageHandler.getPage();
+				return (Page) pageHandler.getPage();
 			}
 		}
 		return null;
@@ -426,7 +429,7 @@ public class ConversationPropagator extends AbstractRequestCycleListener impleme
 
 	/**
 	 * Resolves page parameters from a request handler
-	 * 
+	 *
 	 * @param handler
 	 * @return page parameters or {@code null} if none
 	 */
@@ -434,18 +437,41 @@ public class ConversationPropagator extends AbstractRequestCycleListener impleme
 	{
 		if (handler instanceof IPageClassRequestHandler)
 		{
-			IPageClassRequestHandler pageHandler = (IPageClassRequestHandler)handler;
+			IPageClassRequestHandler pageHandler = (IPageClassRequestHandler) handler;
 			return pageHandler.getPageParameters();
 		}
 		return null;
 	}
 
-    Boolean getAuto() {
-        return auto.get();
-    }
-    
-    ConversationPropagation getPropagation() {
-        return (ConversationPropagation)propagationSource.get();
-    }
-   
+	ConversationManager getConversationManager()
+	{
+		if (getConversation().isTransient())
+		{
+			logger.warn("Accessing Conversation Manager from transient Conversation Context");
+		}
+		return conversationManager;
+	}
+
+	Boolean getAuto()
+	{
+		if (getConversation().isTransient())
+		{
+			logger.debug("Getting Global Auto setting");
+			return cdiConfiguration.isAutoConversationManagement();
+		}
+		logger.debug("Getting Auto setting for conversation = {}", getConversation().getId());
+		return getConversationManager().getManageConversation();
+	}
+
+	ConversationPropagation getPropagation()
+	{
+		if (getConversation().isTransient())
+		{
+			logger.debug("Getting global Propagation {}.", cdiConfiguration.getPropagation());
+			return (ConversationPropagation) cdiConfiguration.getPropagation();
+		}
+		logger.debug("Propagation is set to {} with id = {}", getConversationManager().getPropagation(), getConversation().getId());
+		return (ConversationPropagation) getConversationManager().getPropagation();
+	}
+
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/Conversational.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/Conversational.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/Conversational.java
new file mode 100644
index 0000000..ec5e5e9
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/Conversational.java
@@ -0,0 +1,41 @@
+/*
+ * 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.cdi;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Typed;
+
+import org.apache.wicket.Page;
+
+/**
+ * @author jsarman
+ */
+@Documented
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+@Typed(Page.class)
+public @interface Conversational
+{
+	ConversationPropagation prop() default ConversationPropagation.NONBOOKMARKABLE;
+
+	boolean auto() default true;
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationalComponent.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationalComponent.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationalComponent.java
index e041a87..2230435 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationalComponent.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationalComponent.java
@@ -21,9 +21,10 @@ package org.apache.wicket.cdi;
  * management feature ({@link CdiConfiguration#setAutoConversationManagement(boolean)}) to
  * automatically begin and end conversations based on the presence of these components in the
  * component hierarchy of pages (can be applied to the page itself).
- * 
+ *
  * @author igor
  */
+@Conversational
 public interface ConversationalComponent
 {
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEvent.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEvent.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEvent.java
index ac99ec3..531e617 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEvent.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEvent.java
@@ -18,9 +18,8 @@ package org.apache.wicket.cdi;
 
 /**
  * Fired when request cycle is detached
- * 
+ *
  * @author igor
- * 
  */
 public class DetachEvent
 {


[2/3] Merged pull request #50

Posted by pa...@apache.org.
http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java
index 09aa73c..e832347 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java
@@ -17,9 +17,11 @@
 package org.apache.wicket.cdi;
 
 import java.io.Serializable;
+
 import javax.enterprise.context.SessionScoped;
 import javax.enterprise.event.Event;
 import javax.inject.Inject;
+
 import org.apache.wicket.MetaDataKey;
 import org.apache.wicket.request.IRequestHandler;
 import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
@@ -29,9 +31,8 @@ import org.slf4j.LoggerFactory;
 
 /**
  * Request cycle listener that fires the {@link DetachEvent} event
- * 
+ *
  * @author igor
- * 
  */
 @SessionScoped
 public class DetachEventEmitter extends AbstractRequestCycleListener implements Serializable
@@ -46,14 +47,14 @@ public class DetachEventEmitter extends AbstractRequestCycleListener implements
 
 	@Inject
 	Event<DetachEvent> detachEvent;
-	
+
 	/**
 	 * Constructor
-	 * 
+	 *
 	 * @param container
 	 */
 	public DetachEventEmitter()
-	{		
+	{
 	}
 
 	@Override
@@ -72,7 +73,7 @@ public class DetachEventEmitter extends AbstractRequestCycleListener implements
 			logger.debug("Firing Detach event {}", cycle.getRequest().getUrl());
 
 			detachEvent.fire(new DetachEvent());
-			
+
 			cycle.setMetaData(DETACH_SCHEDULED_KEY, null);
 		}
 	}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java
deleted file mode 100644
index c8cb1ca..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.cdi;
-
-import org.apache.wicket.request.cycle.IRequestCycleListener;
-import org.apache.wicket.request.cycle.RequestCycle;
-
-public interface ICdiAwareRequestCycleListener extends IRequestCycleListener
-{
-	/**
-	 * Called right after a conversation context for this request is activated
-	 * 
-	 * @param cycle
-	 *            request cycle
-	 */
-	void onAfterConversationActivated(RequestCycle cycle);
-
-	/**
-	 * Called right before the current conversation context is deactivated
-	 * 
-	 * @param cycle
-	 *            request cycle
-	 */
-	void onBeforeConversationDeactivated(RequestCycle cycle);
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IConversationPropagation.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IConversationPropagation.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IConversationPropagation.java
index 154b077..34077fc 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IConversationPropagation.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IConversationPropagation.java
@@ -22,7 +22,7 @@ import org.apache.wicket.request.IRequestHandler;
 /**
  * A strategy that specifies how conversations should be propagated between pages/resources.
  * {@link ConversationPropagation} provides sensible default implementations of this interface.
- * 
+ *
  * @author papegaaij
  */
 public interface IConversationPropagation
@@ -30,11 +30,9 @@ public interface IConversationPropagation
 	/**
 	 * Indicates if the conversation should be propagated via page metadata (on an instance) for the
 	 * given page and request handler.
-	 * 
-	 * @param page
-	 *            The page on which the tag will be set.
-	 * @param handler
-	 *            The current request handler
+	 *
+	 * @param page    The page on which the tag will be set.
+	 * @param handler The current request handler
 	 * @return true if the conversation should be propagated to the given page instance.
 	 */
 	public boolean propagatesViaPage(Page page, IRequestHandler handler);
@@ -42,9 +40,8 @@ public interface IConversationPropagation
 	/**
 	 * Indicates if the conversation should be propagated via url-parameters for the given request
 	 * handler. This can either be a get parameter in a rendered url, or via page parameters.
-	 * 
-	 * @param handler
-	 *            The current request handler
+	 *
+	 * @param handler The current request handler
 	 * @return true if the conversation should be propagated for the given request handler.
 	 */
 	public boolean propagatesViaParameters(IRequestHandler handler);

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/INonContextualManager.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/INonContextualManager.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/INonContextualManager.java
index ab95807..47898ec 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/INonContextualManager.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/INonContextualManager.java
@@ -23,23 +23,22 @@ import org.apache.wicket.Component;
 
 /**
  * Manages lifecycle of non-contextual objects like {@link Component} instances, etc
- * 
+ *
  * @author igor
- * 
  */
 public interface INonContextualManager
 {
 	/**
 	 * Inject a noncontextual instance
-	 * 
+	 *
 	 * @param <T>
 	 * @param instance
 	 */
 	<T> void inject(T instance);
-	
+
 	/**
 	 * Inject a noncontextual instance and invokes any {@link PostConstruct} callbacks
-	 * 
+	 *
 	 * @param <T>
 	 * @param instance
 	 */
@@ -47,7 +46,7 @@ public interface INonContextualManager
 
 	/**
 	 * Invokes any {@link PreDestroy} callbacks and cleans up
-	 * 
+	 *
 	 * @param <T>
 	 * @param instance
 	 */

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IgnoreList.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IgnoreList.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IgnoreList.java
index 9b106fb..becf3ee 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IgnoreList.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IgnoreList.java
@@ -21,17 +21,18 @@ import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
+
 import javax.inject.Qualifier;
 
 /**
- * Qualifier for injecting the Ignore Package List 
- * 
+ * Qualifier for injecting the Ignore Package List
+ *
  * @author jsarman
  */
 @Qualifier
-@Target( { ElementType.TYPE,ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD })
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
 @Retention(RetentionPolicy.RUNTIME)
-public @interface IgnoreList 
+public @interface IgnoreList
 {
-    
+
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/NonContextual.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/NonContextual.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/NonContextual.java
index 1112f4f..4dea0ac 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/NonContextual.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/NonContextual.java
@@ -32,17 +32,17 @@ import org.apache.wicket.util.collections.ClassMetaCache;
 /**
  * Manages lifecycle of non-contextual (non-CDI-managed) objects
  * 
- * @author igor
- * 
  * @param <T>
+ * @author igor
  */
-public class NonContextual <T>
+public class NonContextual<T>
 {
 	private static final Object lock = new Object();
-	private static volatile Map<BeanManager, ClassMetaCache<NonContextual<?>>> cache = Collections.emptyMap();
+	private static volatile Map<BeanManager, ClassMetaCache<NonContextual<?>>> cache = Collections
+			.emptyMap();
 
 	final InjectionTarget<T> it;
-	
+
 	/**
 	 * Undeploys specified bean manager from cache
 	 * 
@@ -56,7 +56,7 @@ public class NonContextual <T>
 			{
 				// copy-on-write the cache
 				Map<BeanManager, ClassMetaCache<NonContextual<?>>> newCache = new WeakHashMap<BeanManager, ClassMetaCache<NonContextual<?>>>(
-					cache);
+						cache);
 				newCache.remove(BeanManagerLookup.lookup());
 				cache = Collections.unmodifiableMap(newCache);
 			}
@@ -101,7 +101,7 @@ public class NonContextual <T>
 
 					// copy-on-write the cache
 					Map<BeanManager, ClassMetaCache<NonContextual<?>>> newCache = new WeakHashMap<BeanManager, ClassMetaCache<NonContextual<?>>>(
-						cache);
+							cache);
 					newCache.put(manager, meta);
 					cache = Collections.unmodifiableMap(newCache);
 				}
@@ -129,7 +129,7 @@ public class NonContextual <T>
 		it.inject(instance, cc);
 		it.postConstruct(instance);
 	}
-	
+
 	/**
 	 * Injects the instance
 	 * 
@@ -142,8 +142,8 @@ public class NonContextual <T>
 	}
 
 	/**
-	 * Calls any {@link PreDestroy} methods and destroys any injected dependencies that need to be
-	 * destroyed.
+	 * Calls any {@link PreDestroy} methods and destroys any injected
+	 * dependencies that need to be destroyed.
 	 * 
 	 * @param instance
 	 */

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/NonContextualManager.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/NonContextualManager.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/NonContextualManager.java
index 9289f9d..1004feb 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/NonContextualManager.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/NonContextualManager.java
@@ -24,19 +24,18 @@ import org.apache.wicket.util.lang.Args;
 
 /**
  * Default implementation of {@link INonContextualManager} using {@link NonContextual} helper
- * 
+ *
  * @author igor
- * 
  */
 @ApplicationScoped
 class NonContextualManager implements INonContextualManager
 {
-	
+
 	/**
 	 * Constructor
 	 */
 	public NonContextualManager()
-	{		
+	{
 	}
 
 	/**

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/Propagation.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/Propagation.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/Propagation.java
index 0fb1c30..e752346 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/Propagation.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/Propagation.java
@@ -20,16 +20,16 @@ import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
+
 import javax.inject.Qualifier;
 
 /**
- * Qualifier used to inject the Propagation Method 
- * 
+ * Qualifier used to inject the Propagation Method
+ *
  * @author jsarman
- * 
  */
 @Qualifier
-@Target( { ElementType.TYPE,ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD })
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
 @Retention(RetentionPolicy.RUNTIME)
 public @interface Propagation
 {

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/SessionInjector.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/SessionInjector.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/SessionInjector.java
index 4bfb433..c2f0bf2 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/SessionInjector.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/SessionInjector.java
@@ -23,9 +23,8 @@ import org.apache.wicket.Session;
 
 /**
  * Injects components with CDI dependencies
- * 
+ *
  * @author igor
- * 
  */
 @ApplicationScoped
 class SessionInjector extends AbstractInjector<Session> implements ISessionListener

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/WicketApp.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/WicketApp.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/WicketApp.java
new file mode 100644
index 0000000..0d3ebb4
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/WicketApp.java
@@ -0,0 +1,49 @@
+/*
+ * 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.cdi;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Typed;
+import javax.inject.Qualifier;
+
+import org.apache.wicket.protocol.http.WebApplication;
+
+/**
+ * Bean Qualifier for Cdi enable WebApplication. This Qualifier allows for the WebApplication
+ * to be named so that the CdiApplicationFactory can select the WebApplication when multiple
+ * WebApplication exist in the ClassLoader. This Annotation also marks the WebApplication as Dependent.
+ * This prevents the WebApplication from being proxied, which will cause failures in an EE container.
+ *
+ * @author jsarman
+ */
+@Qualifier
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
+@Retention(RUNTIME)
+@Documented
+@Dependent
+@Typed(WebApplication.class)
+public @interface WicketApp
+{
+	String value() default "";
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/AbstractInjectorTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/AbstractInjectorTest.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/AbstractInjectorTest.java
new file mode 100644
index 0000000..edff13f
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/AbstractInjectorTest.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.cdi;
+
+import javax.enterprise.inject.Any;
+import javax.inject.Inject;
+
+import org.junit.Test;
+
+/**
+ * @author jsarman
+ */
+public class AbstractInjectorTest extends WicketCdiTestCase
+{
+
+	@Inject
+	ConversationPropagator conversationPropagator;
+	@Inject
+	@Any
+	AbstractInjector abstractInjector;
+
+
+	@Test
+	public void testIgnore()
+	{
+		CdiConfiguration.get().addClassesToIgnore(Object.class);
+		assertTrue(abstractInjector.ignore(Object.class));
+
+		CdiConfiguration.get().removeClassesToIgnore(Object.class);
+		assertFalse(abstractInjector.ignore(Object.class));
+
+		CdiConfiguration.get().addPackagesToIgnore("java.lang");
+		assertTrue(abstractInjector.ignore(Object.class));
+		assertTrue(abstractInjector.ignore(Runtime.class));
+
+		CdiConfiguration.get().removePackagesToIgnore("java.lang");
+		assertFalse(abstractInjector.ignore(Object.class));
+		assertFalse(abstractInjector.ignore(Runtime.class));
+
+	}
+
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ApacheLicenceHeaderTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ApacheLicenceHeaderTest.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ApacheLicenceHeaderTest.java
index 92efb73..b0d574b 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ApacheLicenceHeaderTest.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ApacheLicenceHeaderTest.java
@@ -23,7 +23,7 @@ import org.apache.wicket.util.license.ApacheLicenseHeaderTestCase;
 /**
  * Test that the license headers are in place in this project. The tests are run from
  * {@link ApacheLicenseHeaderTestCase}, but you can add project specific tests here if needed.
- * 
+ *
  * @author Frank Bille Jensen (frankbille)
  */
 public class ApacheLicenceHeaderTest extends ApacheLicenseHeaderTestCase

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
index 5b0bed6..7ac3be9 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
@@ -16,33 +16,57 @@
  */
 package org.apache.wicket.cdi;
 
+import java.util.Collections;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executors;
+
 import javax.inject.Inject;
 
-import org.apache.wicket.cdi.testapp.TestAppScope;
-import org.apache.wicket.cdi.testapp.TestConversationBean;
+import org.apache.wicket.cdi.testapp.TestCdiAdditionApplication;
+import org.apache.wicket.cdi.testapp.TestCdiApplication;
 import org.apache.wicket.cdi.testapp.TestConversationPage;
+import org.apache.wicket.cdi.testapp.TestPage;
+import org.apache.wicket.cdi.util.tester.CdiWicketTester;
+import org.apache.wicket.util.tester.WicketTester;
 import org.jglue.cdiunit.AdditionalClasses;
+import org.junit.Ignore;
 import org.junit.Test;
 
 /**
  * @author jsarman
  */
-@AdditionalClasses({TestAppScope.class, TestConversationBean.class})
+@AdditionalClasses({ TestCdiAdditionApplication.class })
 public class CdiConfigurationTest extends WicketCdiTestCase
 {
+
 	@Inject
 	ConversationPropagator conversationPropagator;
+	@Inject
+	ComponentInjector componentInjector;
+	@Inject
+	CdiConfiguration cdiConfiguration;
+
+	@Override
+	public void init()
+	{
+
+	}
+
 
 	@Test
 	public void testApplicationScope()
 	{
-		tester.startPage(tester.getApplication().getHomePage());
+		CdiWicketTester tester = getTester();
+		tester.startPage(TestPage.class);
 		tester.assertLabel("appscope", "Test ok");
 	}
 
 	@Test
 	public void testConversationScope()
 	{
+		CdiWicketTester tester = getTester();
 		tester.startPage(TestConversationPage.class);
 		for (int i = 0; i < 20; i++)
 		{
@@ -51,27 +75,174 @@ public class CdiConfigurationTest extends WicketCdiTestCase
 		}
 	}
 
+	@SuppressWarnings("deprecation")
+	@Test(expected = Exception.class)
+	public void testConfigureTwice()
+	{
+		CdiWicketTester tester = getTester();
+		tester.configure();
+		CdiConfiguration.get().configure(tester.getApplication());
+	}
+
 	@Test
-	public void testDynamicConfigureChange()
-	{
-		// CdiConfiguration is configured at begin auto is false
-		assertEquals(false, conversationPropagator.getAuto());
-		// set auto to true in configuration
-		CdiConfiguration.get().setAutoConversationManagement(true);
-		assertEquals(true, conversationPropagator.getAuto());
-		// Test Changing Propagation
-		for (ConversationPropagation propagation : ConversationPropagation.values())
+	@SuppressWarnings("deprecation")
+	public void testDeprecatedApplicationLevelConfiguration()
+	{
+		WicketTester tester = new WicketTester();
+		CdiConfiguration config = CdiConfiguration.get();
+		config.setAutoConversationManagement(true);
+		assertTrue(config.isAutoConversationManagement());
+		config.setAutoConversationManagement(false);
+		assertFalse(config.isAutoConversationManagement());
+		config.setInjectApplication(false);
+		assertFalse(config.isInjectApplication());
+		config.setInjectApplication(true);
+		assertTrue(config.isInjectApplication());
+		config.setInjectBehaviors(false);
+		assertFalse(config.isInjectBehaviors());
+		config.setInjectBehaviors(true);
+		assertTrue(config.isInjectBehaviors());
+		config.setInjectComponents(false);
+		assertFalse(config.isInjectComponents());
+		config.setInjectComponents(true);
+		assertTrue(config.isInjectComponents());
+		config.setInjectSession(false);
+		assertFalse(config.isInjectSession());
+		config.setInjectSession(true);
+		assertTrue(config.isInjectSession());
+		for (ConversationPropagation cp : ConversationPropagation.values())
 		{
-			CdiConfiguration.get().setPropagation(propagation);
-			assertEquals(propagation, conversationPropagator.getPropagation());
+			config.setPropagation(cp);
+			assertEquals(cp, config.getPropagation());
 		}
+		config.configure(tester.getApplication());
+		assertTrue(config.isConfigured());
+	}
 
-		int ignoreCnt = componentInjector.getIgnorePackages().length;
+	@Test
+	public void testFilterInitWithInitParam()
+	{
 
-		CdiConfiguration.get().addPackagesToIgnore("test1", "test2", "test3");
-		assertEquals(ignoreCnt + 3, componentInjector.getIgnorePackages().length);
+		assertEquals("Test String",
+				((TestCdiApplication)getTester().getApplication()).getInjectedTestString());
+	}
 
-		CdiConfiguration.get().removePackagesToIgnore("test1", "test2");
-		assertEquals(ignoreCnt + 1, componentInjector.getIgnorePackages().length);
+	@Test(expected = Exception.class)
+	public void testFilterInitWithoutInitParam()
+	{
+		filterConfigProducer.removeParameter(CdiWebApplicationFactory.WICKET_APP_NAME);
+		getTester();
+	}
+
+	/**
+	 * Bring up two different apps that are uniquely configured and verify they
+	 * do not affect the application dependent global settings.
+	 */
+	@Test
+	@Ignore("The beanmanager cannot be resolved from a different thread")
+	public void testMultiAppLoad()
+	{
+		getTester(); // Bring up app with name mockApp : the default
+		try
+		{
+			Executors.newSingleThreadExecutor().submit(new Runnable()
+			{
+				@Override
+				public void run()
+				{
+					Map<String, String> params = new TreeMap<String, String>();
+					params.put(CdiWebApplicationFactory.WICKET_APP_NAME, "test2");
+					// change global default for auto to true
+					params.put(CdiWebApplicationFactory.AUTO_CONVERSATION, "true");
+
+					getTester(true, params); // bring up app 2 with name test2
+					assertTrue(cdiConfiguration.isAutoConversationManagement());
+				}
+
+			}).get();
+		}
+		catch (InterruptedException ex)
+		{
+			fail(ex.getMessage());
+		}
+		catch (ExecutionException ex)
+		{
+			ex.printStackTrace();
+			fail(ex.getMessage());
+		}
+		// now check that app1 auto is still false after app2's auto was set to
+		// true
+		assertFalse(cdiConfiguration.isAutoConversationManagement());
 	}
+
+	@Test
+	public void testFilterParamsBooleansTrue()
+	{
+		testFilterParamsBooleans(true);
+	}
+
+	@Test
+	public void testFilterParamsBooleansFalse()
+	{
+		testFilterParamsBooleans(true);
+	}
+
+	@Test
+	public void testFilterParamPropagationNone()
+	{
+		testFilterParamPropagation(ConversationPropagation.NONE);
+	}
+
+	@Test
+	public void testFilterParamPropagationNonBookmarkable()
+	{
+		testFilterParamPropagation(ConversationPropagation.NONBOOKMARKABLE);
+	}
+
+	@Test
+	public void testFilterParamPropagationAll()
+	{
+		testFilterParamPropagation(ConversationPropagation.ALL);
+	}
+
+	@Test(expected = Exception.class)
+	public void testInvalidNameInFilter()
+	{
+		Map<String, String> params = Collections.singletonMap(
+				CdiWebApplicationFactory.WICKET_APP_NAME, "0xDEADBEEF");
+		getTester(params);
+	}
+
+	public void testFilterParamsBooleans(Boolean val)
+	{
+		Map<String, String> params = new TreeMap<String, String>();
+		params.put(CdiWebApplicationFactory.AUTO_CONVERSATION, val.toString());
+		params.put(CdiWebApplicationFactory.INJECT_APP, val.toString());
+		params.put(CdiWebApplicationFactory.INJECT_BEHAVIOR, val.toString());
+		params.put(CdiWebApplicationFactory.INJECT_COMPONENT, val.toString());
+		params.put(CdiWebApplicationFactory.INJECT_SESSION, val.toString());
+
+		getTester(params);
+		CdiConfiguration cc = CdiConfiguration.get();
+
+		assertFalse(cc.isInjectApplication()); // This is false bacause app is
+												// injected in Filter.
+		assertEquals(val, cc.isInjectBehaviors());
+		assertEquals(val, cc.isInjectComponents());
+		assertEquals(val, cc.isInjectSession());
+		assertEquals(val, cc.isAutoConversationManagement());
+
+	}
+
+	public void testFilterParamPropagation(ConversationPropagation propagation)
+	{
+		Map<String, String> params = Collections.singletonMap(CdiWebApplicationFactory.PROPAGATION,
+				propagation.name());
+		getTester(params);
+		CdiConfiguration cc = CdiConfiguration.get();
+
+		assertEquals(propagation, cc.getPropagation());
+	}
+
+
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ComponentInjectorTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ComponentInjectorTest.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ComponentInjectorTest.java
deleted file mode 100644
index 360ff33..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ComponentInjectorTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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.cdi;
-
-import javax.inject.Inject;
-
-import org.apache.wicket.cdi.testapp.TestAppScope;
-import org.apache.wicket.cdi.testapp.TestConversationBean;
-import org.apache.wicket.cdi.testapp.TestQualifier;
-import org.apache.wicket.markup.html.WebComponent;
-import org.jglue.cdiunit.AdditionalClasses;
-import org.junit.Test;
-
-/**
- * Tests for ComponentInjector
- */
-@AdditionalClasses({TestAppScope.class, TestConversationBean.class})
-public class ComponentInjectorTest extends WicketCdiTestCase
-{
-	/**
-	 * https://issues.apache.org/jira/browse/WICKET-5226
-	 */
-	@Test
-	public void innerNonStaticClass()
-	{
-		TestNonStaticComponent component = new TestNonStaticComponent("someId");
-		assertEquals(component.dependency, "Test String");
-	}
-
-	/**
-	 * https://issues.apache.org/jira/browse/WICKET-5226
-	 */
-	@Test
-	public void innerStaticClass()
-	{
-		TestStaticComponent component = new TestStaticComponent("someId");
-		assertEquals(component.dependency, "Test String");
-	}
-
-	@Test
-	public void anonymousInnerClass()
-	{
-
-		WebComponent component = new WebComponent("someId")
-		{
-			private static final long serialVersionUID = 1L;
-			
-			@Inject
-			@TestQualifier
-			private String dependency;
-
-			@Override
-			public String toString()
-			{
-				return dependency;
-			}
-		};
-		assertEquals(component.toString(), "Test String");
-	}
-
-	private class TestNonStaticComponent extends WebComponent
-	{
-		private static final long serialVersionUID = 1L;
-		
-		@Inject
-		@TestQualifier
-		private String dependency;
-
-		public TestNonStaticComponent(String id)
-		{
-			super(id);
-		}
-	}
-
-	private static class TestStaticComponent extends WebComponent
-	{
-		private static final long serialVersionUID = 1L;
-		
-		@Inject
-		@TestQualifier
-		private String dependency;
-
-		public TestStaticComponent(String id)
-		{
-			super(id);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ConversationManagerTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ConversationManagerTest.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ConversationManagerTest.java
new file mode 100644
index 0000000..dc60f66
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ConversationManagerTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.cdi;
+
+import javax.enterprise.context.Conversation;
+import javax.inject.Inject;
+
+import org.junit.Test;
+
+/**
+ * @author jsarman
+ */
+public class ConversationManagerTest extends WicketCdiTestCase
+{
+
+	@Inject
+	ConversationManager conversationManager;
+	@Inject
+	CdiConfiguration cdiConfiguration;
+	@Inject
+	Conversation conversation;
+
+	@Test
+	public void testConverationManagerWithConversation()
+	{
+		conversation.begin();
+
+		assertTrue(testConversationManagerConversationManagement(!cdiConfiguration.isAutoConversationManagement()));
+		assertTrue(testConversationManagerConversationManagement(cdiConfiguration.isAutoConversationManagement()));
+		for (ConversationPropagation cp : ConversationPropagation.values())
+		{
+			assertTrue(testConversationManagerPropagation(cp));
+		}
+		conversation.end();
+	}
+
+	@Test
+	public void testConverationManagerWithoutConversation()
+	{
+		// Transient conversation results in conversationManager using global so test should return false
+		assertFalse(testConversationManagerConversationManagement(!cdiConfiguration.isAutoConversationManagement()));
+		for (ConversationPropagation cp : ConversationPropagation.values())
+		{
+			//Skip no change test
+			if (cp != cdiConfiguration.getPropagation())
+			{
+				// Transient conversation results in conversationManager using global is test returns false
+				assertFalse(testConversationManagerPropagation(cp));
+			}
+		}
+	}
+
+	@Test(expected = Exception.class)
+	public void testConversationManagerNullPropagation()
+	{
+		testConversationManagerPropagation(null);
+	}
+
+	public boolean testConversationManagerConversationManagement(boolean manage)
+	{
+		boolean passed;
+		Boolean globalAuto = cdiConfiguration.isAutoConversationManagement();
+		cdiConfiguration.setAutoConversationManagement(manage);
+		passed = globalAuto == cdiConfiguration.isAutoConversationManagement();
+		passed &= manage == conversationManager.getManageConversation();
+		return passed;
+	}
+
+	public boolean testConversationManagerPropagation(ConversationPropagation propagation)
+	{
+		boolean passed;
+		IConversationPropagation globalPropagation = cdiConfiguration.getPropagation();
+		cdiConfiguration.setPropagation(propagation);
+		passed = globalPropagation == cdiConfiguration.getPropagation();
+		passed &= propagation == conversationManager.getPropagation();
+		return passed;
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ConversationPropagatorTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ConversationPropagatorTest.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ConversationPropagatorTest.java
new file mode 100644
index 0000000..1cfa80a
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ConversationPropagatorTest.java
@@ -0,0 +1,211 @@
+/*
+ * 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.cdi;
+
+import java.util.Collections;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.apache.wicket.cdi.testapp.TestConversationPage;
+import org.apache.wicket.cdi.testapp.TestConversationalPage;
+import org.apache.wicket.cdi.util.tester.CdiWicketTester;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.junit.Test;
+
+/**
+ * @author jsarman
+ */
+public class ConversationPropagatorTest extends WicketCdiTestCase
+{
+
+	@Inject
+	CdiConfiguration cdiConfiguration;
+
+	@Override
+	public void init()
+	{
+		//override so we do not initialize tester
+	}
+
+	@Test
+	public void testAutoConversationNonBookmarkable()
+	{
+
+		CdiWicketTester tester = getTester();
+		tester.startPage(TestConversationalPage.class);
+		int i;
+		for (i = 0; i < 3; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+		tester.clickLink("next");
+		for (; i < 6; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+
+	}
+
+	@Test
+	public void testAutoConversationBookmarkable()
+	{
+		CdiWicketTester tester = getTester();
+		tester.startPage(TestConversationalPage.class,
+				new PageParameters().add("pageType", "bookmarkable"));
+
+		int i;
+		for (i = 0; i < 3; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+		tester.clickLink("next");
+		//The conversation should auto end and not create another one
+		//so the next page just keeps getting 1 because the conversationscoped bean
+		//doesnt persist across requests.
+		for (i = 0; i < 3; i++)
+		{
+			tester.clickLink("increment");
+			tester.assertLabel("count", 1 + "");
+		}
+	}
+
+	@Test
+	public void testPropagationAllNonBookmarkable()
+	{
+
+		Map<String, String> params =
+				Collections.singletonMap(CdiWebApplicationFactory.PROPAGATION,
+						ConversationPropagation.ALL.name());
+
+		CdiWicketTester tester = getTester(params);
+
+		tester.startPage(TestConversationPage.class);
+		int i;
+		for (i = 0; i < 3; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+		tester.clickLink("next");
+		for (; i < 6; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+
+	}
+
+	@Test
+	public void testPropagationAllBookmarkable()
+	{
+		Map<String, String> params =
+				Collections.singletonMap(CdiWebApplicationFactory.PROPAGATION,
+						ConversationPropagation.ALL.name());
+
+		CdiWicketTester tester = getTester(params);
+
+		tester.startPage(TestConversationPage.class,
+				new PageParameters().add("pageType", "bookmarkable"));
+		int i;
+		for (i = 0; i < 3; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+		tester.clickLink("next");
+		for (; i < 6; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+
+	}
+
+	@Test
+	public void testPropagationNone()
+	{
+		Map<String, String> params =
+				Collections.singletonMap(CdiWebApplicationFactory.PROPAGATION,
+						ConversationPropagation.NONE.name());
+
+		CdiWicketTester tester = getTester(params);
+
+		tester.startPage(TestConversationPage.class);
+		int i;
+		for (i = 0; i < 3; i++)
+		{
+			tester.clickLink("increment");
+			tester.assertLabel("count", "1");
+		}
+		tester.clickLink("next");
+		for (; i < 6; i++)
+		{
+			tester.clickLink("increment");
+			tester.assertLabel("count", "1");
+		}
+
+	}
+
+	@Test
+	public void testGlobalAutoSettingNonBookmarkable()
+	{
+
+		Map<String, String> params = Collections.singletonMap(CdiWebApplicationFactory.AUTO_CONVERSATION, "true");
+
+		CdiWicketTester tester = getTester(params);
+		tester.startPage(TestConversationPage.class,
+				new PageParameters().add("auto", true));
+		int i;
+		for (i = 0; i < 3; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+		tester.clickLink("next");
+		for (; i < 6; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+	}
+
+	@Test
+	public void testGlobalAutoSettingBookmarkable()
+	{
+		Map<String, String> params = Collections.singletonMap(CdiWebApplicationFactory.AUTO_CONVERSATION, "true");
+
+		CdiWicketTester tester = getTester(params);
+		tester.startPage(TestConversationPage.class,
+				new PageParameters().add("auto", true).add("pageType", "bookmarkable"));
+		int i;
+		for (i = 0; i < 3; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+		tester.clickLink("next");
+		for (i = 0; i < 3; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/MockCdiContainer.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/MockCdiContainer.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/MockCdiContainer.java
index 92977ca..6b31bf3 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/MockCdiContainer.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/MockCdiContainer.java
@@ -17,11 +17,13 @@
 package org.apache.wicket.cdi;
 
 import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Instance;
+import javax.enterprise.context.Conversation;
 import javax.inject.Inject;
 
 import org.apache.wicket.request.cycle.RequestCycle;
 import org.jboss.weld.context.http.HttpConversationContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author jsarman
@@ -29,17 +31,10 @@ import org.jboss.weld.context.http.HttpConversationContext;
 @ApplicationScoped
 public class MockCdiContainer extends AbstractCdiContainer
 {
+	private static final Logger logger = LoggerFactory.getLogger(MockCdiContainer.class);
 
 	@Inject
-	private Instance<HttpConversationContext> conversationContextSource;
-
-	@Override
-	public void deactivateConversationalContext(RequestCycle cycle)
-	{
-		HttpConversationContext conversationContext = conversationContextSource.get();
-		conversationContext.deactivate();
-		conversationContext.dissociate(getRequest(cycle));
-	}
+	private HttpConversationContext conversationContext;
 
 	/**
 	 * Activates the conversational context and starts the conversation with the
@@ -51,20 +46,22 @@ public class MockCdiContainer extends AbstractCdiContainer
 	@Override
 	public void activateConversationalContext(RequestCycle cycle, String cid)
 	{
-		HttpConversationContext conversationContext = conversationContextSource.get();
 		conversationContext.associate(getRequest(cycle));
 		if (conversationContext.isActive())
 		{
-			// Only reactivate if transient and cid is set
-			if (conversationContext.getCurrentConversation().isTransient()
-					&& cid != null && !cid.isEmpty())
-			{
-				conversationContext.deactivate();
-				conversationContext.activate(cid);
-			}
+			conversationContext.invalidate();
+			conversationContext.deactivate();
+			conversationContext.activate(cid);
 		} else
 		{
 			conversationContext.activate(cid);
 		}
 	}
+
+	@Override
+	public Conversation getCurrentConversation()
+	{
+		return conversationContext.getCurrentConversation();
+	}
+
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java
index 1f16a58..c18292e 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java
@@ -16,62 +16,117 @@
  */
 package org.apache.wicket.cdi;
 
+import java.util.Map;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.inject.Instance;
 import javax.inject.Inject;
-import javax.servlet.http.HttpServletRequest;
 
-import org.apache.wicket.cdi.testapp.TestApplication;
-import org.apache.wicket.util.tester.WicketTester;
+import org.apache.wicket.cdi.testapp.TestAppScope;
+import org.apache.wicket.cdi.testapp.TestCdiApplication;
+import org.apache.wicket.cdi.testapp.TestConversationBean;
+import org.apache.wicket.cdi.util.tester.CdiWicketTester;
+import org.apache.wicket.cdi.util.tester.FilterConfigProducer;
+import org.apache.wicket.cdi.util.tester.TestBehaviorInjector;
+import org.apache.wicket.cdi.util.tester.TestCdiConfiguration;
+import org.apache.wicket.cdi.util.tester.TestComponentInjector;
+import org.jglue.cdiunit.ActivatedAlternatives;
 import org.jglue.cdiunit.AdditionalClasses;
 import org.jglue.cdiunit.CdiRunner;
-import org.jglue.cdiunit.ContextController;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.runner.RunWith;
 
 /**
- * Base class for all CDI unit tests
+ * @author jsarman
  */
 @RunWith(CdiRunner.class)
+@ActivatedAlternatives({TestBehaviorInjector.class, TestComponentInjector.class, TestCdiConfiguration.class})
 @AdditionalClasses({
+		CdiWicketTester.class,
 		BehaviorInjector.class,
 		CdiConfiguration.class,
 		CdiShutdownCleaner.class,
 		ComponentInjector.class,
 		ConversationExpiryChecker.class,
 		ConversationPropagator.class,
+		ConversationManager.class,
 		DetachEventEmitter.class,
 		NonContextualManager.class,
 		SessionInjector.class,
-		MockCdiContainer.class})
-public class WicketCdiTestCase extends Assert
+		MockCdiContainer.class,
+		TestAppScope.class,
+		TestConversationBean.class,
+		FilterConfigProducer.class,
+		TestCdiApplication.class,
+		CdiWebApplicationFactory.class})
+public abstract class WicketCdiTestCase extends Assert
 {
-	protected WicketTester tester;
+	@Inject
+	private Instance<CdiWicketTester> testers;
+
+	private CdiWicketTester instantiatedTester;
 
 	@Inject
-	protected ContextController contextController;
+	Conversation conversation;
 
 	@Inject
-	protected ComponentInjector componentInjector;
+	FilterConfigProducer filterConfigProducer;
 
-	@Before
-	public void before()
+	public CdiWicketTester getTester()
 	{
-		tester = new WicketTester(new TestApplication());
-		prepareRequest(tester.getRequest());
+		if (instantiatedTester == null)
+		{
+			instantiatedTester = testers.get();
+		}
+		return instantiatedTester;
 	}
 
-	@After
-	public void after()
+	public CdiWicketTester getTester(boolean newTest)
+	{
+		if (newTest)
+		{
+			return testers.get();
+		}
+		return getTester();
+	}
+
+	public CdiWicketTester getTester(Map<String, String> customParamters)
 	{
-		tester.destroy();
-		tester = null;
-		contextController.closeRequest();
+		if (instantiatedTester != null)
+		{
+			throw new IllegalStateException("The Wicket Tester is already initialized.");
+		}
+		filterConfigProducer.addParameters(customParamters);
+		return getTester();
 	}
 
-	private void prepareRequest(HttpServletRequest request)
+	public CdiWicketTester getTester(boolean newTest, Map<String, String> customParamters)
 	{
-		contextController.openRequest(request);
+		if (newTest)
+		{
+			filterConfigProducer.addParameters(customParamters);
+			return testers.get();
+		}
+		return getTester(customParamters);
 	}
 
+	@Before
+	public void init()
+	{
+		getTester();
+	}
+
+	@After
+	public void end()
+	{
+		if (instantiatedTester != null)
+		{
+			if (!conversation.isTransient())
+			{
+				conversation.end();
+			}
+		}
+	}
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.java
index e70d3a7..7c92a1e 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.java
@@ -18,6 +18,7 @@ package org.apache.wicket.cdi.testapp;
 
 import org.apache.wicket.Page;
 import org.apache.wicket.cdi.CdiConfiguration;
+import org.apache.wicket.cdi.ConversationPropagation;
 import org.apache.wicket.protocol.http.WebApplication;
 
 /**
@@ -36,7 +37,15 @@ public class TestApplication extends WebApplication
 	protected void init()
 	{
 		super.init();
-		CdiConfiguration.get().configure(this);
+		//Configure everything to default just to hit that code.
+		CdiConfiguration.get()
+				.setAutoConversationManagement(false)
+				.setInjectApplication(true)
+				.setInjectBehaviors(true)
+				.setInjectComponents(true)
+				.setInjectSession(true)
+				.setPropagation(ConversationPropagation.NONBOOKMARKABLE)
+				.configure(this);
 	}
 
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestCdiAdditionApplication.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestCdiAdditionApplication.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestCdiAdditionApplication.java
new file mode 100644
index 0000000..1f8bfed
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestCdiAdditionApplication.java
@@ -0,0 +1,58 @@
+/*
+ * 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.cdi.testapp;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+import org.apache.wicket.Page;
+import org.apache.wicket.cdi.WicketApp;
+import org.apache.wicket.protocol.http.WebApplication;
+
+/**
+ * @author jsarman
+ */
+@WicketApp("test2")
+public class TestCdiAdditionApplication extends WebApplication
+{
+
+	@Inject
+	@TestQualifier
+	String testString;
+
+
+	@Override
+	public Class<? extends Page> getHomePage()
+	{
+		return TestPage.class;
+	}
+
+
+	@PostConstruct
+	@Override
+	protected void init()
+	{
+		super.init();
+
+	}
+
+	public String getInjectedTestString()
+	{
+		return testString;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestCdiApplication.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestCdiApplication.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestCdiApplication.java
new file mode 100644
index 0000000..71248c9
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestCdiApplication.java
@@ -0,0 +1,58 @@
+/*
+ * 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.cdi.testapp;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+import org.apache.wicket.Page;
+import org.apache.wicket.cdi.WicketApp;
+import org.apache.wicket.protocol.http.WebApplication;
+
+/**
+ * @author jsarman
+ */
+@WicketApp("mockApp")
+public class TestCdiApplication extends WebApplication
+{
+
+	@Inject
+	@TestQualifier
+	String testString;
+
+
+	@Override
+	public Class<? extends Page> getHomePage()
+	{
+		return TestPage.class;
+	}
+
+
+	@PostConstruct
+	@Override
+	protected void init()
+	{
+		super.init();
+
+	}
+
+	public String getInjectedTestString()
+	{
+		return testString;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationBean.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationBean.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationBean.java
index 3253370..4407efb 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationBean.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationBean.java
@@ -21,6 +21,9 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.enterprise.context.ConversationScoped;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * @author jsarman
  */
@@ -28,16 +31,21 @@ import javax.enterprise.context.ConversationScoped;
 public class TestConversationBean implements Serializable
 {
 	private static final long serialVersionUID = 1L;
+
+	private static final Logger logger = LoggerFactory.getLogger(TestConversationBean.class);
 	
 	private AtomicInteger counter = new AtomicInteger();
 
 	public int getCount()
 	{
+		logger.debug("Count = {}", counter.get());
 		return counter.get();
 	}
 
 	public void increment()
 	{
+
 		counter.incrementAndGet();
+
 	}
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.html b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.html
index b6753b3..e7f3de7 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.html
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.html
@@ -7,6 +7,6 @@
 <body>
 <span wicket:id="count">100</span>
 <a wicket:id="increment">increment</a>
-<a wicket:id="reset">Reset</a>
+<a wicket:id="next">Reset</a>
 </body>
 </html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.java
index 8357ed7..cb0138d 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.java
@@ -16,6 +16,8 @@
  */
 package org.apache.wicket.cdi.testapp;
 
+import java.util.Random;
+
 import javax.enterprise.context.Conversation;
 import javax.inject.Inject;
 
@@ -23,6 +25,8 @@ import org.apache.wicket.markup.html.WebPage;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.link.Link;
 import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+
 
 /**
  * @author jsarman
@@ -37,11 +41,23 @@ public class TestConversationPage extends WebPage
 	@Inject
 	TestConversationBean counter;
 
+	Random random = new Random();
+
 	public TestConversationPage()
 	{
+		this(new PageParameters());
+	}
+
+	public TestConversationPage(final PageParameters parameters)
+	{
+		super(parameters);
 
-		conversation.begin();
+		if (!parameters.get("auto").toBoolean())
+		{
+			conversation.begin();
 
+			System.out.println("Opened Conversion with id = " + conversation.getId());
+		}
 		add(new Label("count", new PropertyModel<Integer>(this, "counter.count")));
 
 		add(new Link<Void>("increment")
@@ -54,18 +70,20 @@ public class TestConversationPage extends WebPage
 				counter.increment();
 			}
 		});
-		add(new Link<Void>("reset")
+		add(new Link<Void>("next")
 		{
 			private static final long serialVersionUID = 1L;
 
 			@Override
 			public void onClick()
 			{
-				conversation.end();
-				setResponsePage(TestPage.class);
+				String pageType = parameters.get("pageType").toString("nonbookmarkable");
+				if ("bookmarkable".equals(pageType.toLowerCase()))
+					setResponsePage(TestNonConversationalPage.class);
+				else
+					setResponsePage(new TestNonConversationalPage());
 			}
 		});
 
 	}
-
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.html b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.html
new file mode 100644
index 0000000..dfd545d
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title></title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+</head>
+<body>
+<span wicket:id="count">100</span>
+<a wicket:id="increment">increment</a>
+<a wicket:id="next">next</a>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.java
new file mode 100644
index 0000000..e421cfc
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.java
@@ -0,0 +1,84 @@
+/*
+ * 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.cdi.testapp;
+
+import java.util.Random;
+
+import javax.inject.Inject;
+
+import org.apache.wicket.cdi.Conversational;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * @author jsarman
+ */
+@Conversational
+public class TestConversationalPage extends WebPage
+{
+	private static final long serialVersionUID = 1L;
+	
+	private static final Logger logger = LoggerFactory.getLogger(TestConversationPage.class);
+	@Inject
+	TestConversationBean counter;
+
+	Random random = new Random();
+
+	public TestConversationalPage()
+	{
+		this(new PageParameters());
+	}
+
+
+	public TestConversationalPage(final PageParameters pp)
+	{
+		logger.debug("Starting TestConversationalPage");
+
+		add(new Label("count", new PropertyModel<Integer>(this, "counter.count")));
+
+		add(new Link<Void>("increment")
+		{
+			private static final long serialVersionUID = 1L;
+
+			@Override
+			public void onClick()
+			{
+				counter.increment();
+			}
+		});
+		add(new Link<Void>("next")
+		{
+			private static final long serialVersionUID = 1L;
+
+			@Override
+			public void onClick()
+			{
+				String pageType = pp.get("pageType").toString("nonbookmarkable");
+				if ("bookmarkable".equals(pageType.toLowerCase()))
+					setResponsePage(TestNonConversationalPage.class);
+				else
+					setResponsePage(new TestNonConversationalPage());
+			}
+		});
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.html b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.html
new file mode 100644
index 0000000..dfd545d
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title></title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+</head>
+<body>
+<span wicket:id="count">100</span>
+<a wicket:id="increment">increment</a>
+<a wicket:id="next">next</a>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.java
new file mode 100644
index 0000000..4380fbe
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.java
@@ -0,0 +1,92 @@
+/*
+ * 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.cdi.testapp;
+
+import java.util.Random;
+
+import javax.enterprise.context.Conversation;
+import javax.inject.Inject;
+
+import org.apache.wicket.cdi.ConversationPropagation;
+import org.apache.wicket.cdi.Conversational;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * @author jsarman
+ */
+@Conversational(auto = false, prop = ConversationPropagation.ALL)
+public class TestNonAutoConversationalPage extends WebPage
+{
+	private static final long serialVersionUID = 1L;
+	private static final Logger logger = LoggerFactory.getLogger(TestConversationPage.class);
+	@Inject
+	TestConversationBean counter;
+
+	@Inject
+	Conversation conversation;
+
+	Random random = new Random();
+
+	public TestNonAutoConversationalPage()
+	{
+		this(new PageParameters());
+	}
+
+
+	public TestNonAutoConversationalPage(final PageParameters pp)
+	{
+		if (pp.get("startConveration").toBoolean(true))
+		{
+			conversation.begin();
+		}
+		logger.debug("Starting TestConversationalPage");
+
+		add(new Label("count", new PropertyModel<Integer>(this, "counter.count")));
+
+		add(new Link<Void>("increment")
+		{
+			private static final long serialVersionUID = 1L;
+
+			@Override
+			public void onClick()
+			{
+				counter.increment();
+			}
+		});
+		add(new Link<Void>("next")
+		{
+			private static final long serialVersionUID = 1L;
+
+			@Override
+			public void onClick()
+			{
+				String pageType = pp.get("pageType").toString("nonbookmarkable");
+				if ("bookmarkable".equals(pageType.toLowerCase()))
+					setResponsePage(TestNonConversationalPage.class);
+				else
+					setResponsePage(new TestNonConversationalPage());
+			}
+		});
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.html b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.html
new file mode 100644
index 0000000..9857fca
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title></title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+</head>
+<body>
+<span wicket:id="count">100</span>
+<a wicket:id="increment">increment</a>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.java
new file mode 100644
index 0000000..8af7bac
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.java
@@ -0,0 +1,59 @@
+/*
+ * 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.cdi.testapp;
+
+import java.util.Random;
+
+import javax.inject.Inject;
+
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.model.PropertyModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * @author jsarman
+ */
+public class TestNonConversationalPage extends WebPage
+{
+	private static final long serialVersionUID = 1L;
+	private static final Logger logger = LoggerFactory.getLogger(TestConversationPage.class);
+	@Inject
+	TestConversationBean counter;
+
+	Random random = new Random();
+
+	public TestNonConversationalPage()
+	{
+		logger.debug("Starting TestConversationalPage");
+		add(new Label("count", new PropertyModel<Integer>(this, "counter.count")));
+
+		add(new Link<Void>("increment")
+		{
+			private static final long serialVersionUID = 1L;
+
+			@Override
+			public void onClick()
+			{
+				counter.increment();
+			}
+		});
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/CdiWicketTester.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/CdiWicketTester.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/CdiWicketTester.java
new file mode 100644
index 0000000..bd442e0
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/CdiWicketTester.java
@@ -0,0 +1,137 @@
+/*
+ * 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.cdi.util.tester;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.Dependent;
+import javax.inject.Inject;
+import javax.servlet.FilterConfig;
+
+import org.apache.wicket.cdi.CdiWebApplicationFactory;
+import org.apache.wicket.protocol.http.WicketFilter;
+import org.apache.wicket.protocol.http.mock.MockHttpServletRequest;
+import org.apache.wicket.request.IRequestHandler;
+import org.apache.wicket.util.tester.WicketTester;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author jsarman
+ */
+@Dependent
+public class CdiWicketTester extends WicketTester
+{
+
+	private static final Logger logger = LoggerFactory.getLogger(CdiWicketTester.class);
+	@Inject
+	ContextManager contextManager;
+
+	TestCdiConfiguration cdiConfiguration;
+	FilterConfig filterConfig;
+
+
+	@Inject
+	public CdiWicketTester(TestCdiConfiguration cdiConfiguration, CdiWebApplicationFactory factory, @ConfigurationFilter final FilterConfig filterConfig)
+	{
+		super(factory.createApplication(new WicketFilter()
+		{
+
+			@Override
+			public FilterConfig getFilterConfig()
+			{
+				return filterConfig;
+			}
+
+		}));
+		this.cdiConfiguration = cdiConfiguration;
+		this.filterConfig = filterConfig;
+	}
+
+	@PostConstruct
+	public void initializeApp()
+	{
+		logger.debug("Initialized Cdi Wicket Tester");
+		cdiConfiguration.remapApplicationKey(filterConfig.getFilterName(), getApplication());
+		contextManager.activateContexts(getRequest()); //Start up contexts in case no requests are performed
+	}
+
+
+	public void configure()
+	{
+		if (!cdiConfiguration.isConfigured())
+		{
+			cdiConfiguration.configure(getApplication());
+		}
+	}
+
+	private AtomicInteger count = new AtomicInteger();
+
+	/**
+	 * Process the request by first activating the contexts on initial call.
+	 * This call is called recursively in the super class so keep track of
+	 * the topmost call and only activate and deactivate the contexts during that time.
+	 *
+	 * @param forcedRequest
+	 * @param forcedRequestHandler
+	 * @param redirect
+	 * @return
+	 */
+	@Override
+	protected boolean processRequest(final MockHttpServletRequest forcedRequest,
+	                                 final IRequestHandler forcedRequestHandler, final boolean redirect)
+	{
+		if (count.getAndIncrement() == 0)
+		{
+
+			if (getLastRequest() != null)
+			{
+				contextManager.deactivateContexts(getLastRequest());
+			} else
+			{
+				configure();//make sure we are configured for cdi
+			}
+			contextManager.activateContexts(getRequest());
+		}
+		try
+		{
+			return super.processRequest(forcedRequest, forcedRequestHandler, redirect);
+		} finally
+		{
+			count.decrementAndGet();
+		}
+	}
+
+	@PreDestroy
+	public void finish()
+	{
+		try
+		{
+			logger.debug("Destroying Cdi Wicket Tester");
+			if (getLastRequest() != null)
+			{
+				contextManager.deactivateContexts(getLastRequest());
+			}
+			contextManager.destroy(getHttpSession());
+			destroy();
+		} catch (Throwable t)
+		{
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/ConfigurationFilter.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/ConfigurationFilter.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/ConfigurationFilter.java
new file mode 100644
index 0000000..d7113a8
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/ConfigurationFilter.java
@@ -0,0 +1,38 @@
+/*
+ * 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.cdi.util.tester;
+
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Qualifier for injecting the FilterConfiguration for testing
+ *
+ * @author jsarman
+ */
+@Qualifier
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ConfigurationFilter
+{
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/ContextManager.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/ContextManager.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/ContextManager.java
new file mode 100644
index 0000000..7eec3c4
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/ContextManager.java
@@ -0,0 +1,98 @@
+/*
+ * 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.cdi.util.tester;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.jboss.weld.bean.builtin.BeanManagerProxy;
+import org.jboss.weld.servlet.HttpContextLifecycle;
+import org.jboss.weld.servlet.spi.helpers.AcceptingHttpContextActivationFilter;
+import org.jglue.cdiunit.internal.LifecycleAwareRequest;
+
+/**
+ * @author jsarman
+ */
+@ApplicationScoped
+public class ContextManager
+{
+	private HttpServletRequest currentRequest;
+
+	@Inject
+	private BeanManager beanManager;
+
+	private HttpContextLifecycle lifecycle;
+
+	private HttpSession currentSession;
+
+	@PostConstruct
+	public void setup()
+	{
+		try
+		{
+			lifecycle = new HttpContextLifecycle(BeanManagerProxy.unwrap(beanManager),
+					AcceptingHttpContextActivationFilter.INSTANCE, true, true);
+		}
+		catch (NoSuchMethodError e)
+		{
+			try
+			{
+				lifecycle = HttpContextLifecycle.class.getConstructor(BeanManager.class,
+						AcceptingHttpContextActivationFilter.class).newInstance(
+						BeanManagerProxy.unwrap(beanManager),
+						AcceptingHttpContextActivationFilter.INSTANCE);
+			}
+			catch (Exception e1)
+			{
+				throw new RuntimeException(e1);
+			}
+		}
+		lifecycle.setConversationActivationEnabled(true);
+	}
+
+	public void activateContexts(HttpServletRequest request)
+	{
+		if (currentRequest != null)
+			return;
+
+		currentRequest = new LifecycleAwareRequest(lifecycle, request, currentSession);
+		lifecycle.requestInitialized(currentRequest, null);
+	}
+
+	public void deactivateContexts(HttpServletRequest request)
+	{
+		lifecycle.requestDestroyed(currentRequest);
+		currentSession = currentRequest.getSession(false);
+		currentRequest = null;
+	}
+
+	public void destroy(HttpSession session)
+	{
+		if(currentRequest != null) {
+			currentSession = currentRequest.getSession(false); 
+		}
+		
+		if(currentSession != null) {
+			lifecycle.sessionDestroyed(currentSession);
+			currentSession = null;	
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/FilterConfigProducer.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/FilterConfigProducer.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/FilterConfigProducer.java
new file mode 100644
index 0000000..4f99bf2
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/FilterConfigProducer.java
@@ -0,0 +1,62 @@
+/*
+ * 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.cdi.util.tester;
+
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.servlet.FilterConfig;
+
+/**
+ * @author jsarman
+ */
+@ApplicationScoped
+public class FilterConfigProducer
+{
+
+	TestFilterConfig config;
+
+	@PostConstruct
+	public void init()
+	{
+		config = new TestFilterConfig();
+	}
+
+	@Produces
+	@ConfigurationFilter
+	public FilterConfig getConfig()
+	{
+		return config;
+	}
+
+	public void addParameter(String paramName, String value)
+	{
+		config.put(paramName, value);
+	}
+
+	public void removeParameter(String paramName)
+	{
+		config.remove(paramName);
+	}
+
+	public void addParameters(Map<String, String> params)
+	{
+		config.putAll(params);
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/62fed8f5/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/TestBehaviorInjector.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/TestBehaviorInjector.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/TestBehaviorInjector.java
new file mode 100644
index 0000000..01ad94f
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/TestBehaviorInjector.java
@@ -0,0 +1,50 @@
+/*
+ * 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.cdi.util.tester;
+
+import java.lang.reflect.Modifier;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Specializes;
+
+import org.apache.wicket.behavior.Behavior;
+import org.apache.wicket.cdi.BehaviorInjector;
+
+/**
+ * Injects components with CDI dependencies
+ *
+ * @author igor
+ */
+@ApplicationScoped
+@Alternative
+@Specializes
+public class TestBehaviorInjector extends BehaviorInjector
+{
+
+	@Override
+	public void onInstantiation(Behavior behavior)
+	{
+		Class instanceClass = behavior.getClass();
+		if (instanceClass.isAnonymousClass() ||
+				(instanceClass.isMemberClass() && Modifier.isStatic(instanceClass.getModifiers()) == false))
+		{
+			return;
+		}
+		inject(behavior);
+	}
+}