You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rz...@apache.org on 2024/09/05 11:48:38 UTC
(tomee) 01/01: TOMEE-4391 - Mojarra 4.0.8
This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a commit to branch TOMEE-4391-Mojarra-4.0.8
in repository https://gitbox.apache.org/repos/asf/tomee.git
commit 50916dc68960ba2b8d237a246dcab3dc78c2db04
Author: Richard Zowalla <rz...@apache.org>
AuthorDate: Thu Sep 5 13:48:30 2024 +0200
TOMEE-4391 - Mojarra 4.0.8
---
pom.xml | 2 +-
.../org/apache/tomee/catalina/TomcatLoader.java | 2 -
.../apache/tomee/mojarra/TomEEMojarraService.java | 39 -----------
.../owb/MojarraAfterBeanDiscoveryDecorator.java | 76 ----------------------
...ojarraPassivationCapableThirdPartyBeanImpl.java | 50 --------------
.../mojarra/owb/OwbCompatibleCdiExtension.java | 38 -----------
6 files changed, 1 insertion(+), 206 deletions(-)
diff --git a/pom.xml b/pom.xml
index 9c9d89bac9..16e3ad6f05 100644
--- a/pom.xml
+++ b/pom.xml
@@ -225,7 +225,7 @@
<!-- org.eclipse -->
<version.eclipselink>4.0.4</version.eclipselink>
<!-- org.glassfish -->
- <version.mojarra>4.0.7</version.mojarra>
+ <version.mojarra>4.0.8</version.mojarra>
<!-- org.hibernate -->
<version.hibernate.orm>6.4.3.Final</version.hibernate.orm>
<version.hibernate.validator>8.0.1.Final</version.hibernate.validator>
diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatLoader.java b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatLoader.java
index a535614d87..599a3668e4 100644
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatLoader.java
+++ b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatLoader.java
@@ -218,8 +218,6 @@ public class TomcatLoader implements Loader {
SystemInstance.get().setComponent(WebDeploymentListeners.class, new WebDeploymentListeners());
optionalService(properties, "org.apache.tomee.microprofile.TomEEMicroProfileService");
- optionalService(properties, "org.apache.tomee.mojarra.TomEEMojarraService");
-
// tomee webapp enricher
final TomEEClassLoaderEnricher classLoaderEnricher = new TomEEClassLoaderEnricher();
SystemInstance.get().setComponent(WebAppEnricher.class, classLoaderEnricher);
diff --git a/tomee/tomee-mojarra/src/main/java/org/apache/tomee/mojarra/TomEEMojarraService.java b/tomee/tomee-mojarra/src/main/java/org/apache/tomee/mojarra/TomEEMojarraService.java
deleted file mode 100644
index 98bf3dfb1e..0000000000
--- a/tomee/tomee-mojarra/src/main/java/org/apache/tomee/mojarra/TomEEMojarraService.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.tomee.mojarra;
-
-import org.apache.openejb.cdi.OptimizedLoaderService;
-import org.apache.openejb.spi.Service;
-import org.apache.tomee.mojarra.owb.OwbCompatibleCdiExtension;
-
-import java.util.Properties;
-
-// This is just a workaround until we have a permanent solution
-// Remove this optional service in TomcatLoader again when deleting this service
-public class TomEEMojarraService implements Service {
- @Override
- public void init(Properties props) throws Exception {
- try {
- final Class<?> extension = Class.forName("com.sun.faces.cdi.CdiExtension");
- // Replace Mojarra's CDI extension because it registers beans OWB can't proxy since mojarra 4.0.1
- // See https://github.com/eclipse-ee4j/mojarra/issues/5457
- OptimizedLoaderService.EXTENSION_REPLACEMENTS.put(extension.getName(), OwbCompatibleCdiExtension.class.getName());
- } catch (ClassNotFoundException ignored) {
-
- }
- }
-}
diff --git a/tomee/tomee-mojarra/src/main/java/org/apache/tomee/mojarra/owb/MojarraAfterBeanDiscoveryDecorator.java b/tomee/tomee-mojarra/src/main/java/org/apache/tomee/mojarra/owb/MojarraAfterBeanDiscoveryDecorator.java
deleted file mode 100644
index 7717eb5153..0000000000
--- a/tomee/tomee-mojarra/src/main/java/org/apache/tomee/mojarra/owb/MojarraAfterBeanDiscoveryDecorator.java
+++ /dev/null
@@ -1,76 +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.tomee.mojarra.owb;
-
-import jakarta.enterprise.context.spi.Context;
-import jakarta.enterprise.inject.spi.AfterBeanDiscovery;
-import jakarta.enterprise.inject.spi.AnnotatedType;
-import jakarta.enterprise.inject.spi.Bean;
-import jakarta.enterprise.inject.spi.ObserverMethod;
-import jakarta.enterprise.inject.spi.configurator.BeanConfigurator;
-import jakarta.enterprise.inject.spi.configurator.ObserverMethodConfigurator;
-import org.apache.webbeans.config.WebBeansContext;
-
-public class MojarraAfterBeanDiscoveryDecorator implements AfterBeanDiscovery {
- private final AfterBeanDiscovery delegate;
- private final WebBeansContext webBeansContext;
-
- public MojarraAfterBeanDiscoveryDecorator(final AfterBeanDiscovery delegate, WebBeansContext webBeansContext) {
- this.delegate = delegate;
- this.webBeansContext = webBeansContext;
- }
-
- @Override
- public void addDefinitionError(Throwable t) {
- delegate.addDefinitionError(t);
- }
-
- @Override
- public void addBean(Bean<?> bean) {
- delegate.addBean(new MojarraPassivationCapableThirdPartyBeanImpl<>(webBeansContext, bean));
- }
-
- @Override
- public <T> BeanConfigurator<T> addBean() {
- return delegate.addBean();
- }
-
- @Override
- public void addObserverMethod(ObserverMethod<?> observerMethod) {
- delegate.addObserverMethod(observerMethod);
- }
-
- @Override
- public <T> ObserverMethodConfigurator<T> addObserverMethod() {
- return delegate.addObserverMethod();
- }
-
- @Override
- public void addContext(Context context) {
- delegate.addContext(context);
- }
-
- @Override
- public <T> AnnotatedType<T> getAnnotatedType(Class<T> type, String id) {
- return delegate.getAnnotatedType(type, id);
- }
-
- @Override
- public <T> Iterable<AnnotatedType<T>> getAnnotatedTypes(Class<T> type) {
- return delegate.getAnnotatedTypes(type);
- }
-}
diff --git a/tomee/tomee-mojarra/src/main/java/org/apache/tomee/mojarra/owb/MojarraPassivationCapableThirdPartyBeanImpl.java b/tomee/tomee-mojarra/src/main/java/org/apache/tomee/mojarra/owb/MojarraPassivationCapableThirdPartyBeanImpl.java
deleted file mode 100644
index f7cee2dda4..0000000000
--- a/tomee/tomee-mojarra/src/main/java/org/apache/tomee/mojarra/owb/MojarraPassivationCapableThirdPartyBeanImpl.java
+++ /dev/null
@@ -1,50 +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.tomee.mojarra.owb;
-
-import jakarta.enterprise.inject.spi.Bean;
-import org.apache.webbeans.component.third.PassivationCapableThirdpartyBeanImpl;
-import org.apache.webbeans.config.WebBeansContext;
-
-import java.lang.reflect.Type;
-
-public class MojarraPassivationCapableThirdPartyBeanImpl<T> extends PassivationCapableThirdpartyBeanImpl<T> {
- private final Class<T> returnType;
-
- public MojarraPassivationCapableThirdPartyBeanImpl(WebBeansContext webBeansContext, Bean<T> bean) {
- super(webBeansContext, bean);
-
- Class<?> tempReturnType = Object.class;
- for (Type type : bean.getTypes()) {
- if (!(type instanceof Class<?> clazz)) {
- continue;
- }
-
- if (tempReturnType.isAssignableFrom(clazz))
- {
- tempReturnType = clazz;
- }
- }
-
- this.returnType = (Class<T>) tempReturnType;
- }
-
- @Override
- public Class<T> getReturnType() {
- return returnType;
- }
-}
diff --git a/tomee/tomee-mojarra/src/main/java/org/apache/tomee/mojarra/owb/OwbCompatibleCdiExtension.java b/tomee/tomee-mojarra/src/main/java/org/apache/tomee/mojarra/owb/OwbCompatibleCdiExtension.java
deleted file mode 100644
index 2b8b141789..0000000000
--- a/tomee/tomee-mojarra/src/main/java/org/apache/tomee/mojarra/owb/OwbCompatibleCdiExtension.java
+++ /dev/null
@@ -1,38 +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.tomee.mojarra.owb;
-
-import com.sun.faces.cdi.CdiExtension;
-import jakarta.enterprise.event.Observes;
-import jakarta.enterprise.inject.spi.AfterBeanDiscovery;
-import jakarta.enterprise.inject.spi.BeanManager;
-import org.apache.webbeans.config.WebBeansContext;
-
-public class OwbCompatibleCdiExtension extends CdiExtension {
- private final WebBeansContext webBeansContext;
-
- // no-arg constructor is omitted on purpose, WebBeansContext is injected by OptimizedLoaderService
- // when replacing the Mojarra Extension with this one
- public OwbCompatibleCdiExtension(WebBeansContext webBeansContext) {
- this.webBeansContext = webBeansContext;
- }
-
- @Override
- public void afterBeanDiscovery(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager) {
- super.afterBeanDiscovery(new MojarraAfterBeanDiscoveryDecorator(afterBeanDiscovery, webBeansContext), beanManager);
- }
-}