You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ro...@apache.org on 2018/12/14 17:35:45 UTC

svn commit: r1848962 - in /aries/trunk/cdi: ./ cdi-extension-el-jsp/ cdi-extension-el-jsp/src/ cdi-extension-el-jsp/src/main/ cdi-extension-el-jsp/src/main/java/ cdi-extension-el-jsp/src/main/java/org/ cdi-extension-el-jsp/src/main/java/org/apache/ cdi...

Author: rotty3000
Date: Fri Dec 14 17:35:44 2018
New Revision: 1848962

URL: http://svn.apache.org/viewvc?rev=1848962&view=rev
Log:
[CDI] separate EL-JSP support from http extension

Signed-off-by: Raymond Auge <ro...@apache.org>

Added:
    aries/trunk/cdi/cdi-extension-el-jsp/
    aries/trunk/cdi/cdi-extension-el-jsp/pom.xml
      - copied, changed from r1848961, aries/trunk/cdi/cdi-extension-http/pom.xml
    aries/trunk/cdi/cdi-extension-el-jsp/src/
    aries/trunk/cdi/cdi-extension-el-jsp/src/main/
    aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/
    aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/
    aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/
    aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/
    aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/
    aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/
    aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/
    aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/
    aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/ELJSPActivator.java
    aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/ELJSPExtension.java
      - copied, changed from r1848961, aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java
    aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/ELJSPExtensionFactory.java
    aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/package-info.java
Modified:
    aries/trunk/cdi/cdi-extension-http/pom.xml
    aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java
    aries/trunk/cdi/pom.xml

Copied: aries/trunk/cdi/cdi-extension-el-jsp/pom.xml (from r1848961, aries/trunk/cdi/cdi-extension-http/pom.xml)
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-el-jsp/pom.xml?p2=aries/trunk/cdi/cdi-extension-el-jsp/pom.xml&p1=aries/trunk/cdi/cdi-extension-http/pom.xml&r1=1848961&r2=1848962&rev=1848962&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extension-http/pom.xml (original)
+++ aries/trunk/cdi/cdi-extension-el-jsp/pom.xml Fri Dec 14 17:35:44 2018
@@ -15,7 +15,7 @@
  */
 -->
 
-<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">
+<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/xsd/maven-4.0.0.xsd">
 
 	<modelVersion>4.0.0</modelVersion>
 
@@ -23,14 +23,12 @@
 		<groupId>org.apache.aries.cdi</groupId>
 		<artifactId>org.apache.aries.cdi</artifactId>
 		<version>0.0.2-SNAPSHOT</version>
-		<relativePath>..</relativePath>
 	</parent>
 
-	<artifactId>org.apache.aries.cdi.extension.http</artifactId>
-	<name>Aries CDI Http Extension</name>
+	<artifactId>org.apache.aries.cdi.extension.el.jsp</artifactId>
+	<name>Aries CDI EL-JSP Extension</name>
 	<description>
-		Provides support to CDI bundles for http servlet scopes; @RequestScoped,
-		@SessionScoped and @ConversationScoped.
+		Connects the CDI ELResolver into the JSP context.
 	</description>
 
 	<build>
@@ -41,8 +39,7 @@
 				<configuration>
 					<bnd><![CDATA[
 						Import-Package:\
-							javax.el;resolution:=optional;-remove-attribute:=version,\
-							javax.servlet.jsp;resolution:=optional;-remove-attribute:=version,\
+							javax.servlet.jsp;-remove-attribute:=version,\
 							*
 					]]></bnd>
 				</configuration>
@@ -52,6 +49,12 @@
 
 	<dependencies>
 		<dependency>
+			<groupId>javax.servlet.jsp</groupId>
+			<artifactId>javax.servlet.jsp-api</artifactId>
+			<version>2.3.3</version>
+		</dependency>
+
+		<dependency>
 			<groupId>org.apache.felix</groupId>
 			<artifactId>org.apache.felix.http.servlet-api</artifactId>
 		</dependency>
@@ -68,20 +71,10 @@
 			<artifactId>geronimo-interceptor_1.2_spec</artifactId>
 		</dependency>
 		<dependency>
-			<groupId>org.glassfish</groupId>
-			<artifactId>javax.el</artifactId>
-			<version>3.0.1-b05</version>
-		</dependency>
-		<dependency>
 			<groupId>org.apache.geronimo.specs</groupId>
 			<artifactId>geronimo-jcdi_2.0_spec</artifactId>
 		</dependency>
 		<dependency>
-			<groupId>javax.servlet.jsp</groupId>
-			<artifactId>javax.servlet.jsp-api</artifactId>
-			<version>2.3.3</version>
-		</dependency>
-		<dependency>
 			<groupId>org.jboss.weld</groupId>
 			<artifactId>weld-osgi-bundle</artifactId>
 		</dependency>
@@ -109,7 +102,7 @@
 			<groupId>org.osgi</groupId>
 			<artifactId>osgi.annotation</artifactId>
 		</dependency>
-			<dependency>
+		<dependency>
 			<groupId>org.osgi</groupId>
 			<artifactId>osgi.core</artifactId>
 		</dependency>

Added: aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/ELJSPActivator.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/ELJSPActivator.java?rev=1848962&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/ELJSPActivator.java (added)
+++ aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/ELJSPActivator.java Fri Dec 14 17:35:44 2018
@@ -0,0 +1,56 @@
+/**
+ * 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.el.jsp;
+
+import static org.osgi.framework.Constants.BUNDLE_ACTIVATOR;
+import static org.osgi.framework.Constants.SERVICE_DESCRIPTION;
+import static org.osgi.framework.Constants.SERVICE_VENDOR;
+import static org.osgi.service.cdi.CDIConstants.CDI_EXTENSION_PROPERTY;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import javax.enterprise.inject.spi.Extension;
+
+import org.osgi.annotation.bundle.Header;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+@Header(
+	name = BUNDLE_ACTIVATOR,
+	value = "${@class}"
+)
+public class ELJSPActivator implements BundleActivator {
+
+	@Override
+	public void start(BundleContext context) throws Exception {
+		Dictionary<String, Object> properties = new Hashtable<>();
+		properties.put(CDI_EXTENSION_PROPERTY, "aries.cdi.el.jsp");
+		properties.put(SERVICE_DESCRIPTION, "Aries CDI - EL-JSP Extension Factory");
+		properties.put(SERVICE_VENDOR, "Apache Software Foundation");
+
+		_serviceRegistration = context.registerService(
+			Extension.class, new ELJSPExtensionFactory(), properties);
+	}
+
+	@Override
+	public void stop(BundleContext context) throws Exception {
+		_serviceRegistration.unregister();
+	}
+
+	private ServiceRegistration<Extension> _serviceRegistration;
+
+}

Copied: aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/ELJSPExtension.java (from r1848961, 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-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/ELJSPExtension.java?p2=aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/ELJSPExtension.java&p1=aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java&r1=1848961&r2=1848962&rev=1848962&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java (original)
+++ aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/ELJSPExtension.java Fri Dec 14 17:35:44 2018
@@ -12,7 +12,7 @@
  * limitations under the License.
  */
 
-package org.apache.aries.cdi.extension.http;
+package org.apache.aries.cdi.extension.el.jsp;
 
 import static javax.interceptor.Interceptor.Priority.LIBRARY_AFTER;
 import static org.osgi.framework.Constants.SERVICE_DESCRIPTION;
@@ -32,77 +32,49 @@ import java.util.Map;
 import javax.annotation.Priority;
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.spi.AfterDeploymentValidation;
-import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.BeforeShutdown;
 import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.InjectionTargetFactory;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
-import javax.servlet.ServletRequestListener;
-import javax.servlet.http.HttpSessionListener;
+import javax.servlet.jsp.JspApplicationContext;
+import javax.servlet.jsp.JspFactory;
 
 import org.jboss.weld.module.web.el.WeldELContextListener;
-import org.jboss.weld.module.web.servlet.WeldInitialListener;
 import org.osgi.framework.Bundle;
-import org.osgi.framework.FrameworkUtil;
 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;
 
-public class HttpExtension implements Extension {
+public class ELJSPExtension implements Extension {
 
-	public HttpExtension(Bundle bundle) {
+	public ELJSPExtension(Bundle bundle) {
 		_bundle = bundle;
 	}
 
-	// TODO process javax.servlet.annotations annotations
-
 	void afterDeploymentValidation(
 		@Observes @Priority(LIBRARY_AFTER + 800)
 		AfterDeploymentValidation adv, BeanManager beanManager) {
 
 		Dictionary<String, Object> properties = new Hashtable<>();
 
-		properties.put(SERVICE_DESCRIPTION, "Aries CDI - HTTP Portable Extension");
+		properties.put(SERVICE_DESCRIPTION, "Aries CDI - ELResolver Servlet Context Listener");
 		properties.put(SERVICE_VENDOR, "Apache Software Foundation");
 		properties.put(HTTP_WHITEBOARD_CONTEXT_SELECT, getSelectedContext());
 		properties.put(HTTP_WHITEBOARD_LISTENER, Boolean.TRUE.toString());
 		properties.put(SERVICE_RANKING, Integer.MAX_VALUE - 100);
 
-		AnnotatedType<WeldInitialListener> annotatedType = beanManager.createAnnotatedType(WeldInitialListener.class);
-		InjectionTargetFactory<WeldInitialListener> injectionTargetFactory = beanManager.getInjectionTargetFactory(annotatedType);
-		Bean<WeldInitialListener> bean = beanManager.createBean(beanManager.createBeanAttributes(annotatedType), WeldInitialListener.class, injectionTargetFactory);
-
-		WeldInitialListener initialListener = bean.create(beanManager.createCreationalContext(bean));
-
-		_listenerRegistration = _bundle.getBundleContext().registerService(
-			LISTENER_CLASSES, initialListener, properties);
-
-		properties.put(
-			SERVICE_DESCRIPTION, "Aries CDI - ELResolver Servlet Context Listener");
-
-		_elAdaptorRegistration = _bundle.getBundleContext().registerService(
+		_registration = _bundle.getBundleContext().registerService(
 			ServletContextListener.class,
 			new ServletContextListener() {
 				@Override
 				public void contextInitialized(ServletContextEvent event) {
 					ServletContext servletContext = event.getServletContext();
 
-					try {
-						FrameworkUtil.getBundle(getClass()).loadClass("javax.servlet.jsp.JspFactory");
-					}
-					catch (ClassNotFoundException e) {
-						servletContext.log("No JSP API found. Skiping ELResolver wiring for: " + _bundle);
-
-						return;
-					}
-
-					javax.servlet.jsp.JspApplicationContext jspApplicationContext = javax.servlet.jsp.JspFactory.getDefaultFactory().getJspApplicationContext(servletContext);
+					JspApplicationContext jspApplicationContext = JspFactory.getDefaultFactory().getJspApplicationContext(servletContext);
 
 					// Register the ELResolver with JSP
 					jspApplicationContext.addELResolver(beanManager.getELResolver());
@@ -125,11 +97,8 @@ public class HttpExtension implements Ex
 	}
 
 	void beforeShutdown(@Observes BeforeShutdown bs) {
-		if (_listenerRegistration != null) {
-			_listenerRegistration.unregister();
-		}
-		if (_elAdaptorRegistration != null) {
-			_elAdaptorRegistration.unregister();
+		if (_registration != null) {
+			_registration.unregister();
 		}
 	}
 
@@ -181,16 +150,10 @@ public class HttpExtension implements Ex
 
 	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 ServiceRegistration<?> _listenerRegistration;
-	private ServiceRegistration<?> _elAdaptorRegistration;
+	private ServiceRegistration<?> _registration;
 
 }

Added: aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/ELJSPExtensionFactory.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/ELJSPExtensionFactory.java?rev=1848962&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/ELJSPExtensionFactory.java (added)
+++ aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/ELJSPExtensionFactory.java Fri Dec 14 17:35:44 2018
@@ -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.el.jsp;
+
+import javax.enterprise.inject.spi.Extension;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.PrototypeServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+public class ELJSPExtensionFactory implements PrototypeServiceFactory<Extension> {
+
+	@Override
+	public Extension getService(
+		Bundle bundle, ServiceRegistration<Extension> registration) {
+
+		return new ELJSPExtension(bundle);
+	}
+
+	@Override
+	public void ungetService(
+		Bundle bundle, ServiceRegistration<Extension> registration, Extension service) {
+	}
+
+}

Added: aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/package-info.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/package-info.java?rev=1848962&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/package-info.java (added)
+++ aries/trunk/cdi/cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/package-info.java Fri Dec 14 17:35:44 2018
@@ -0,0 +1,48 @@
+/**
+ * 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.
+ */
+
+@org.osgi.annotation.bundle.Capability(
+	attribute = "objectClass:List<String>=javax.enterprise.inject.spi.Extension",
+	namespace = SERVICE_NAMESPACE
+)
+@org.osgi.annotation.bundle.Capability(
+	name = "aries.cdi.el.jsp",
+	namespace = CDI_EXTENSION_PROPERTY,
+	uses= {
+		javax.annotation.Priority.class,
+		javax.el.ELContext.class,
+		javax.enterprise.event.Observes.class,
+		javax.enterprise.inject.spi.Extension.class,
+		javax.servlet.ServletContextListener.class,
+		javax.servlet.jsp.JspFactory.class
+	},
+	version = "1.0.0"
+)
+// Deliberately depend on Http Whiteboard version 1.0.0 (the spec annotation starts at 1.1.0)
+@org.osgi.annotation.bundle.Requirement(
+	name = "osgi.http",
+	namespace = IMPLEMENTATION_NAMESPACE,
+	version = "1.0.0"
+)
+@org.osgi.annotation.bundle.Requirement(
+	attribute = "osgi.contract=JavaJSP",
+	filter = "(&(osgi.contract=JavaJSP)(version=${jsp.version}))",
+	namespace = "osgi.contract"
+)
+@org.osgi.service.cdi.annotations.RequireCDIImplementation
+package org.apache.aries.cdi.extension.el.jsp;
+
+import static org.osgi.namespace.implementation.ImplementationNamespace.IMPLEMENTATION_NAMESPACE;
+import static org.osgi.namespace.service.ServiceNamespace.SERVICE_NAMESPACE;
+import static org.osgi.service.cdi.CDIConstants.CDI_EXTENSION_PROPERTY;

Modified: aries/trunk/cdi/cdi-extension-http/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-http/pom.xml?rev=1848962&r1=1848961&r2=1848962&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extension-http/pom.xml (original)
+++ aries/trunk/cdi/cdi-extension-http/pom.xml Fri Dec 14 17:35:44 2018
@@ -38,14 +38,6 @@
 			<plugin>
 				<groupId>biz.aQute.bnd</groupId>
 				<artifactId>bnd-maven-plugin</artifactId>
-				<configuration>
-					<bnd><![CDATA[
-						Import-Package:\
-							javax.el;resolution:=optional;-remove-attribute:=version,\
-							javax.servlet.jsp;resolution:=optional;-remove-attribute:=version,\
-							*
-					]]></bnd>
-				</configuration>
 			</plugin>
 		</plugins>
 	</build>
@@ -61,27 +53,13 @@
 		</dependency>
 		<dependency>
 			<groupId>org.apache.geronimo.specs</groupId>
-			<artifactId>geronimo-el_2.2_spec</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.geronimo.specs</groupId>
 			<artifactId>geronimo-interceptor_1.2_spec</artifactId>
 		</dependency>
 		<dependency>
-			<groupId>org.glassfish</groupId>
-			<artifactId>javax.el</artifactId>
-			<version>3.0.1-b05</version>
-		</dependency>
-		<dependency>
 			<groupId>org.apache.geronimo.specs</groupId>
 			<artifactId>geronimo-jcdi_2.0_spec</artifactId>
 		</dependency>
 		<dependency>
-			<groupId>javax.servlet.jsp</groupId>
-			<artifactId>javax.servlet.jsp-api</artifactId>
-			<version>2.3.3</version>
-		</dependency>
-		<dependency>
 			<groupId>org.jboss.weld</groupId>
 			<artifactId>weld-osgi-bundle</artifactId>
 		</dependency>
@@ -114,4 +92,4 @@
 			<artifactId>osgi.core</artifactId>
 		</dependency>
 	</dependencies>
-</project>
\ No newline at end of file
+</project>

Modified: 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=1848962&r1=1848961&r2=1848962&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java (original)
+++ aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java Fri Dec 14 17:35:44 2018
@@ -38,16 +38,12 @@ import javax.enterprise.inject.spi.BeanM
 import javax.enterprise.inject.spi.BeforeShutdown;
 import javax.enterprise.inject.spi.Extension;
 import javax.enterprise.inject.spi.InjectionTargetFactory;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
 import javax.servlet.ServletRequestListener;
 import javax.servlet.http.HttpSessionListener;
 
-import org.jboss.weld.module.web.el.WeldELContextListener;
 import org.jboss.weld.module.web.servlet.WeldInitialListener;
 import org.osgi.framework.Bundle;
-import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.framework.wiring.BundleCapability;
 import org.osgi.framework.wiring.BundleRequirement;
@@ -82,55 +78,12 @@ public class HttpExtension implements Ex
 
 		_listenerRegistration = _bundle.getBundleContext().registerService(
 			LISTENER_CLASSES, initialListener, properties);
-
-		properties.put(
-			SERVICE_DESCRIPTION, "Aries CDI - ELResolver Servlet Context Listener");
-
-		_elAdaptorRegistration = _bundle.getBundleContext().registerService(
-			ServletContextListener.class,
-			new ServletContextListener() {
-				@Override
-				public void contextInitialized(ServletContextEvent event) {
-					ServletContext servletContext = event.getServletContext();
-
-					try {
-						FrameworkUtil.getBundle(getClass()).loadClass("javax.servlet.jsp.JspFactory");
-					}
-					catch (ClassNotFoundException e) {
-						servletContext.log("No JSP API found. Skiping ELResolver wiring for: " + _bundle);
-
-						return;
-					}
-
-					javax.servlet.jsp.JspApplicationContext jspApplicationContext = javax.servlet.jsp.JspFactory.getDefaultFactory().getJspApplicationContext(servletContext);
-
-					// Register the ELResolver with JSP
-					jspApplicationContext.addELResolver(beanManager.getELResolver());
-
-					// Register ELContextListener with JSP
-					try {
-						jspApplicationContext.addELContextListener(new WeldELContextListener());
-					}
-					catch (Exception e) {
-						servletContext.log("Failure registering ELContextListener", e);
-					}
-				}
-
-				@Override
-				public void contextDestroyed(ServletContextEvent event) {
-					// Nothing to do here
-				}
-			},
-			properties);
 	}
 
 	void beforeShutdown(@Observes BeforeShutdown bs) {
 		if (_listenerRegistration != null) {
 			_listenerRegistration.unregister();
 		}
-		if (_elAdaptorRegistration != null) {
-			_elAdaptorRegistration.unregister();
-		}
 	}
 
 	private Map<String, Object> getAttributes() {
@@ -191,6 +144,5 @@ public class HttpExtension implements Ex
 	private final Bundle _bundle;
 	private String _contextSelect;
 	private ServiceRegistration<?> _listenerRegistration;
-	private ServiceRegistration<?> _elAdaptorRegistration;
 
 }

Modified: aries/trunk/cdi/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/pom.xml?rev=1848962&r1=1848961&r2=1848962&view=diff
==============================================================================
--- aries/trunk/cdi/pom.xml (original)
+++ aries/trunk/cdi/pom.xml Fri Dec 14 17:35:44 2018
@@ -34,6 +34,7 @@
 
 	<properties>
 		<bnd.version>4.1.0</bnd.version>
+		<jsp.version>2.0</jsp.version>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 		<surefire.version>2.12</surefire.version>
 		<weld.release>3.0.5.Final</weld.release>
@@ -49,6 +50,7 @@
 	<modules>
 		<module>cdi-extra</module>
 		<module>cdi-extender</module>
+		<module>cdi-extension-el-jsp</module>
 		<module>cdi-extension-http</module>
 		<module>cdi-extension-jndi</module>
 		<module>cdi-itests</module>