aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rotty3...@apache.org
Subject svn commit: r1794071 - in /aries/trunk/cdi: ./ cdi-extender/ cdi-extension-http/ cdi-extension-http/src/ cdi-extension-http/src/main/ cdi-extension-http/src/main/java/ cdi-extension-http/src/main/java/org/ cdi-extension-http/src/main/java/org/apache/ c...
Date Fri, 05 May 2017 16:25:52 GMT
Author: rotty3000
Date: Fri May  5 16:25:52 2017
New Revision: 1794071

URL: http://svn.apache.org/viewvc?rev=1794071&view=rev
Log:
[CDI] initial http support

Signed-off-by: Raymond Augé <rotty3000@apache.org>

Added:
    aries/trunk/cdi/cdi-extension-http/
    aries/trunk/cdi/cdi-extension-http/LICENSE
    aries/trunk/cdi/cdi-extension-http/NOTICE
    aries/trunk/cdi/cdi-extension-http/bnd.bnd
    aries/trunk/cdi/cdi-extension-http/pom.xml
    aries/trunk/cdi/cdi-extension-http/src/
    aries/trunk/cdi/cdi-extension-http/src/main/
    aries/trunk/cdi/cdi-extension-http/src/main/java/
    aries/trunk/cdi/cdi-extension-http/src/main/java/org/
    aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/
    aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/
    aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/
    aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/
    aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/
    aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/Activator.java
    aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java
    aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtensionFactory.java
    aries/trunk/cdi/cdi-itests/bnd/tb6-beans.xml
    aries/trunk/cdi/cdi-itests/bnd/tb6.bnd
    aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/cases/HttpTestCase.java
    aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb6/
    aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb6/BeanServlet.java
    aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb6/SessionBean.java
Modified:
    aries/trunk/cdi/cdi-extender/bnd.bnd
    aries/trunk/cdi/cdi-extension-jndi/bnd.bnd
    aries/trunk/cdi/cdi-itests/bnd.bnd
    aries/trunk/cdi/cdi-itests/cdi-executable.bndrun
    aries/trunk/cdi/cdi-itests/itest.bndrun
    aries/trunk/cdi/cdi-itests/pom.xml
    aries/trunk/cdi/pom.xml

Modified: aries/trunk/cdi/cdi-extender/bnd.bnd
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/bnd.bnd?rev=1794071&r1=1794070&r2=1794071&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extender/bnd.bnd (original)
+++ aries/trunk/cdi/cdi-extender/bnd.bnd Fri May  5 16:25:52 2017
@@ -11,6 +11,10 @@ Provide-Capability: \
 	osgi.extender; \
 		osgi.extender='osgi.cdi'; \
 		uses:="org.osgi.service.cdi,org.osgi.service.cdi.annotations,javax.enterprise.inject.spi"; \
+		version:Version="${Bundle-Version}",\
+	osgi.implementation; \
+		osgi.implementation='osgi.cdi'; \
+		uses:="org.osgi.service.cdi,org.osgi.service.cdi.annotations,javax.enterprise.inject.spi"; \
 		version:Version="${Bundle-Version}"
 -contract: JavaCDI, JavaEL, JavaInject, JavaInterceptor
 -includeresource: META-INF/=LICENSE, META-INF/=NOTICE
\ No newline at end of file

Added: aries/trunk/cdi/cdi-extension-http/LICENSE
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-http/LICENSE?rev=1794071&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extension-http/LICENSE (added)
+++ aries/trunk/cdi/cdi-extension-http/LICENSE Fri May  5 16:25:52 2017
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+

Added: aries/trunk/cdi/cdi-extension-http/NOTICE
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-http/NOTICE?rev=1794071&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extension-http/NOTICE (added)
+++ aries/trunk/cdi/cdi-extension-http/NOTICE Fri May  5 16:25:52 2017
@@ -0,0 +1,8 @@
+
+Apache Aries
+Copyright 2009-2011 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+

Added: aries/trunk/cdi/cdi-extension-http/bnd.bnd
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-http/bnd.bnd?rev=1794071&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extension-http/bnd.bnd (added)
+++ aries/trunk/cdi/cdi-extension-http/bnd.bnd Fri May  5 16:25:52 2017
@@ -0,0 +1,7 @@
+Bundle-Activator: org.apache.aries.cdi.extension.http.Activator
+Provide-Capability: osgi.cdi.extension;osgi.cdi.extension=http;version:Version="${Bundle-Version}"
+Require-Capability:\
+	osgi.implementation;filter:='(&(osgi.implementation=osgi.cdi)(version>=0.0.1)(!(version>=1.0.0)))',\
+	osgi.implementation;filter:="(&(osgi.implementation=osgi.http)(version>=1.0)(!(version>=2.0)))"
+-contract: JavaCDI, JavaServlet
+-includeresource: META-INF/=LICENSE, META-INF/=NOTICE
\ No newline at end of file

Added: aries/trunk/cdi/cdi-extension-http/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-http/pom.xml?rev=1794071&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extension-http/pom.xml (added)
+++ aries/trunk/cdi/cdi-extension-http/pom.xml Fri May  5 16:25:52 2017
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Licensed 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.
+ */
+-->
+
+<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.aries.cdi</groupId>
+		<artifactId>org.apache.aries.cdi</artifactId>
+		<version>0.0.1-SNAPSHOT</version>
+	</parent>
+
+	<artifactId>org.apache.aries.cdi.extension.http</artifactId>
+	<name>CDI Http Extender</name>
+	<description>Http support for Aries CDI Extender</description>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>biz.aQute.bnd</groupId>
+				<artifactId>bnd-maven-plugin</artifactId>
+			</plugin>
+		</plugins>
+	</build>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.aries.cdi</groupId>
+			<artifactId>org.apache.aries.javax.cdi-api</artifactId>
+			<version>0.0.1-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.http.servlet-api</artifactId>
+			<version>1.1.2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.jboss.weld</groupId>
+			<artifactId>weld-osgi-bundle</artifactId>
+			<version>2.4.2.Final</version>
+			<exclusions>
+				<exclusion>
+					<groupId>javax.enterprise</groupId>
+					<artifactId>cdi-api</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>javax.inject</groupId>
+					<artifactId>javax.inject</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>org.jboss.spec.javax.annotation</groupId>
+					<artifactId>jboss-annotations-api_1.2_spec</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>org.jboss.spec.javax.el</groupId>
+					<artifactId>jboss-el-api_3.0_spec</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>org.jboss.spec.javax.interceptor</groupId>
+					<artifactId>jboss-interceptors-api_1.2_spec</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.namespace.extender</artifactId>
+			<version>1.0.1</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.service.cdi</artifactId>
+			<version>1.0.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.service.http.whiteboard</artifactId>
+			<version>1.0.0</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>osgi.core</artifactId>
+			<version>6.0.0</version>
+		</dependency>
+	</dependencies>
+</project>
\ No newline at end of file

Added: aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/Activator.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/Activator.java?rev=1794071&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/Activator.java (added)
+++ aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/Activator.java Fri May  5 16:25:52 2017
@@ -0,0 +1,46 @@
+/**
+ * Licensed 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.aries.cdi.extension.http;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import javax.enterprise.inject.spi.Extension;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cdi.CdiConstants;
+
+public class Activator implements BundleActivator {
+
+	@Override
+	public void start(BundleContext bundleContext) throws Exception {
+		Dictionary<String, Object> properties = new Hashtable<>();
+
+		properties.put(CdiConstants.CDI_EXTENSION_NAMESPACE, "http");
+
+		_serviceRegistration = bundleContext.registerService(
+			Extension.class, new HttpExtensionFactory(), properties);
+	}
+
+	@Override
+	public void stop(BundleContext bundleContext) throws Exception {
+		_serviceRegistration.unregister();
+	}
+
+	private ServiceRegistration<Extension> _serviceRegistration;
+
+}

Added: aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java?rev=1794071&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java (added)
+++ aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java Fri May  5 16:25:52 2017
@@ -0,0 +1,142 @@
+/**
+ * Licensed 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.aries.cdi.extension.http;
+
+import static org.osgi.namespace.extender.ExtenderNamespace.EXTENDER_NAMESPACE;
+import static org.osgi.service.cdi.CdiConstants.CDI_CAPABILITY_NAME;
+
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeShutdown;
+import javax.enterprise.inject.spi.Extension;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletRequestListener;
+import javax.servlet.http.HttpSessionListener;
+
+import org.jboss.weld.bean.builtin.BeanManagerProxy;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.servlet.WeldInitialListener;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.framework.wiring.BundleCapability;
+import org.osgi.framework.wiring.BundleRequirement;
+import org.osgi.framework.wiring.BundleWire;
+import org.osgi.framework.wiring.BundleWiring;
+import org.osgi.service.http.whiteboard.HttpWhiteboardConstants;
+
+public class HttpExtension implements Extension {
+
+	public HttpExtension(Bundle bundle) {
+		_bundle = bundle;
+	}
+
+	void afterDeploymentValidation(@Observes AfterDeploymentValidation adv, BeanManager beanManager) {
+		processWebClasses();
+
+		BeanManagerImpl beanManagerImpl = ((BeanManagerProxy)beanManager).delegate();
+
+		Dictionary<String, Object> properties = new Hashtable<>();
+
+		properties.put(
+			HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, getSelectedContext());
+		properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, Boolean.TRUE.toString());
+		properties.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE - 100);
+
+		_registrations.add(
+			_bundle.getBundleContext().registerService(
+				LISTENER_CLASSES, new WeldInitialListener(beanManagerImpl), properties));
+	}
+
+	private void processWebClasses() {
+		// TODO Auto-generated method stub
+	}
+
+	void beforeShutdown(@Observes BeforeShutdown bs) {
+		for (ServiceRegistration<?> registration : _registrations) {
+			registration.unregister();
+		}
+
+		_registrations.clear();
+	}
+
+	private Map<String, Object> getAttributes() {
+		BundleWiring bundleWiring = _bundle.adapt(BundleWiring.class);
+
+		List<BundleWire> wires = bundleWiring.getRequiredWires(EXTENDER_NAMESPACE);
+
+		Map<String, Object> cdiAttributes = Collections.emptyMap();
+
+		for (BundleWire wire : wires) {
+			BundleCapability capability = wire.getCapability();
+			Map<String, Object> attributes = capability.getAttributes();
+			String extender = (String)attributes.get(EXTENDER_NAMESPACE);
+
+			if (extender.equals(CDI_CAPABILITY_NAME)) {
+				BundleRequirement requirement = wire.getRequirement();
+				cdiAttributes = requirement.getAttributes();
+				break;
+			}
+		}
+
+		return cdiAttributes;
+	}
+
+	private String getSelectedContext() {
+		if (_contextSelect != null) {
+			return _contextSelect;
+		}
+
+		return _contextSelect = getSelectedContext0();
+	}
+
+	private String getSelectedContext0() {
+		Map<String, Object> attributes = getAttributes();
+
+		if (attributes.containsKey(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT)) {
+			return (String)attributes.get(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT);
+		}
+
+		Dictionary<String,String> headers = _bundle.getHeaders();
+
+		if (headers.get(WEB_CONTEXT_PATH) != null) {
+			return CONTEXT_PATH_PREFIX + headers.get(WEB_CONTEXT_PATH) + ')';
+		}
+
+		return DEFAULT_CONTEXT_FILTER;
+	}
+
+	private static final String CONTEXT_PATH_PREFIX = "(osgi.http.whiteboard.context.path=";
+	private static final String DEFAULT_CONTEXT_FILTER = "(osgi.http.whiteboard.context.name=default)";
+	private static final String[] LISTENER_CLASSES = new String[] {
+		ServletContextListener.class.getName(),
+		ServletRequestListener.class.getName(),
+		HttpSessionListener.class.getName()
+	};
+	private static final String WEB_CONTEXT_PATH = "Web-ContextPath";
+
+	private final Bundle _bundle;
+	private String _contextSelect;
+	private List<ServiceRegistration<?>> _registrations = new CopyOnWriteArrayList<>();
+
+}

Added: aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtensionFactory.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtensionFactory.java?rev=1794071&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtensionFactory.java (added)
+++ aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtensionFactory.java Fri May  5 16:25:52 2017
@@ -0,0 +1,37 @@
+/**
+ * Licensed 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.aries.cdi.extension.http;
+
+import javax.enterprise.inject.spi.Extension;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+public class HttpExtensionFactory implements ServiceFactory<Extension> {
+
+	@Override
+	public Extension getService(
+		Bundle bundle, ServiceRegistration<Extension> registration) {
+
+		return new HttpExtension(bundle);
+	}
+
+	@Override
+	public void ungetService(
+		Bundle bundle, ServiceRegistration<Extension> registration, Extension service) {
+	}
+
+}

Modified: aries/trunk/cdi/cdi-extension-jndi/bnd.bnd
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-jndi/bnd.bnd?rev=1794071&r1=1794070&r2=1794071&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extension-jndi/bnd.bnd (original)
+++ aries/trunk/cdi/cdi-extension-jndi/bnd.bnd Fri May  5 16:25:52 2017
@@ -1,5 +1,6 @@
 Bundle-Activator: org.apache.aries.cdi.extension.jndi.Activator
 Provide-Capability: osgi.cdi.extension;osgi.cdi.extension=jndi;version:Version="${Bundle-Version}"
-
+Require-Capability:\
+	osgi.implementation;filter:='(&(osgi.implementation=osgi.cdi)(version>=0.0.1)(!(version>=1.0.0)))'
 -contract: JavaCDI
 -includeresource: META-INF/=LICENSE, META-INF/=NOTICE
\ No newline at end of file

Modified: aries/trunk/cdi/cdi-itests/bnd.bnd
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-itests/bnd.bnd?rev=1794071&r1=1794070&r2=1794071&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-itests/bnd.bnd (original)
+++ aries/trunk/cdi/cdi-itests/bnd.bnd Fri May  5 16:25:52 2017
@@ -1,5 +1,9 @@
 Bundle-Description: Integration Test bundle for the CDI Extender
 Export-Package: ${p}.cases.*,${p}.interfaces.*
+Require-Capability:\
+	osgi.cdi.extension;filter:='(&(osgi.cdi.extension=http)(version>=0.0.1)(!(version>=1.0.0)))',\
+	osgi.cdi.extension;filter:='(&(osgi.cdi.extension=jndi)(version>=0.0.1)(!(version>=1.0.0)))',\
+	osgi.service;filter:="(objectClass=org.osgi.service.cm.ConfigurationAdmin)";effective:=active
 Test-Cases: \
 	${classes;CONCRETE;EXTENDS;${p}.cases.AbstractTestCase},\
 	${classes;CONCRETE;ANNOTATED;org.junit.Test}
@@ -26,7 +30,8 @@ p = org.apache.aries.cdi.test
 	tb2.jar,\
 	tb3.jar,\
 	tb4.jar,\
-	tb5.jar
+	tb5.jar,\
+	tb6.jar
 
 # Don't forget that we had to coax the `maven-jar-plugin` NOT to include the `sub-bundle` packages in
 # the root bundle:

Added: aries/trunk/cdi/cdi-itests/bnd/tb6-beans.xml
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-itests/bnd/tb6-beans.xml?rev=1794071&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-itests/bnd/tb6-beans.xml (added)
+++ aries/trunk/cdi/cdi-itests/bnd/tb6-beans.xml Fri May  5 16:25:52 2017
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<beans xmlns:cdi="http://www.osgi.org/xmlns/cdi/v1.0.0">
+	<cdi:bean class="org.apache.aries.cdi.test.tb6.BeanServlet" />
+	<cdi:bean class="org.apache.aries.cdi.test.tb6.SessionBean" />
+</beans>

Added: aries/trunk/cdi/cdi-itests/bnd/tb6.bnd
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-itests/bnd/tb6.bnd?rev=1794071&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-itests/bnd/tb6.bnd (added)
+++ aries/trunk/cdi/cdi-itests/bnd/tb6.bnd Fri May  5 16:25:52 2017
@@ -0,0 +1,5 @@
+Export-Package: ${p}.tb6.*
+Require-Capability:\
+	osgi.extender;filter:='(&(osgi.extender=osgi.cdi)(version>=0.0.1)(!(version>=1.0.0)))',\
+	osgi.cdi.extension;filter:='(&(osgi.cdi.extension=http)(version>=0.0.1)(!(version>=1.0.0)))'
+-includeresource: OSGI-INF/cdi/osgi-beans.xml=bnd/tb6-beans.xml
\ No newline at end of file

Modified: aries/trunk/cdi/cdi-itests/cdi-executable.bndrun
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-itests/cdi-executable.bndrun?rev=1794071&r1=1794070&r2=1794071&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-itests/cdi-executable.bndrun (original)
+++ aries/trunk/cdi/cdi-itests/cdi-executable.bndrun Fri May  5 16:25:52 2017
@@ -5,7 +5,9 @@
 -standalone: target/index.xml
 
 -runrequires: \
-	osgi.identity;filter:='(osgi.identity=org.apache.aries.cdi.extender)',\
+	osgi.identity;filter:='(osgi.identity=org.apache.aries.cdi.extension.http)',\
+	osgi.identity;filter:='(osgi.identity=org.apache.aries.cdi.extension.jndi)',\
+	osgi.identity;filter:='(osgi.identity=org.apache.aries.jndi.core)',\
 	osgi.identity;filter:='(osgi.identity=org.apache.felix.configadmin)',\
 	osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.command)',\
 	osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.jline)',\
@@ -15,20 +17,28 @@
 	jboss-classfilewriter;version='[1.1.2,1.1.3)',\
 	log4j;version='[1.2.17,1.2.18)',\
 	org.apache.aries.cdi.extender;version='[0.0.1,0.0.2)',\
+	org.apache.aries.cdi.extension.http;version='[0.0.1,0.0.2)',\
+	org.apache.aries.cdi.extension.jndi;version='[0.0.1,0.0.2)',\
 	org.apache.aries.javax.cdi-api;version='[0.0.1,0.0.2)',\
 	org.apache.aries.javax.el-api;version='[0.0.1,0.0.2)',\
 	org.apache.aries.javax.inject-api;version='[0.0.1,0.0.2)',\
 	org.apache.aries.javax.interceptor-api;version='[0.0.1,0.0.2)',\
+	org.apache.aries.jndi.api;version='[1.1.0,1.1.1)',\
+	org.apache.aries.jndi.core;version='[1.0.2,1.0.3)',\
+	org.apache.aries.util;version='[1.0.0,1.0.1)',\
 	org.apache.felix.configadmin;version='[1.8.12,1.8.13)',\
 	org.apache.felix.gogo.command;version='[1.0.2,1.0.3)',\
 	org.apache.felix.gogo.jline;version='[1.0.2,1.0.3)',\
 	org.apache.felix.gogo.runtime;version='[1.0.2,1.0.3)',\
+	org.apache.felix.http.jetty;version='[3.4.2,3.4.3)',\
+	org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
 	org.apache.geronimo.specs.geronimo-annotation_1.2_spec;version='[1.0.0,1.0.1)',\
 	org.apache.logging.log4j.api;version='[2.7.0,2.7.1)',\
 	org.jboss.logging.jboss-logging;version='[3.2.1,3.2.2)',\
 	org.jboss.weld.osgi-bundle;version='[2.4.2,2.4.3)',\
 	org.jline;version='[3.0.0,3.0.1)',\
 	org.osgi.service.cdi;version='[1.0.0,1.0.1)',\
+	org.osgi.service.event;version='[1.3.1,1.3.2)',\
 	slf4j.api;version='[1.7.21,1.7.22)',\
 	slf4j.log4j12;version='[1.6.1,1.6.2)'
 

Modified: aries/trunk/cdi/cdi-itests/itest.bndrun
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-itests/itest.bndrun?rev=1794071&r1=1794070&r2=1794071&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-itests/itest.bndrun (original)
+++ aries/trunk/cdi/cdi-itests/itest.bndrun Fri May  5 16:25:52 2017
@@ -5,11 +5,8 @@
 -standalone: target/index.xml
 
 -runrequires: \
-	osgi.identity;filter:='(osgi.identity=org.apache.aries.cdi.extender)',\
-	osgi.identity;filter:='(osgi.identity=org.apache.aries.cdi.extension.jndi)',\
 	osgi.identity;filter:='(osgi.identity=org.apache.aries.cdi.itests)',\
 	osgi.identity;filter:='(osgi.identity=org.apache.aries.jndi.core)',\
-	osgi.identity;filter:='(osgi.identity=org.apache.felix.configadmin)',\
 	osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.command)',\
 	osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.shell)',\
 	osgi.identity;filter:='(osgi.identity=slf4j.log4j12)'
@@ -18,6 +15,7 @@
 	jboss-classfilewriter;version='[1.1.2,1.1.3)',\
 	log4j;version='[1.2.17,1.2.18)',\
 	org.apache.aries.cdi.extender;version='[0.0.1,0.0.2)',\
+	org.apache.aries.cdi.extension.http;version='[0.0.1,0.0.2)',\
 	org.apache.aries.cdi.extension.jndi;version='[0.0.1,0.0.2)',\
 	org.apache.aries.cdi.itests;version='[0.0.1,0.0.2)',\
 	org.apache.aries.javax.cdi-api;version='[0.0.1,0.0.2)',\
@@ -27,16 +25,22 @@
 	org.apache.aries.jndi.api;version='[1.1.0,1.1.1)',\
 	org.apache.aries.jndi.core;version='[1.0.2,1.0.3)',\
 	org.apache.aries.util;version='[1.0.0,1.0.1)',\
+	org.apache.commons.logging;version='[1.2.0,1.2.1)',\
 	org.apache.felix.configadmin;version='[1.8.12,1.8.13)',\
 	org.apache.felix.gogo.command;version='[1.0.2,1.0.3)',\
 	org.apache.felix.gogo.runtime;version='[1.0.2,1.0.3)',\
 	org.apache.felix.gogo.shell;version='[1.0.0,1.0.1)',\
+	org.apache.felix.http.jetty;version='[3.4.2,3.4.3)',\
+	org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
 	org.apache.felix.scr;version='[2.0.8,2.0.9)',\
 	org.apache.geronimo.specs.geronimo-annotation_1.2_spec;version='[1.0.0,1.0.1)',\
+	org.apache.httpcomponents.httpclient;version='[4.5.3,4.5.4)',\
+	org.apache.httpcomponents.httpcore;version='[4.4.6,4.4.7)',\
 	org.apache.logging.log4j.api;version='[2.7.0,2.7.1)',\
 	org.jboss.logging.jboss-logging;version='[3.2.1,3.2.2)',\
 	org.jboss.weld.osgi-bundle;version='[2.4.2,2.4.3)',\
 	org.osgi.service.cdi;version='[1.0.0,1.0.1)',\
+	org.osgi.service.event;version='[1.3.1,1.3.2)',\
 	osgi.enroute.hamcrest.wrapper;version='[1.3.0,1.3.1)',\
 	osgi.enroute.junit.wrapper;version='[4.12.0,4.12.1)',\
 	slf4j.api;version='[1.7.21,1.7.22)',\

Modified: aries/trunk/cdi/cdi-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-itests/pom.xml?rev=1794071&r1=1794070&r2=1794071&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-itests/pom.xml (original)
+++ aries/trunk/cdi/cdi-itests/pom.xml Fri May  5 16:25:52 2017
@@ -115,6 +115,11 @@
 		</dependency>
 		<dependency>
 			<groupId>org.apache.aries.cdi</groupId>
+			<artifactId>org.apache.aries.cdi.extension.http</artifactId>
+			<version>0.0.1-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.aries.cdi</groupId>
 			<artifactId>org.apache.aries.cdi.extension.jndi</artifactId>
 			<version>0.0.1-SNAPSHOT</version>
 		</dependency>
@@ -160,6 +165,16 @@
 		</dependency>
 		<dependency>
 			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.http.jetty</artifactId>
+			<version>3.4.2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.http.servlet-api</artifactId>
+			<version>1.1.2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
 			<artifactId>org.apache.felix.scr</artifactId>
 			<version>2.0.8</version>
 		</dependency>
@@ -169,6 +184,16 @@
 			<version>1.0</version>
 		</dependency>
 		<dependency>
+			<groupId>org.apache.httpcomponents</groupId>
+			<artifactId>httpclient-osgi</artifactId>
+			<version>4.5.3</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.httpcomponents</groupId>
+			<artifactId>httpcore-osgi</artifactId>
+			<version>4.4.6</version>
+		</dependency>
+		<dependency>
 			<groupId>org.apache.logging.log4j</groupId>
 			<artifactId>log4j-api</artifactId>
 			<version>2.7</version>
@@ -206,6 +231,12 @@
 			<scope>provided</scope>
 		</dependency>
 		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.service.event</artifactId>
+			<version>1.3.1</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
 			<groupId>org.osgi</groupId>
 			<artifactId>org.osgi.service.http.whiteboard</artifactId>
 			<version>1.0.0</version>

Added: aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/cases/HttpTestCase.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/cases/HttpTestCase.java?rev=1794071&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/cases/HttpTestCase.java (added)
+++ aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/cases/HttpTestCase.java Fri May  5 16:25:52 2017
@@ -0,0 +1,171 @@
+/**
+ * Licensed 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.aries.cdi.test.cases;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.client.CookieStore;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.protocol.HttpClientContext;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.impl.client.BasicCookieStore;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.osgi.services.HttpClientBuilderFactory;
+import org.apache.http.protocol.BasicHttpContext;
+import org.apache.http.protocol.HttpContext;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.runtime.HttpServiceRuntime;
+import org.osgi.service.http.runtime.dto.RequestInfoDTO;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class HttpTestCase extends AbstractTestCase {
+
+	public void testSessionBean() throws Exception {
+		Bundle tb5Bundle = installBundle("tb6.jar");
+
+		try {
+			String path = "/foo";
+
+			RequestInfoDTO requestInfoDTO = waitFor(path);
+
+			assertEquals("foo", requestInfoDTO.servletDTO.name);
+
+			HttpClientBuilder clientBuilder = hcbf.newBuilder();
+			CloseableHttpClient httpclient = clientBuilder.build();
+
+			CookieStore cookieStore = new BasicCookieStore();
+			HttpContext httpContext = new BasicHttpContext();
+			httpContext.setAttribute(HttpClientContext.COOKIE_STORE, cookieStore);
+
+			URI uri = new URIBuilder(getEndpoint()).
+				setPath(path).
+				setParameter("name", "test").
+				build();
+
+			HttpGet httpget = new HttpGet(uri);
+
+			try (CloseableHttpResponse response = httpclient.execute(httpget, httpContext)) {
+				HttpEntity entity = response.getEntity();
+
+				assertEquals("test", read(entity));
+			}
+
+			for (int i = 0; i < 10; i++) {
+				uri = new URIBuilder(getEndpoint()).
+					setPath(path).
+					build();
+
+				httpget = new HttpGet(uri);
+
+				try (CloseableHttpResponse response = httpclient.execute(httpget, httpContext)) {
+					HttpEntity entity = response.getEntity();
+
+					assertEquals("test", read(entity));
+				}
+			}
+
+			uri = new URIBuilder(getEndpoint()).
+				setPath(path).
+				build();
+
+			httpget = new HttpGet(uri);
+
+			try (CloseableHttpResponse response = httpclient.execute(httpget)) {
+				HttpEntity entity = response.getEntity();
+
+				assertEquals("", read(entity));
+			}
+		}
+		finally {
+			tb5Bundle.uninstall();
+		}
+	}
+
+	private String getEndpoint() {
+		String[] endpoints = (String[])hsrReference.getProperty("osgi.http.endpoint");
+
+		return endpoints[0];
+	}
+
+	@Override
+	protected void setUp() throws Exception {
+		hsrTracker = new ServiceTracker<>(bundleContext, HttpServiceRuntime.class, null);
+
+		hsrTracker.open();
+
+		hsr = hsrTracker.waitForService(timeout);
+
+		hsrReference = hsrTracker.getServiceReference();
+
+		hcbfTracker = new ServiceTracker<>(bundleContext, HttpClientBuilderFactory.class, null);
+
+		hcbfTracker.open();
+
+		hcbf = hcbfTracker.waitForService(timeout);
+
+		assertNotNull(hsr);
+	}
+
+	@Override
+	protected void tearDown() throws Exception {
+		hsrTracker.close();
+		hcbfTracker.close();
+	}
+
+	private static String read(HttpEntity entity) throws Exception {
+		if (entity == null) {
+			return null;
+		}
+
+		try (InputStream in = entity.getContent();
+			java.util.Scanner s = new java.util.Scanner(in)) {
+
+			s.useDelimiter("\\A");
+			return s.hasNext() ? s.next() : "";
+		}
+	}
+
+	private RequestInfoDTO waitFor(String path) throws InterruptedException {
+		return waitFor(path, 10);
+	}
+
+	private RequestInfoDTO waitFor(String path, int intervals) throws InterruptedException {
+		for (int j = intervals; j > 0; j--) {
+			RequestInfoDTO requestInfoDTO = hsr.calculateRequestInfoDTO(path);
+
+			if ((requestInfoDTO.servletDTO != null) || (requestInfoDTO.resourceDTO != null)) {
+				return requestInfoDTO;
+			}
+
+			Thread.sleep(50);
+		}
+
+		assertTrue(String.format("%s not found in time", path), false);
+
+		return null;
+	}
+
+	private HttpClientBuilderFactory hcbf;
+	private HttpServiceRuntime hsr;
+	private ServiceReference<HttpServiceRuntime> hsrReference;
+	private ServiceTracker<HttpClientBuilderFactory, HttpClientBuilderFactory> hcbfTracker;
+	private ServiceTracker<HttpServiceRuntime, HttpServiceRuntime> hsrTracker;
+
+}

Added: aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb6/BeanServlet.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb6/BeanServlet.java?rev=1794071&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb6/BeanServlet.java (added)
+++ aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb6/BeanServlet.java Fri May  5 16:25:52 2017
@@ -0,0 +1,68 @@
+/**
+ * Licensed 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.aries.cdi.test.tb6;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.inject.Inject;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.osgi.service.cdi.annotations.Service;
+import org.osgi.service.http.whiteboard.HttpWhiteboardConstants;
+
+@Service(
+	property = {
+		HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME + "=foo",
+		HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN + "=/foo"
+	},
+	type = Servlet.class
+)
+public class BeanServlet extends HttpServlet {
+
+	private static final long serialVersionUID = 1L;
+
+	@Override
+	protected void service(
+			HttpServletRequest request, HttpServletResponse response)
+		throws ServletException, IOException {
+
+		String name = request.getParameter("name");
+
+		response.setContentType("text/plain");
+
+		PrintWriter writer = response.getWriter();
+
+		if (!sessionBean.hasData() && (name == null)) {
+		}
+		else {
+			if (name != null) {
+				sessionBean.setData(name);
+			}
+
+			writer.print(sessionBean.getData());
+		}
+
+		writer.close();
+	}
+
+	@Inject
+	SessionBean sessionBean;
+
+}

Added: aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb6/SessionBean.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb6/SessionBean.java?rev=1794071&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb6/SessionBean.java (added)
+++ aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb6/SessionBean.java Fri May  5 16:25:52 2017
@@ -0,0 +1,41 @@
+/**
+ * Licensed 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.aries.cdi.test.tb6;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Named;
+
+@Named
+@SessionScoped
+public class SessionBean implements Serializable {
+
+	public boolean hasData() {
+		return data != null;
+	}
+
+	public String getData() {
+		return data;
+	}
+
+	public void setData(String data) {
+		this.data = data;
+	}
+
+	private static final long serialVersionUID = 1L;
+	private String data;
+
+}

Modified: aries/trunk/cdi/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/pom.xml?rev=1794071&r1=1794070&r2=1794071&view=diff
==============================================================================
--- aries/trunk/cdi/pom.xml (original)
+++ aries/trunk/cdi/pom.xml Fri May  5 16:25:52 2017
@@ -54,6 +54,7 @@
 		<module>javax.interceptor-api</module>
 		<module>javax.cdi-api</module>
 		<module>cdi-extender</module>
+		<module>cdi-extension-http</module>
 		<module>cdi-extension-jndi</module>
 		<module>cdi-itests</module>
 	</modules>



Mime
View raw message