diff --git a/dev/io.openliberty.org.jboss.resteasy.common.ee10/bnd.bnd b/dev/io.openliberty.org.jboss.resteasy.common.ee10/bnd.bnd index ea8a01a2f31..4e13c0005a6 100644 --- a/dev/io.openliberty.org.jboss.resteasy.common.ee10/bnd.bnd +++ b/dev/io.openliberty.org.jboss.resteasy.common.ee10/bnd.bnd @@ -231,7 +231,8 @@ Include-Resource:\ com.ibm.ws.kernel.service,\ io.openliberty.webcontainer.security.internal,\ com.ibm.websphere.security,\ - com.ibm.ws.org.jboss.jandex + com.ibm.ws.org.jboss.jandex,\ + org.eclipse.osgi -testpath: \ ../build.sharedResources/lib/junit/old/junit.jar;version=file,\ diff --git a/dev/io.openliberty.org.jboss.resteasy.common.ee10/src/org/jboss/resteasy/core/ContextParameterInjector.java b/dev/io.openliberty.org.jboss.resteasy.common.ee10/src/org/jboss/resteasy/core/ContextParameterInjector.java index ccf36a42bc2..780e43d61d3 100644 --- a/dev/io.openliberty.org.jboss.resteasy.common.ee10/src/org/jboss/resteasy/core/ContextParameterInjector.java +++ b/dev/io.openliberty.org.jboss.resteasy.common.ee10/src/org/jboss/resteasy/core/ContextParameterInjector.java @@ -34,6 +34,7 @@ import java.util.Set; import java.util.concurrent.CompletionStage; +import org.eclipse.osgi.internal.loader.EquinoxClassLoader; import jakarta.ws.rs.container.ResourceInfo; import jakarta.ws.rs.core.Application; import jakarta.ws.rs.ext.Providers; @@ -202,12 +203,20 @@ protected Object createProxy() { throw new RuntimeException(e); } } else { + // Liberty change start + Class[] intfs; Object delegate = factory.getContextData(rawType, genericType, annotations, false); - Class[] intfs = computeInterfaces(delegate, rawType); + if (delegate != null && + ((rawType.getName().startsWith("org.jboss.resteasy")) || + (!(delegate.getClass().getClassLoader() instanceof EquinoxClassLoader)))) { + intfs = computeInterfaces(delegate, rawType); + } else { + intfs = computeInterfaces(null, rawType); + } + // Liberty change end ClassLoader clazzLoader = null; final SecurityManager sm = System.getSecurityManager(); if (sm == null) { - // liberty change - use this classloader clazzLoader = delegate == null ? rawType.getClassLoader() : delegate.getClass().getClassLoader(); // The class loader may be null for primitives, void or the type was loaded from the bootstrap class loader. // In such cases we should use the TCCL. @@ -215,7 +224,7 @@ protected Object createProxy() { clazzLoader = Thread.currentThread().getContextClassLoader(); } if (clazzLoader == null) { - clazzLoader = this.getClass().getClassLoader(); + clazzLoader = this.getClass().getClassLoader(); //liberty change } } else { clazzLoader = AccessController.doPrivileged(new PrivilegedAction() { diff --git a/dev/io.openliberty.org.jboss.resteasy.common.ee11/bnd.bnd b/dev/io.openliberty.org.jboss.resteasy.common.ee11/bnd.bnd index 10ce10cffa9..4547dd1cd99 100644 --- a/dev/io.openliberty.org.jboss.resteasy.common.ee11/bnd.bnd +++ b/dev/io.openliberty.org.jboss.resteasy.common.ee11/bnd.bnd @@ -198,40 +198,41 @@ Include-Resource:\ META-INF=resources/META-INF -buildpath: \ - org.jboss.resteasy:resteasy-client-api;strategy=exact;version='${resteasy-version}',\ - org.jboss.resteasy:resteasy-client;strategy=exact;version='${resteasy-version}',\ - org.jboss.resteasy:resteasy-core-spi;strategy=exact;version='${resteasy-version}',\ - org.jboss.resteasy:resteasy-core;strategy=exact;version='${resteasy-version}',\ - org.jboss.resteasy:resteasy-multipart-provider;strategy=exact;version='${resteasy-version}',\ - org.jboss.resteasy:resteasy-tracing-api;strategy=exact;version='${resteasy-tracing-api-version}',\ - org.apache.james:apache-mime4j-core;strategy=exact;version='${apache-mime4j-version}',\ - org.apache.james:apache-mime4j-dom;strategy=exact;version='${apache-mime4j-version}',\ - org.apache.james:apache-mime4j-storage;strategy=exact;version='${apache-mime4j-version}',\ - io.openliberty.jakarta.restfulWS.4.0,\ - io.openliberty.jakarta.activation.2.1,\ - io.openliberty.jakarta.servlet.6.1,\ - io.openliberty.jakarta.annotation.3.0,\ - io.openliberty.jakarta.jsonp.2.1,\ - io.openliberty.jakarta.cdi.4.1,\ - com.ibm.ws.org.apache.commons.io,\ - com.ibm.ws.org.apache.httpcomponents,\ - io.openliberty.org.eclipse.microprofile.config.3.0;version=latest,\ - com.ibm.websphere.org.osgi.service.component;version=latest,\ - com.ibm.websphere.org.reactivestreams.reactive-streams.1.0;version=latest,\ - com.ibm.ws.adaptable.module;version=latest,\ - com.ibm.ws.classloading;version=latest,\ - com.ibm.ws.container.service;version=latest,\ - com.ibm.ws.container.service.compat;version=latest,\ - com.ibm.ws.logging.core,\ - com.ibm.ws.threading,\ - io.openliberty.org.jboss.logging35,\ - com.ibm.ws.org.osgi.annotation.versioning;version=latest,\ - com.ibm.wsspi.org.osgi.service.component.annotations;version=latest,\ - com.ibm.websphere.org.osgi.core;version=latest,\ - com.ibm.ws.kernel.service,\ - io.openliberty.webcontainer.security.internal,\ - com.ibm.websphere.security,\ - com.ibm.ws.org.jboss.jandex + org.jboss.resteasy:resteasy-client-api;strategy=exact;version='${resteasy-version}',\ + org.jboss.resteasy:resteasy-client;strategy=exact;version='${resteasy-version}',\ + org.jboss.resteasy:resteasy-core-spi;strategy=exact;version='${resteasy-version}',\ + org.jboss.resteasy:resteasy-core;strategy=exact;version='${resteasy-version}',\ + org.jboss.resteasy:resteasy-multipart-provider;strategy=exact;version='${resteasy-version}',\ + org.jboss.resteasy:resteasy-tracing-api;strategy=exact;version='${resteasy-tracing-api-version}',\ + org.apache.james:apache-mime4j-core;strategy=exact;version='${apache-mime4j-version}',\ + org.apache.james:apache-mime4j-dom;strategy=exact;version='${apache-mime4j-version}',\ + org.apache.james:apache-mime4j-storage;strategy=exact;version='${apache-mime4j-version}',\ + io.openliberty.jakarta.restfulWS.4.0,\ + io.openliberty.jakarta.activation.2.1,\ + io.openliberty.jakarta.servlet.6.1,\ + io.openliberty.jakarta.annotation.3.0,\ + io.openliberty.jakarta.jsonp.2.1,\ + io.openliberty.jakarta.cdi.4.1,\ + com.ibm.ws.org.apache.commons.io,\ + com.ibm.ws.org.apache.httpcomponents,\ + io.openliberty.org.eclipse.microprofile.config.3.0;version=latest,\ + com.ibm.websphere.org.osgi.service.component;version=latest,\ + com.ibm.websphere.org.reactivestreams.reactive-streams.1.0;version=latest,\ + com.ibm.ws.adaptable.module;version=latest,\ + com.ibm.ws.classloading;version=latest,\ + com.ibm.ws.container.service;version=latest,\ + com.ibm.ws.container.service.compat;version=latest,\ + com.ibm.ws.logging.core,\ + com.ibm.ws.threading,\ + io.openliberty.org.jboss.logging35,\ + com.ibm.ws.org.osgi.annotation.versioning;version=latest,\ + com.ibm.wsspi.org.osgi.service.component.annotations;version=latest,\ + com.ibm.websphere.org.osgi.core;version=latest,\ + com.ibm.ws.kernel.service,\ + io.openliberty.webcontainer.security.internal,\ + com.ibm.websphere.security,\ + com.ibm.ws.org.jboss.jandex,\ + org.eclipse.osgi -testpath: \ ../build.sharedResources/lib/junit/old/junit.jar;version=file,\ diff --git a/dev/io.openliberty.org.jboss.resteasy.common.ee11/src/org/jboss/resteasy/core/ContextParameterInjector.java b/dev/io.openliberty.org.jboss.resteasy.common.ee11/src/org/jboss/resteasy/core/ContextParameterInjector.java index ccf36a42bc2..d64a01d0ec0 100644 --- a/dev/io.openliberty.org.jboss.resteasy.common.ee11/src/org/jboss/resteasy/core/ContextParameterInjector.java +++ b/dev/io.openliberty.org.jboss.resteasy.common.ee11/src/org/jboss/resteasy/core/ContextParameterInjector.java @@ -34,12 +34,13 @@ import java.util.Set; import java.util.concurrent.CompletionStage; +import org.eclipse.osgi.internal.loader.EquinoxClassLoader; + import jakarta.ws.rs.container.ResourceInfo; import jakarta.ws.rs.core.Application; import jakarta.ws.rs.ext.Providers; import jakarta.ws.rs.sse.Sse; import jakarta.ws.rs.sse.SseEventSink; - import org.jboss.resteasy.plugins.providers.sse.SseImpl; import org.jboss.resteasy.plugins.server.servlet.ResteasyContextParameters; import org.jboss.resteasy.resteasy_jaxrs.i18n.Messages; @@ -202,12 +203,20 @@ protected Object createProxy() { throw new RuntimeException(e); } } else { + // Liberty change start + Class[] intfs; Object delegate = factory.getContextData(rawType, genericType, annotations, false); - Class[] intfs = computeInterfaces(delegate, rawType); + if (delegate != null && + ((rawType.getName().startsWith("org.jboss.resteasy")) || + (!(delegate.getClass().getClassLoader() instanceof EquinoxClassLoader)))) { + intfs = computeInterfaces(delegate, rawType); + } else { + intfs = computeInterfaces(null, rawType); + } + // Liberty change end ClassLoader clazzLoader = null; final SecurityManager sm = System.getSecurityManager(); if (sm == null) { - // liberty change - use this classloader clazzLoader = delegate == null ? rawType.getClassLoader() : delegate.getClass().getClassLoader(); // The class loader may be null for primitives, void or the type was loaded from the bootstrap class loader. // In such cases we should use the TCCL. @@ -215,7 +224,7 @@ protected Object createProxy() { clazzLoader = Thread.currentThread().getContextClassLoader(); } if (clazzLoader == null) { - clazzLoader = this.getClass().getClassLoader(); + clazzLoader = this.getClass().getClassLoader(); //liberty change } } else { clazzLoader = AccessController.doPrivileged(new PrivilegedAction() { @@ -228,8 +237,9 @@ public ClassLoader run() { result = Thread.currentThread().getContextClassLoader(); } if (result == null) { - result = this.getClass().getClassLoader(); //liberty change + result = this.getClass().getClassLoader(); //liberty change } + return result; } }); diff --git a/dev/io.openliberty.org.jboss.resteasy.common/bnd.bnd b/dev/io.openliberty.org.jboss.resteasy.common/bnd.bnd index d6f2f980883..8091f931078 100644 --- a/dev/io.openliberty.org.jboss.resteasy.common/bnd.bnd +++ b/dev/io.openliberty.org.jboss.resteasy.common/bnd.bnd @@ -233,7 +233,8 @@ Include-Resource:\ com.ibm.wsspi.org.osgi.service.component.annotations;version=latest,\ javax.activation:activation;version=1.1,\ com.ibm.websphere.appserver.api.basics,\ - com.ibm.ws.kernel.service + com.ibm.ws.kernel.service,\ + org.eclipse.osgi -testpath: \ ../build.sharedResources/lib/junit/old/junit.jar;version=file,\ diff --git a/dev/io.openliberty.org.jboss.resteasy.common/src/org/jboss/resteasy/core/ContextParameterInjector.java b/dev/io.openliberty.org.jboss.resteasy.common/src/org/jboss/resteasy/core/ContextParameterInjector.java index 6e43e7a2077..478240b47d0 100644 --- a/dev/io.openliberty.org.jboss.resteasy.common/src/org/jboss/resteasy/core/ContextParameterInjector.java +++ b/dev/io.openliberty.org.jboss.resteasy.common/src/org/jboss/resteasy/core/ContextParameterInjector.java @@ -11,6 +11,7 @@ import org.jboss.resteasy.spi.ValueInjector; import org.jboss.resteasy.spi.util.Types; +import org.eclipse.osgi.internal.loader.EquinoxClassLoader; import javax.ws.rs.container.ResourceInfo; import javax.ws.rs.core.Application; import javax.ws.rs.ext.Providers; @@ -216,15 +217,21 @@ protected Object createProxy() { throw new RuntimeException(e); } - } - else - { + } else { + // Liberty change start + Class[] intfs; Object delegate = factory.getContextData(rawType, genericType, annotations, false); - Class[] intfs = computeInterfaces(delegate, rawType); + if (delegate != null && + ((rawType.getName().startsWith("org.jboss.resteasy")) || + (!(delegate.getClass().getClassLoader() instanceof EquinoxClassLoader)))) { + intfs = computeInterfaces(delegate, rawType); + } else { + intfs = computeInterfaces(null, rawType); + } + // Liberty change end ClassLoader clazzLoader = null; final SecurityManager sm = System.getSecurityManager(); if (sm == null) { - // liberty change - use this classloader clazzLoader = delegate == null ? rawType.getClassLoader() : delegate.getClass().getClassLoader(); // The class loader may be null for primitives, void or the type was loaded from the bootstrap class loader. // In such cases we should use the TCCL. @@ -232,7 +239,7 @@ protected Object createProxy() clazzLoader = Thread.currentThread().getContextClassLoader(); } if (clazzLoader == null) { - clazzLoader = this.getClass().getClassLoader(); + clazzLoader = this.getClass().getClassLoader(); //liberty change } } else { clazzLoader = AccessController.doPrivileged(new PrivilegedAction() {