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 2023/09/04 11:31:08 UTC
[tomee] branch main updated: TOMEE-4139 - CXF 4.0.3-SNAPSHOT
This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomee.git
The following commit(s) were added to refs/heads/main by this push:
new 469a89dd93 TOMEE-4139 - CXF 4.0.3-SNAPSHOT
469a89dd93 is described below
commit 469a89dd93601b0605bf01594082e93e82b269e3
Author: Richard Zowalla <rz...@apache.org>
AuthorDate: Wed Aug 16 08:42:48 2023 +0200
TOMEE-4139 - CXF 4.0.3-SNAPSHOT
---
.../arquillian-tomee-jms-tests/pom.xml | 34 -
boms/tomee-microprofile/pom.xml | 261 +++-
boms/tomee-plume/pom.xml | 261 +++-
boms/tomee-plus/pom.xml | 261 +++-
boms/tomee-webprofile/pom.xml | 332 +++-
deps/cxf-rt-rs-mp-client-shade/pom.xml | 213 ---
deps/cxf-shade/pom.xml | 396 -----
.../cxf/attachment/AttachmentDataSource.java | 107 --
.../java/org/apache/cxf/endpoint/ServerImpl.java | 221 ---
.../cxf/jaxrs/provider/AbstractJAXBProvider.java | 988 ------------
.../jaxrs/provider/GenericArgumentComparator.java | 206 ---
.../apache/cxf/jaxrs/provider/ProviderFactory.java | 1639 --------------------
.../org/apache/cxf/jaxrs/utils/GenericsUtils.java | 224 ---
.../org/apache/cxf/jaxrs/utils/InjectionUtils.java | 1589 -------------------
.../java/org/apache/cxf/message/MessageUtils.java | 302 ----
.../security/wss4j/AbstractWSS4JInterceptor.java | 228 ---
.../cxf/workqueue/AutomaticWorkQueueImpl.java | 619 --------
deps/pom.xml | 2 -
examples/async-servlet/pom.xml | 2 +-
examples/bval-evaluation-redeployment/pom.xml | 2 +
.../connector-sample-functional-tests/pom.xml | 2 -
examples/jsonb-custom-serializer/pom.xml | 2 +-
examples/mp-opentracing-traced/pom.xml | 2 +-
examples/serverless-builder/pom.xml | 2 +-
examples/serverless-tomee-plume/pom.xml | 2 +-
pom.xml | 146 +-
server/openejb-cxf-rs/pom.xml | 61 +-
.../apache/openejb/server/cxf/rs/CxfRSService.java | 4 +-
server/openejb-cxf-transport/pom.xml | 31 +-
server/openejb-cxf/pom.xml | 33 +-
tck/microprofile-tck/jwt/pom.xml | 35 +-
tck/microprofile-tck/openapi/pom.xml | 24 -
tck/microprofile-tck/opentracing/pom.xml | 6 +-
tck/microprofile-tck/rest-client/pom.xml | 66 +-
tck/microprofile-tck/rest-client/tck-dev.xml | 2 +-
.../{tck-dev.xml => tck-suite-jsonb-solo.xml} | 6 +-
tck/microprofile-tck/rest-client/tck-suite.xml | 4 +-
tomee/tomee-microprofile/mp-common/pom.xml | 39 +-
.../tomee-microprofile-webapp/pom.xml | 14 -
.../src/main/assembly/war.xml | 1 -
tomee/tomee-plume-webapp/pom.xml | 14 -
tomee/tomee-plume-webapp/src/main/assembly/war.xml | 1 -
tomee/tomee-plus-webapp/pom.xml | 14 -
tomee/tomee-plus-webapp/src/main/assembly/war.xml | 1 -
tomee/tomee-webapp/pom.xml | 8 -
tomee/tomee-webapp/src/main/assembly/war.xml | 2 -
46 files changed, 1320 insertions(+), 7089 deletions(-)
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/pom.xml b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/pom.xml
index 42fe056d4d..3c34d00e58 100644
--- a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/pom.xml
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/pom.xml
@@ -39,38 +39,4 @@
<skip.webapp.webprofile>true</skip.webapp.webprofile>
</properties>
- <dependencies>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>cxf-shade</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.glassfish.jaxb</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jakarta.annotation</groupId>
- <artifactId>jakarta.annotation-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jakarta.ws.rs</groupId>
- <artifactId>jakarta.ws.rs-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jakarta.ws.rs</groupId>
- <artifactId>jakarta.ws.rs-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jakarta.activation</groupId>
- <artifactId>jakarta.activation-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
</project>
diff --git a/boms/tomee-microprofile/pom.xml b/boms/tomee-microprofile/pom.xml
index d8871721a5..b83d709651 100644
--- a/boms/tomee-microprofile/pom.xml
+++ b/boms/tomee-microprofile/pom.xml
@@ -552,6 +552,226 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-core</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-bindings-soap</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-bindings-xml</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-databinding-jaxb</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-simple</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-management</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-client</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-extension-providers</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-mp-client</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-service-description</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-sse</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-security-saml</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-security</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-addr</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-policy</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-security</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-wsdl</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>org.apache.geronimo.components</groupId>
<artifactId>geronimo-connector</artifactId>
@@ -1052,28 +1272,6 @@
</exclusion>
</exclusions>
</dependency>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>cxf-rt-rs-mp-client-shade</artifactId>
- <version>10.0.0-SNAPSHOT</version>
- <exclusions>
- <exclusion>
- <artifactId>*</artifactId>
- <groupId>*</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>cxf-shade</artifactId>
- <version>10.0.0-SNAPSHOT</version>
- <exclusions>
- <exclusion>
- <artifactId>*</artifactId>
- <groupId>*</groupId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
<groupId>org.apache.tomee</groupId>
<artifactId>jakartaee-api</artifactId>
@@ -1473,7 +1671,7 @@
<dependency>
<groupId>org.apache.ws.xmlschema</groupId>
<artifactId>xmlschema-core</artifactId>
- <version>2.2.5</version>
+ <version>2.3.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -1902,7 +2100,7 @@
<dependency>
<groupId>org.jvnet.staxex</groupId>
<artifactId>stax-ex</artifactId>
- <version>1.8.3</version>
+ <version>2.0.1</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -2067,7 +2265,7 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
- <version>9.3</version>
+ <version>9.5</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -2078,7 +2276,7 @@
<dependency>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
- <version>1.0.3</version>
+ <version>1.0.4</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -2130,6 +2328,17 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>xml-resolver</groupId>
+ <artifactId>xml-resolver</artifactId>
+ <version>1.2</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
</project>
diff --git a/boms/tomee-plume/pom.xml b/boms/tomee-plume/pom.xml
index 1269bef1b6..b055d046ab 100644
--- a/boms/tomee-plume/pom.xml
+++ b/boms/tomee-plume/pom.xml
@@ -652,6 +652,226 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-core</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-bindings-soap</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-bindings-xml</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-databinding-jaxb</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-simple</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-management</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-client</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-extension-providers</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-mp-client</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-service-description</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-sse</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-security-saml</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-security</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-addr</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-policy</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-security</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-wsdl</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>org.apache.geronimo.components</groupId>
<artifactId>geronimo-connector</artifactId>
@@ -1174,28 +1394,6 @@
</exclusion>
</exclusions>
</dependency>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>cxf-rt-rs-mp-client-shade</artifactId>
- <version>10.0.0-SNAPSHOT</version>
- <exclusions>
- <exclusion>
- <artifactId>*</artifactId>
- <groupId>*</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>cxf-shade</artifactId>
- <version>10.0.0-SNAPSHOT</version>
- <exclusions>
- <exclusion>
- <artifactId>*</artifactId>
- <groupId>*</groupId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
<groupId>org.apache.tomee</groupId>
<artifactId>jakartaee-api</artifactId>
@@ -1595,7 +1793,7 @@
<dependency>
<groupId>org.apache.ws.xmlschema</groupId>
<artifactId>xmlschema-core</artifactId>
- <version>2.2.5</version>
+ <version>2.3.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -2057,7 +2255,7 @@
<dependency>
<groupId>org.jvnet.staxex</groupId>
<artifactId>stax-ex</artifactId>
- <version>1.8.3</version>
+ <version>2.0.1</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -2222,7 +2420,7 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
- <version>9.3</version>
+ <version>9.5</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -2233,7 +2431,7 @@
<dependency>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
- <version>1.0.3</version>
+ <version>1.0.4</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -2285,6 +2483,17 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>xml-resolver</groupId>
+ <artifactId>xml-resolver</artifactId>
+ <version>1.2</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
</project>
diff --git a/boms/tomee-plus/pom.xml b/boms/tomee-plus/pom.xml
index 322f3250c8..a8015d02db 100644
--- a/boms/tomee-plus/pom.xml
+++ b/boms/tomee-plus/pom.xml
@@ -663,6 +663,226 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-core</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-bindings-soap</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-bindings-xml</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-databinding-jaxb</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-simple</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-management</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-client</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-extension-providers</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-mp-client</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-service-description</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-sse</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-security-saml</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-security</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-addr</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-policy</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-security</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-wsdl</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>org.apache.geronimo.components</groupId>
<artifactId>geronimo-connector</artifactId>
@@ -1207,28 +1427,6 @@
</exclusion>
</exclusions>
</dependency>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>cxf-rt-rs-mp-client-shade</artifactId>
- <version>10.0.0-SNAPSHOT</version>
- <exclusions>
- <exclusion>
- <artifactId>*</artifactId>
- <groupId>*</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>cxf-shade</artifactId>
- <version>10.0.0-SNAPSHOT</version>
- <exclusions>
- <exclusion>
- <artifactId>*</artifactId>
- <groupId>*</groupId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
<groupId>org.apache.tomee</groupId>
<artifactId>jakartaee-api</artifactId>
@@ -1628,7 +1826,7 @@
<dependency>
<groupId>org.apache.ws.xmlschema</groupId>
<artifactId>xmlschema-core</artifactId>
- <version>2.2.5</version>
+ <version>2.3.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -2068,7 +2266,7 @@
<dependency>
<groupId>org.jvnet.staxex</groupId>
<artifactId>stax-ex</artifactId>
- <version>1.8.3</version>
+ <version>2.0.1</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -2233,7 +2431,7 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
- <version>9.3</version>
+ <version>9.5</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -2244,7 +2442,7 @@
<dependency>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
- <version>1.0.3</version>
+ <version>1.0.4</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -2296,6 +2494,17 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>xml-resolver</groupId>
+ <artifactId>xml-resolver</artifactId>
+ <version>1.2</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
</project>
diff --git a/boms/tomee-webprofile/pom.xml b/boms/tomee-webprofile/pom.xml
index 0c4c81aa8b..363f32a563 100644
--- a/boms/tomee-webprofile/pom.xml
+++ b/boms/tomee-webprofile/pom.xml
@@ -211,6 +211,215 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-core</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-bindings-soap</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-bindings-xml</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-databinding-jaxb</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-simple</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-management</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-client</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-extension-providers</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-service-description</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-sse</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-security-saml</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-security</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-addr</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-policy</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-security</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-wsdl</artifactId>
+ <version>4.0.3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>org.apache.geronimo.components</groupId>
<artifactId>geronimo-connector</artifactId>
@@ -711,17 +920,6 @@
</exclusion>
</exclusions>
</dependency>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>cxf-shade</artifactId>
- <version>10.0.0-SNAPSHOT</version>
- <exclusions>
- <exclusion>
- <artifactId>*</artifactId>
- <groupId>*</groupId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
<groupId>org.apache.tomee</groupId>
<artifactId>jakartaee-api</artifactId>
@@ -1088,7 +1286,73 @@
<dependency>
<groupId>org.apache.ws.xmlschema</groupId>
<artifactId>xmlschema-core</artifactId>
- <version>2.2.5</version>
+ <version>2.3.0</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wss4j</groupId>
+ <artifactId>wss4j-bindings</artifactId>
+ <version>3.0.0</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wss4j</groupId>
+ <artifactId>wss4j-policy</artifactId>
+ <version>3.0.0</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wss4j</groupId>
+ <artifactId>wss4j-ws-security-common</artifactId>
+ <version>3.0.0</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wss4j</groupId>
+ <artifactId>wss4j-ws-security-dom</artifactId>
+ <version>3.0.0</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wss4j</groupId>
+ <artifactId>wss4j-ws-security-policy-stax</artifactId>
+ <version>3.0.0</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wss4j</groupId>
+ <artifactId>wss4j-ws-security-stax</artifactId>
+ <version>3.0.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -1250,6 +1514,17 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.cryptacular</groupId>
+ <artifactId>cryptacular</artifactId>
+ <version>1.2.5</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>ecj</artifactId>
@@ -1305,6 +1580,17 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.jasypt</groupId>
+ <artifactId>jasypt</artifactId>
+ <version>1.9.3</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>org.jvnet.staxex</groupId>
<artifactId>stax-ex</artifactId>
@@ -1327,6 +1613,17 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm</artifactId>
+ <version>9.5</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@@ -1360,6 +1657,17 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>xml-resolver</groupId>
+ <artifactId>xml-resolver</artifactId>
+ <version>1.2</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
</project>
diff --git a/deps/cxf-rt-rs-mp-client-shade/pom.xml b/deps/cxf-rt-rs-mp-client-shade/pom.xml
deleted file mode 100644
index 0192839595..0000000000
--- a/deps/cxf-rt-rs-mp-client-shade/pom.xml
+++ /dev/null
@@ -1,213 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
--->
-<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">
- <parent>
- <artifactId>deps</artifactId>
- <groupId>org.apache.tomee</groupId>
- <version>10.0.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>cxf-rt-rs-mp-client-shade</artifactId>
- <name>TomEE :: Deps :: CXF Rest Client Shade</name>
-
- <!--
- This is to make sure ApplicationComposer, EJBContainer, Arquillian can work.
- Patching the final zip does not allow for all those use case
-
- Ideally, we should split this project for each patched library so we can have
- fine grained includes in TomEE modules.
- -->
-
- <dependencies>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-mp-client</artifactId>
- <version>${version.cxf}</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.microprofile.rest.client</groupId>
- <artifactId>microprofile-rest-client-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jakarta.json</groupId>
- <artifactId>jakarta.json-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>cxf-shade</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.eclipse.microprofile.rest.client</groupId>
- <artifactId>microprofile-rest-client-api</artifactId>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>3.2.4</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <createSourcesJar>true</createSourcesJar>
- <useBaseVersion>true</useBaseVersion>
- <createDependencyReducedPom>false</createDependencyReducedPom>
- <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
- <artifactSet>
- <includes>
- <include>org.apache.cxf:cxf-rt-rs-mp-client</include> <!-- only CXF to make sure we don't add other things -->
- </includes>
- </artifactSet>
- <transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
- <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
- <resource>META-INF/spring.handlers</resource>
- </transformer>
- <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
- <resource>META-INF/spring.schemas</resource>
- </transformer>
- <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
- <resource>META-INF/blueprint.schemas</resource>
- </transformer>
- <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
- <resource>META-INF/cxf/bus-extensions.txt</resource>
- </transformer>
- </transformers>
- <relocations>
- <relocation>
- <pattern>javax.activation</pattern>
- <shadedPattern>jakarta.activation</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.annotation</pattern>
- <shadedPattern>jakarta.annotation</shadedPattern>
- <excludes>
- <exclude>javax.annotation.processing.**</exclude>
- </excludes>
- </relocation>
- <relocation>
- <pattern>javax.ejb</pattern>
- <shadedPattern>jakarta.ejb</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.enterprise</pattern>
- <shadedPattern>jakarta.enterprise</shadedPattern>
- <excludes>
- <exclude>javax.enterprise.deploy.**</exclude>
- </excludes>
- </relocation>
- <relocation>
- <pattern>javax.inject</pattern>
- <shadedPattern>jakarta.inject</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.interceptor</pattern>
- <shadedPattern>jakarta.interceptor</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.jms</pattern>
- <shadedPattern>jakarta.jms</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.json</pattern>
- <shadedPattern>jakarta.json</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.jws</pattern>
- <shadedPattern>jakarta.jws</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.mail</pattern>
- <shadedPattern>jakarta.mail</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.persistence</pattern>
- <shadedPattern>jakarta.persistence</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.resource</pattern>
- <shadedPattern>jakarta.resource</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.servlet</pattern>
- <shadedPattern>jakarta.servlet</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.transaction</pattern>
- <shadedPattern>jakarta.transaction</shadedPattern>
- <excludes>
- <exclude>javax.transaction.xa.**</exclude>
- </excludes>
- </relocation>
- <relocation>
- <pattern>javax.validation</pattern>
- <shadedPattern>jakarta.validation</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.ws.rs</pattern>
- <shadedPattern>jakarta.ws.rs</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.xml.bind</pattern>
- <shadedPattern>jakarta.xml.bind</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.xml.soap</pattern>
- <shadedPattern>jakarta.xml.soap</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.xml.ws</pattern>
- <shadedPattern>jakarta.xml.ws</shadedPattern>
- </relocation>
- <relocation>
- <pattern>com.sun.xml.bind</pattern>
- <shadedPattern>org.glassfish.jaxb</shadedPattern>
- <rawString>true</rawString>
- </relocation>
- <relocation>
- <pattern>com.sun.xml.internal.bind</pattern>
- <shadedPattern>org.glassfish.jaxb</shadedPattern>
- <rawString>true</rawString>
- </relocation>
- </relocations>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- </plugins>
- </build>
-</project>
diff --git a/deps/cxf-shade/pom.xml b/deps/cxf-shade/pom.xml
deleted file mode 100644
index f5f2a95015..0000000000
--- a/deps/cxf-shade/pom.xml
+++ /dev/null
@@ -1,396 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
--->
-<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">
- <parent>
- <artifactId>deps</artifactId>
- <groupId>org.apache.tomee</groupId>
- <version>10.0.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>cxf-shade</artifactId>
- <name>TomEE :: Deps :: CXF Shade</name>
-
- <!--
- This is to make sure ApplicationComposer, EJBContainer, Arquillian can work.
- Patching the final zip does not allow for all those use case
-
- Ideally, we should split this project for each patched library so we can have
- fine grained includes in TomEE modules.
- -->
-
- <dependencies>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-core</artifactId>
- <version>${version.cxf}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-databinding-jaxb</artifactId>
- <version>${version.cxf}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-frontend-jaxrs</artifactId>
- <version>${version.cxf}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-frontend-jaxws</artifactId>
- <version>${version.cxf}</version>
- <exclusions>
- <exclusion>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm</artifactId>
- </exclusion>
- </exclusions>
- <!--
- <exclusions>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-ws-addr</artifactId>
- </exclusion>
- </exclusions>
- -->
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-management</artifactId>
- <version>${version.cxf}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-client</artifactId>
- <version>${version.cxf}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-extension-providers</artifactId>
- <version>${version.cxf}</version>
- </dependency>
- <!--
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-extension-search</artifactId>
- <version>${version.cxf}</version>
- </dependency>
- -->
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-security-cors</artifactId>
- <version>${version.cxf}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-security-oauth2</artifactId>
- <version>${version.cxf}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-service-description</artifactId>
- <version>${version.cxf}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-sse</artifactId>
- <version>${version.cxf}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-transports-http</artifactId>
- <version>${version.cxf}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-ws-security</artifactId>
- <version>${version.cxf}</version>
- <exclusions>
- <!-- Exclude some weird transient dependency to jaxb-runtime from ehcache -->
- <exclusion>
- <groupId>org.glassfish.jaxb</groupId>
- <artifactId>jaxb-runtime</artifactId>
- </exclusion>
-
- <!-- we need this so it compiles the patch for the interceptor -->
- <exclusion>
- <groupId>org.apache.wss4j</groupId>
- <artifactId>wss4j-ws-security-dom</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-wsdl</artifactId>
- <version>${version.cxf}</version>
- </dependency>
-
- <!-- add transitive dependencies so including this is equivalent to including regular deps -->
- <dependency>
- <groupId>org.apache.ws.xmlschema</groupId>
- <artifactId>xmlschema-core</artifactId>
- <version>2.2.5</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.woodstox</groupId>
- <artifactId>woodstox-core</artifactId>
- <version>6.4.0</version>
- </dependency>
- <dependency>
- <groupId>wsdl4j</groupId>
- <artifactId>wsdl4j</artifactId>
- <version>1.6.3</version>
- </dependency>
- <dependency>
- <groupId>org.reactivestreams</groupId>
- <artifactId>reactive-streams</artifactId>
- <version>1.0.3</version>
- </dependency>
- <dependency>
- <groupId>org.apache.neethi</groupId>
- <artifactId>neethi</artifactId>
- <version>3.0.3</version>
- </dependency>
-
- <!-- is this required -->
- <dependency>
- <groupId>com.sun.xml.messaging.saaj</groupId>
- <artifactId>saaj-impl</artifactId>
- <version>1.5.3</version>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>3.1.2</version>
- <executions>
- <execution>
- <id>copy-dependencies-for-classpath</id>
- <phase>package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}/patch-classpath</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>false</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- </configuration>
- </execution>
- <execution>
- <id>copy-dependencies-for-patching</id>
- <phase>package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>false</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- <excludeTransitive>true</excludeTransitive> <!-- we just want to patch and shade CXF -->
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>3.2.4</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <createSourcesJar>true</createSourcesJar>
- <useBaseVersion>true</useBaseVersion>
- <createDependencyReducedPom>false</createDependencyReducedPom>
- <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
- <artifactSet>
- <includes>
- <include>org.apache.cxf:*</include> <!-- only CXF to make sure we don't add other things -->
- </includes>
- </artifactSet>
- <transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
- <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
- <resource>META-INF/spring.handlers</resource>
- </transformer>
- <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
- <resource>META-INF/spring.schemas</resource>
- </transformer>
- <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
- <resource>META-INF/blueprint.schemas</resource>
- </transformer>
- <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
- <resource>META-INF/cxf/bus-extensions.txt</resource>
- </transformer>
- </transformers>
- <relocations>
- <relocation>
- <pattern>javax.activation</pattern>
- <shadedPattern>jakarta.activation</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.annotation</pattern>
- <shadedPattern>jakarta.annotation</shadedPattern>
- <excludes>
- <exclude>javax.annotation.processing.**</exclude>
- </excludes>
- </relocation>
- <relocation>
- <pattern>javax.ejb</pattern>
- <shadedPattern>jakarta.ejb</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.enterprise</pattern>
- <shadedPattern>jakarta.enterprise</shadedPattern>
- <excludes>
- <exclude>javax.enterprise.deploy.**</exclude>
- </excludes>
- </relocation>
- <relocation>
- <pattern>javax.inject</pattern>
- <shadedPattern>jakarta.inject</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.interceptor</pattern>
- <shadedPattern>jakarta.interceptor</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.jms</pattern>
- <shadedPattern>jakarta.jms</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.json</pattern>
- <shadedPattern>jakarta.json</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.jws</pattern>
- <shadedPattern>jakarta.jws</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.mail</pattern>
- <shadedPattern>jakarta.mail</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.persistence</pattern>
- <shadedPattern>jakarta.persistence</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.resource</pattern>
- <shadedPattern>jakarta.resource</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.servlet</pattern>
- <shadedPattern>jakarta.servlet</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.transaction</pattern>
- <shadedPattern>jakarta.transaction</shadedPattern>
- <excludes>
- <exclude>javax.transaction.xa.**</exclude>
- </excludes>
- </relocation>
- <relocation>
- <pattern>javax.validation</pattern>
- <shadedPattern>jakarta.validation</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.ws.rs</pattern>
- <shadedPattern>jakarta.ws.rs</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.xml.bind</pattern>
- <shadedPattern>jakarta.xml.bind</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.xml.soap</pattern>
- <shadedPattern>jakarta.xml.soap</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javax.xml.ws</pattern>
- <shadedPattern>jakarta.xml.ws</shadedPattern>
- </relocation>
- <relocation>
- <pattern>com.sun.xml.bind</pattern>
- <shadedPattern>org.glassfish.jaxb</shadedPattern>
- <rawString>true</rawString>
- </relocation>
- <relocation>
- <pattern>com.sun.xml.internal.bind</pattern>
- <shadedPattern>org.glassfish.jaxb</shadedPattern>
- <rawString>true</rawString>
- </relocation>
- </relocations>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.tomee.patch</groupId>
- <artifactId>tomee-patch-plugin</artifactId>
- <configuration>
- <select>cxf-shade-.*\.jar</select>
- <transformSources>false</transformSources>
- <source>1.8</source>
- <target>1.8</target>
- <dependencies>
- <dependency>${project.groupId}:jakartaee-api:jar:9.1.1</dependency>
-
- <dependency>org.apache.aries.blueprint:blueprint-parser:jar:1.6.0</dependency>
- <dependency>org.apache.aries.blueprint:org.apache.aries.blueprint.api:jar:1.0.1</dependency>
- <dependency>org.apache.aries.blueprint:org.apache.aries.blueprint.core:jar:1.10.2</dependency>
- <dependency>org.apache.tomcat:tomcat-servlet-api:jar:10.0.4</dependency>
- <dependency>org.osgi:org.osgi.core:jar:6.0.0</dependency>
- <dependency>org.osgi:osgi.cmpn:jar:6.0.0</dependency>
- <dependency>org.ow2.asm:asm:jar:9.1</dependency>
- <dependency>org.springframework:spring-aop:jar:5.3.6</dependency>
- <dependency>org.springframework:spring-beans:jar:5.3.6</dependency>
- <dependency>org.springframework:spring-context:jar:5.3.6</dependency>
- <dependency>org.springframework:spring-core:jar:5.3.6</dependency>
- <dependency>org.springframework:spring-webmvc:jar:5.3.6</dependency>
-
- <!-- We patch the interceptor so it's compliant with WSS4J 3.0.0 which is picked up in openejb-cxf -->
- <!-- adding here because we don't want to shade it in cxf-shade jar -->
- <dependency>org.apache.wss4j:wss4j-ws-security-dom:jar:3.0.0</dependency>
- </dependencies>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>run</goal>
- </goals>
- <phase>package</phase>
- </execution>
- </executions>
- </plugin>
-
- </plugins>
- </build>
-</project>
diff --git a/deps/cxf-shade/src/patch/java/org/apache/cxf/attachment/AttachmentDataSource.java b/deps/cxf-shade/src/patch/java/org/apache/cxf/attachment/AttachmentDataSource.java
deleted file mode 100644
index d443832732..0000000000
--- a/deps/cxf-shade/src/patch/java/org/apache/cxf/attachment/AttachmentDataSource.java
+++ /dev/null
@@ -1,107 +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.cxf.attachment;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import jakarta.activation.DataSource;
-
-import org.apache.cxf.helpers.IOUtils;
-import org.apache.cxf.io.CacheSizeExceededException;
-import org.apache.cxf.io.CachedOutputStream;
-import org.apache.cxf.message.Message;
-
-public class AttachmentDataSource implements DataSource {
-
- private final String ct;
- private CachedOutputStream cache;
- private InputStream ins;
- private DelegatingInputStream delegate;
- private String name;
-
- public AttachmentDataSource(String ctParam, InputStream inParam) {
- this.ct = ctParam;
- ins = inParam;
- }
-
- public boolean isCached() {
- return cache != null;
- }
- public void cache(Message message) throws IOException {
- if (cache == null) {
- cache = new CachedOutputStream();
- AttachmentUtil.setStreamedAttachmentProperties(message, cache);
- try {
- IOUtils.copyAndCloseInput(ins, cache);
- cache.lockOutputStream();
- if (delegate != null) {
- delegate.setInputStream(cache.getInputStream());
- }
- } catch (CacheSizeExceededException | IOException cee) {
- cache.close();
- cache = null;
- throw cee;
- } finally {
- ins = null;
- }
- }
- }
- public void hold(Message message) throws IOException {
- cache(message);
- cache.holdTempFile();
- }
- public void release() {
- if (cache != null) {
- cache.releaseTempFileHold();
- }
- }
-
- public String getContentType() {
- return ct;
- }
-
- public InputStream getInputStream() {
- try {
- if (cache != null) {
- return cache.getInputStream();
- }
- if (delegate == null) {
- delegate = new DelegatingInputStream(ins);
- }
- return delegate;
- } catch (IOException e) {
- return null;
- }
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public OutputStream getOutputStream() throws IOException {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/deps/cxf-shade/src/patch/java/org/apache/cxf/endpoint/ServerImpl.java b/deps/cxf-shade/src/patch/java/org/apache/cxf/endpoint/ServerImpl.java
deleted file mode 100644
index c417cb6fe6..0000000000
--- a/deps/cxf-shade/src/patch/java/org/apache/cxf/endpoint/ServerImpl.java
+++ /dev/null
@@ -1,221 +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.cxf.endpoint;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.management.JMException;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.BusException;
-import org.apache.cxf.binding.BindingFactory;
-import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.common.logging.RegexLoggingFilter;
-import org.apache.cxf.management.InstrumentationManager;
-import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.transport.Destination;
-import org.apache.cxf.transport.DestinationFactory;
-import org.apache.cxf.transport.DestinationFactoryManager;
-import org.apache.cxf.transport.MessageObserver;
-import org.apache.cxf.transport.MultipleEndpointObserver;
-
-public class ServerImpl implements Server {
- private static final Logger LOG = LogUtils.getL7dLogger(ServerImpl.class);
-
- protected final Endpoint endpoint;
- protected final Bus bus;
- protected final BindingFactory bindingFactory;
-
- private Destination destination;
- private ServerRegistry serverRegistry;
- private ServerLifeCycleManager slcMgr;
- private InstrumentationManager iMgr;
- private ManagedEndpoint mep;
- private boolean stopped = true;
- private boolean destroyDest = true;
-
- public ServerImpl(Bus bus,
- Endpoint endpoint,
- DestinationFactory destinationFactory,
- BindingFactory bindingFactory) throws BusException, IOException {
- this.endpoint = endpoint;
- this.bus = bus;
- this.bindingFactory = bindingFactory;
-
- initDestination(destinationFactory);
- }
-
- private void initDestination(DestinationFactory destinationFactory) throws BusException, IOException {
- EndpointInfo ei = endpoint.getEndpointInfo();
-
- //Treat local transport as a special case, transports loaded by transportId can be replaced
- //by local transport when the publishing address is a local transport protocol.
- //Of course its not an ideal situation here to use a hard-coded prefix. To be refactored.
- if (destinationFactory == null) {
- if (ei.getAddress() != null && ei.getAddress().indexOf("local://") != -1) {
- destinationFactory = bus.getExtension(DestinationFactoryManager.class)
- .getDestinationFactoryForUri(ei.getAddress());
- }
-
- if (destinationFactory == null) {
- destinationFactory = bus.getExtension(DestinationFactoryManager.class)
- .getDestinationFactory(ei.getTransportId());
- }
- }
-
- destination = destinationFactory.getDestination(ei, bus);
- String wantFilter = ei.getAddress();
-
- if (wantFilter != null && wantFilter.startsWith("jms")) {
- RegexLoggingFilter filter = new RegexLoggingFilter();
- filter.setPattern("jms(.*?)password=+([^ ]+)");
- filter.setGroup(2);
- wantFilter = filter.filter(wantFilter).toString();
- }
- LOG.info("Setting the server's publish address to be " + wantFilter);
- serverRegistry = bus.getExtension(ServerRegistry.class);
-
- mep = new ManagedEndpoint(bus, endpoint, this);
-
- slcMgr = bus.getExtension(ServerLifeCycleManager.class);
- if (slcMgr != null) {
- slcMgr.registerListener(mep);
- }
-
- iMgr = bus.getExtension(InstrumentationManager.class);
- if (iMgr != null) {
- try {
- iMgr.register(mep);
- } catch (JMException jmex) {
- LOG.log(Level.WARNING, "Registering ManagedEndpoint failed.", jmex);
- }
- }
- }
-
- public Destination getDestination() {
- return destination;
- }
-
- public void setDestination(Destination destination) {
- this.destination = destination;
- }
-
- public void start() {
- if (!stopped) {
- return;
- }
- LOG.fine("Server is starting.");
-
- try {
- bindingFactory.addListener(destination, endpoint);
- } catch (RuntimeException e) {
- if (e.getMessage().contains("endpoint already registered on address")) {
- //this destination is used by another endpoint with same endpoint address
- //so shouldn't be destroyed by this server
- this.destroyDest = false;
- }
- throw e;
- }
-
- // register the active server to run
- if (null != serverRegistry) {
- LOG.fine("register the server to serverRegistry ");
- serverRegistry.register(this);
- }
- if (slcMgr == null) {
- slcMgr = bus.getExtension(ServerLifeCycleManager.class);
- if (slcMgr != null && mep != null) {
- slcMgr.registerListener(mep);
- }
- }
- if (slcMgr != null) {
- slcMgr.startServer(this);
- }
- stopped = false;
- }
-
- public boolean isStopped() {
- return stopped;
- }
- public boolean isStarted() {
- return !stopped;
- }
-
- public void stop() {
- if (stopped) {
- return;
- }
-
- LOG.fine("Server is stopping.");
-
- for (Closeable c : endpoint.getCleanupHooks()) {
- try {
- c.close();
- } catch (IOException e) {
- //ignore
- }
- }
- if (slcMgr != null) {
- slcMgr.stopServer(this);
- }
-
- MessageObserver mo = getDestination().getMessageObserver();
- if (mo instanceof MultipleEndpointObserver) {
- ((MultipleEndpointObserver)mo).getEndpoints().remove(endpoint);
- if (((MultipleEndpointObserver)mo).getEndpoints().isEmpty()) {
- getDestination().setMessageObserver(null);
- }
- } else {
- getDestination().setMessageObserver(null);
- }
- stopped = true;
- }
-
- public void destroy() {
- stop();
- if (this.destroyDest) {
- //we should shutdown the destination here
- getDestination().shutdown();
- }
-
- if (null != serverRegistry) {
- LOG.fine("unregister the server to serverRegistry ");
- serverRegistry.unregister(this);
- }
-
- if (iMgr != null) {
- try {
- iMgr.unregister(mep);
- } catch (JMException jmex) {
- LOG.log(Level.WARNING, "Unregistering ManagedEndpoint failed.", jmex);
- }
- iMgr = null;
- }
-
- }
-
- public Endpoint getEndpoint() {
- return endpoint;
- }
-
-}
diff --git a/deps/cxf-shade/src/patch/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java b/deps/cxf-shade/src/patch/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
deleted file mode 100644
index 5b203a6d95..0000000000
--- a/deps/cxf-shade/src/patch/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
+++ /dev/null
@@ -1,988 +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.cxf.jaxrs.provider;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Array;
-import java.lang.reflect.Type;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import jakarta.ws.rs.WebApplicationException;
-import jakarta.ws.rs.core.MediaType;
-import jakarta.ws.rs.core.MultivaluedMap;
-import jakarta.ws.rs.core.NoContentException;
-import jakarta.ws.rs.core.Response;
-import jakarta.ws.rs.core.StreamingOutput;
-import jakarta.ws.rs.ext.ContextResolver;
-import jakarta.ws.rs.ext.MessageBodyReader;
-import jakarta.ws.rs.ext.MessageBodyWriter;
-import jakarta.xml.bind.JAXBContext;
-import jakarta.xml.bind.JAXBElement;
-import jakarta.xml.bind.JAXBException;
-import jakarta.xml.bind.Marshaller;
-import jakarta.xml.bind.PropertyException;
-import jakarta.xml.bind.Unmarshaller;
-import jakarta.xml.bind.ValidationEventHandler;
-import jakarta.xml.bind.annotation.XmlAnyElement;
-import jakarta.xml.bind.annotation.XmlRootElement;
-import jakarta.xml.bind.annotation.XmlType;
-import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.validation.Schema;
-
-import org.w3c.dom.Element;
-
-import org.xml.sax.helpers.DefaultHandler;
-
-import com.ctc.wstx.exc.WstxEOFException;
-
-import org.apache.cxf.annotations.SchemaValidation;
-import org.apache.cxf.common.jaxb.JAXBUtils;
-import org.apache.cxf.common.util.PackageUtils;
-import org.apache.cxf.jaxrs.ext.MessageContext;
-import org.apache.cxf.jaxrs.model.ClassResourceInfo;
-import org.apache.cxf.jaxrs.utils.ExceptionUtils;
-import org.apache.cxf.jaxrs.utils.InjectionUtils;
-import org.apache.cxf.jaxrs.utils.JAXRSUtils;
-import org.apache.cxf.jaxrs.utils.ResourceUtils;
-import org.apache.cxf.jaxrs.utils.schemas.SchemaHandler;
-import org.apache.cxf.message.Message;
-import org.apache.cxf.phase.PhaseInterceptorChain;
-import org.apache.cxf.staxutils.DepthExceededStaxException;
-import org.apache.cxf.staxutils.DepthRestrictingStreamReader;
-import org.apache.cxf.staxutils.DepthXMLStreamReader;
-import org.apache.cxf.staxutils.DocumentDepthProperties;
-import org.apache.cxf.staxutils.StaxUtils;
-import org.apache.cxf.staxutils.transform.TransformUtils;
-
-public abstract class AbstractJAXBProvider<T> extends AbstractConfigurableProvider
- implements MessageBodyReader<T>, MessageBodyWriter<T> {
-
- protected static final String NS_MAPPER_PROPERTY_RI = "com.sun.xml.bind.namespacePrefixMapper";
- protected static final String NS_MAPPER_PROPERTY_RI_INT = "com.sun.xml.internal.bind.namespacePrefixMapper";
- private static final String JAXB_DEFAULT_NAMESPACE = "##default";
- private static final String JAXB_DEFAULT_NAME = "##default";
- private static final Set<Class<?>> UNSUPPORTED_CLASSES =
- new HashSet<Class<?>>(Arrays.asList(InputStream.class,
- OutputStream.class,
- StreamingOutput.class));
- protected Set<Class<?>> collectionContextClasses = ConcurrentHashMap.newKeySet();
-
- protected Map<String, String> jaxbElementClassMap = Collections.emptyMap();
- protected boolean unmarshalAsJaxbElement;
- protected boolean marshalAsJaxbElement;
- protected boolean xmlTypeAsJaxbElementOnly;
-
- protected Map<String, String> outElementsMap;
- protected Map<String, String> outAppendMap;
- protected List<String> outDropElements;
- protected List<String> inDropElements;
- protected Map<String, String> inElementsMap;
- protected Map<String, String> inAppendMap;
- protected Map<String, JAXBContext> packageContexts = new ConcurrentHashMap<>();
- protected Map<Class<?>, JAXBContext> classContexts = new ConcurrentHashMap<>();
- private boolean attributesToElements;
-
- private MessageContext mc;
-
- private Schema schema;
- private String catalogLocation;
- private Map<String, SchemaHandler> schemaHandlers;
-
- private String collectionWrapperName;
- private Map<String, String> collectionWrapperMap;
- private List<String> jaxbElementClassNames;
- private boolean xmlRootAsJaxbElement;
- private Map<String, Object> cProperties;
- private Map<String, Object> uProperties;
-
- private boolean skipJaxbChecks;
- private boolean singleJaxbContext;
- private boolean useSingleContextForPackages;
-
- private Class<?>[] extraClass;
-
- private boolean validateInputIfPossible = true;
- private boolean validateOutputIfPossible;
- private boolean validateBeforeWrite;
- private ValidationEventHandler eventHandler;
- private Unmarshaller.Listener unmarshallerListener;
- private Marshaller.Listener marshallerListener;
- private DocumentDepthProperties depthProperties;
- private String namespaceMapperPropertyName;
-
- private static JAXBContext newJAXBContextInstance(Class<?>[] classes, Map<String, Object> cProperties)
- throws JAXBException {
-
- try {
- return AccessController.doPrivileged((PrivilegedExceptionAction<JAXBContext>)() -> {
- return JAXBContext.newInstance(classes, cProperties);
- });
- } catch (PrivilegedActionException e) {
- Throwable t = e.getCause();
- if (t instanceof JAXBException) {
- throw (JAXBException) t;
- }
- throw new RuntimeException(t);
- }
- }
-
- public void setXmlRootAsJaxbElement(boolean xmlRootAsJaxbElement) {
- this.xmlRootAsJaxbElement = xmlRootAsJaxbElement;
- }
-
-
- protected void setNamespaceMapper(Marshaller ms,
- Map<String, String> map) throws Exception {
- Object nsMapper = JAXBUtils.setNamespaceMapper(getBus(), map, ms);
- if (nsMapper != null && namespaceMapperPropertyName != null) {
- setMarshallerProp(ms, nsMapper, namespaceMapperPropertyName, null);
- }
- }
-
- protected static void setMarshallerProp(Marshaller ms, Object value,
- String name1, String name2) throws Exception {
- try {
- ms.setProperty(name1, value);
- } catch (PropertyException ex) {
- if (name2 != null) {
- ms.setProperty(name2, value);
- } else {
- throw ex;
- }
- }
-
- }
-
- public void setValidationHandler(ValidationEventHandler handler) {
- eventHandler = handler;
- }
-
- public void setSingleJaxbContext(boolean useSingleContext) {
- singleJaxbContext = useSingleContext;
- }
-
- public void setUseSingleContextForPackages(boolean use) {
- useSingleContextForPackages = use;
- }
-
- public void setExtraClass(Class<?>[] userExtraClass) {
- extraClass = userExtraClass;
- }
-
- @Override
- public void init(List<ClassResourceInfo> cris) {
- if (singleJaxbContext) {
- JAXBContext context = null;
- Set<Class<?>> allTypes = null;
- if (cris != null) {
- allTypes = new HashSet<>(ResourceUtils.getAllRequestResponseTypes(cris, true)
- .getAllTypes().keySet());
- context = org.apache.cxf.jaxrs.utils.JAXBUtils.createJaxbContext(allTypes, extraClass, cProperties);
- } else if (extraClass != null) {
- allTypes = new HashSet<>(Arrays.asList(extraClass));
- context = org.apache.cxf.jaxrs.utils.JAXBUtils.createJaxbContext(allTypes, null, cProperties);
- }
-
- if (context != null) {
- for (Class<?> cls : allTypes) {
- if (useSingleContextForPackages) {
- packageContexts.put(PackageUtils.getPackageName(cls), context);
- } else {
- classContexts.put(cls, context);
- }
- }
- }
- }
- if (cris != null) {
- List<String> schemaLocs = new LinkedList<>();
- SchemaValidation sv = null;
- for (ClassResourceInfo cri : cris) {
- sv = cri.getServiceClass().getAnnotation(SchemaValidation.class);
- if (sv != null && sv.schemas() != null && sv.type() != SchemaValidation.SchemaValidationType.NONE) {
- for (String s : sv.schemas()) {
- String theSchema = s;
- if (!theSchema.startsWith("classpath:")) {
- theSchema = "classpath:" + theSchema;
- }
- schemaLocs.add(theSchema);
- }
- }
- }
- if (!schemaLocs.isEmpty()) {
- this.setSchemaLocations(schemaLocs);
- if (cris.isEmpty() && schema != null && sv != null) {
- SchemaValidation.SchemaValidationType type = sv.type();
- if (type == SchemaValidation.SchemaValidationType.OUT) {
- validateInputIfPossible = false;
- validateOutputIfPossible = true;
- } else if (type == SchemaValidation.SchemaValidationType.BOTH) {
- validateOutputIfPossible = true;
- }
- }
- }
- }
- }
-
- public void setContextProperties(Map<String, Object> contextProperties) {
- cProperties = contextProperties;
- }
-
- public void setUnmarshallerProperties(Map<String, Object> unmarshalProperties) {
- uProperties = unmarshalProperties;
- }
-
- public void setUnmarshallAsJaxbElement(boolean value) {
- unmarshalAsJaxbElement = value;
- }
-
- public void setMarshallAsJaxbElement(boolean value) {
- marshalAsJaxbElement = value;
- }
-
- public void setXmlTypeAsJaxbElementOnly(boolean value) {
- this.xmlTypeAsJaxbElementOnly = value;
- }
-
- public void setJaxbElementClassNames(List<String> names) {
- jaxbElementClassNames = names;
- }
-
- public void setJaxbElementClassMap(Map<String, String> map) {
- jaxbElementClassMap = map;
- }
-
- protected <X> X getStreamHandlerFromCurrentMessage(Class<X> staxCls) {
- Message m = PhaseInterceptorChain.getCurrentMessage();
- if (m != null) {
- return staxCls.cast(m.getContent(staxCls));
- }
- return null;
- }
-
- protected boolean isXmlRoot(Class<?> cls) {
- return cls.getAnnotation(XmlRootElement.class) != null;
- }
-
- protected boolean isXmlType(Class<?> cls) {
- return cls.getAnnotation(XmlType.class) != null;
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- protected Object convertToJaxbElementIfNeeded(Object obj, Class<?> cls, Type genericType)
- throws Exception {
-
- Class<?> jaxbElementCls = jaxbElementClassNames == null ? null : getJaxbElementClass(cls);
- boolean asJaxbElement = jaxbElementCls != null;
- if (!asJaxbElement && isXmlRoot(cls) && !xmlRootAsJaxbElement) {
- return obj;
- }
- if (jaxbElementCls == null) {
- jaxbElementCls = cls;
- }
- QName name = null;
- String expandedName = jaxbElementClassMap.get(jaxbElementCls.getName());
- if (expandedName != null) {
- name = JAXRSUtils.convertStringToQName(expandedName);
- } else if (marshalAsJaxbElement || asJaxbElement) {
- name = getJaxbQName(jaxbElementCls, genericType, obj, false);
- }
- return name != null ? new JAXBElement<Object>(name, (Class)jaxbElementCls, null, obj) : obj;
- }
-
- protected Class<?> getJaxbElementClass(Class<?> cls) {
- if (cls == Object.class) {
- return null;
- }
- if (jaxbElementClassNames.contains(cls.getName())) {
- return cls;
- }
- return getJaxbElementClass(cls.getSuperclass());
-
- }
-
- public void setCollectionWrapperName(String wName) {
- collectionWrapperName = wName;
- }
-
- public void setCollectionWrapperMap(Map<String, String> map) {
- collectionWrapperMap = map;
- }
-
- protected void setContext(MessageContext context) {
- mc = context;
- }
-
- public boolean isWriteable(Class<?> type, Type genericType, Annotation[] anns, MediaType mt) {
-
- if (InjectionUtils.isSupportedCollectionOrArray(type)) {
- type = InjectionUtils.getActualType(genericType);
- if (type == null) {
- return false;
- }
- }
- return marshalAsJaxbElement && (!xmlTypeAsJaxbElementOnly || isXmlType(type))
- || isSupported(type, genericType, anns);
- }
- public void writeTo(T t, Type genericType, Annotation[] annotations,
- MediaType mediaType,
- MultivaluedMap<String, Object> httpHeaders,
- OutputStream entityStream) throws IOException, WebApplicationException {
- @SuppressWarnings("unchecked")
- Class<T> type = (Class<T>)t.getClass();
- writeTo(t, type, genericType, annotations, mediaType, httpHeaders, entityStream);
- }
-
- protected JAXBContext getCollectionContext(Class<?> type) throws JAXBException {
- if (collectionContextClasses.add(type)) {
- collectionContextClasses.add(CollectionWrapper.class);
- }
- return newJAXBContextInstance(
- collectionContextClasses.toArray(new Class[0]), cProperties);
- }
-
- protected QName getCollectionWrapperQName(Class<?> cls, Type type, Object object, boolean pluralName)
- throws Exception {
- String name = getCollectionWrapperName(cls);
- if (name == null) {
- return getJaxbQName(cls, type, object, pluralName);
- }
-
- return JAXRSUtils.convertStringToQName(name);
- }
-
- private String getCollectionWrapperName(Class<?> cls) {
- if (collectionWrapperName != null) {
- return collectionWrapperName;
- }
- if (collectionWrapperMap != null) {
- return collectionWrapperMap.get(cls.getName());
- }
-
- return null;
- }
-
- protected QName getJaxbQName(Class<?> cls, Type type, Object object, boolean pluralName)
- throws Exception {
-
- if (cls == JAXBElement.class) {
- return object != null ? ((JAXBElement<?>)object).getName() : null;
- }
-
- XmlRootElement root = cls.getAnnotation(XmlRootElement.class);
- if (root != null) {
- return getQNameFromNamespaceAndName(root.namespace(), root.name(), cls, pluralName);
- } else if (isXmlType(cls)) {
- XmlType xmlType = cls.getAnnotation(XmlType.class);
- return getQNameFromNamespaceAndName(xmlType.namespace(), xmlType.name(), cls, pluralName);
- } else {
- return new QName(getPackageNamespace(cls), cls.getSimpleName());
- }
- }
-
- private static QName getQNameFromNamespaceAndName(String ns, String localName, Class<?> cls, boolean plural) {
- String name = getLocalName(localName, cls.getSimpleName(), plural);
- String namespace = getNamespace(ns);
- if ("".equals(namespace)) {
- namespace = getPackageNamespace(cls);
- }
- return new QName(namespace, name);
- }
-
- private static String getLocalName(String name, String clsName, boolean pluralName) {
- if (JAXB_DEFAULT_NAME.equals(name)) {
- name = clsName;
- if (name.length() > 1) {
- name = name.substring(0, 1).toLowerCase() + name.substring(1);
- } else {
- name = name.toLowerCase();
- }
- }
- if (pluralName) {
- name += 's';
- }
- return name;
- }
-
- private static String getPackageNamespace(Class<?> cls) {
- String packageNs = JAXBUtils.getPackageNamespace(cls);
- return packageNs != null ? getNamespace(packageNs) : "";
- }
-
- private static String getNamespace(String namespace) {
- if (JAXB_DEFAULT_NAMESPACE.equals(namespace)) {
- return "";
- }
- return namespace;
- }
-
- public boolean isReadable(Class<?> type, Type genericType, Annotation[] anns, MediaType mt) {
- if (InjectionUtils.isSupportedCollectionOrArray(type)) {
- type = InjectionUtils.getActualType(genericType);
- if (type == null) {
- return false;
- }
- }
- return canBeReadAsJaxbElement(type) || isSupported(type, genericType, anns);
- }
-
- protected boolean canBeReadAsJaxbElement(Class<?> type) {
- return unmarshalAsJaxbElement && type != Response.class;
- }
-
- public void setSchemaLocations(List<String> locations) {
- schema = SchemaHandler.createSchema(locations, catalogLocation, getBus());
- }
-
- public void setCatalogLocation(String name) {
- this.catalogLocation = name;
- }
-
- public void setSchemaHandler(SchemaHandler handler) {
- setSchema(handler.getSchema());
- }
-
- public void setSchemaHandlers(Map<String, SchemaHandler> handlers) {
- schemaHandlers = handlers;
- }
-
- protected void setSchema(Schema s) {
- schema = s;
- }
-
- public long getSize(T o, Class<?> type, Type genericType, Annotation[] annotations, MediaType mt) {
- return -1;
- }
-
- protected MessageContext getContext() {
- return mc;
- }
-
- @SuppressWarnings("unchecked")
- public JAXBContext getJAXBContext(Class<?> type, Type genericType) throws JAXBException {
- if (mc != null) {
- ContextResolver<JAXBContext> resolver =
- mc.getResolver(ContextResolver.class, JAXBContext.class);
- if (resolver != null) {
- JAXBContext customContext = resolver.getContext(type);
- if (customContext != null) {
- return customContext;
- }
- }
- }
-
- JAXBContext context = classContexts.get(type);
- if (context != null) {
- return context;
- }
-
- context = getPackageContext(type, genericType);
-
- return context != null ? context : getClassContext(type, genericType);
- }
- public JAXBContext getClassContext(Class<?> type) throws JAXBException {
- return getClassContext(type, type);
- }
- protected JAXBContext getClassContext(Class<?> type, Type genericType) throws JAXBException {
- final JAXBException[] jaxbException = new JAXBException[] {null};
- final JAXBContext context = classContexts.computeIfAbsent(type, t -> {
- final Class<?>[] classes;
- if (extraClass != null) {
- classes = new Class[extraClass.length + 1];
- classes[0] = type;
- System.arraycopy(extraClass, 0, classes, 1, extraClass.length);
- } else {
- classes = new Class[] {type};
- }
-
- try {
- return newJAXBContextInstance(classes, cProperties);
- } catch (JAXBException e) {
- jaxbException[0] = e;
- return null;
- }
- });
- if (null != jaxbException[0]) {
- throw jaxbException[0];
- }
- return context;
- }
- public JAXBContext getPackageContext(Class<?> type) {
- return getPackageContext(type, type);
- }
- protected JAXBContext getPackageContext(final Class<?> type, Type genericType) {
- if (type == null || type == JAXBElement.class) {
- return null;
- }
- final String packageName = PackageUtils.getPackageName(type);
- return packageContexts.computeIfAbsent(packageName, p -> {
- try {
- final ClassLoader loader = AccessController.doPrivileged((PrivilegedAction<ClassLoader>)
- () -> {
- return type.getClassLoader();
- });
- if (loader != null && objectFactoryOrIndexAvailable(type)) {
-
- String contextName = packageName;
- if (extraClass != null) {
- StringBuilder sb = new StringBuilder(contextName);
- for (Class<?> extra : extraClass) {
- String extraPackage = PackageUtils.getPackageName(extra);
- if (!extraPackage.equals(packageName)) {
- sb.append(':').append(extraPackage);
- }
- }
- contextName = sb.toString();
- }
-
- return JAXBContext.newInstance(contextName, loader, cProperties);
- }
- } catch (JAXBException ex) {
- LOG.fine("Error creating a JAXBContext using ObjectFactory : "
- + ex.getMessage());
- }
- return null;
- });
- }
-
- protected boolean isSupported(Class<?> type, Type genericType, Annotation[] anns) {
- if (jaxbElementClassMap != null && jaxbElementClassMap.containsKey(type.getName())
- || isSkipJaxbChecks()) {
- return true;
- }
- if (UNSUPPORTED_CLASSES.contains(type)) {
- return false;
- }
- return isXmlRoot(type)
- || JAXBElement.class.isAssignableFrom(type)
- || objectFactoryOrIndexAvailable(type)
- || (type != genericType && objectFactoryForType(genericType))
- || org.apache.cxf.jaxrs.utils.JAXBUtils.getAdapter(type, anns) != null;
-
- }
-
- protected boolean objectFactoryOrIndexAvailable(Class<?> type) {
- return type.getResource("ObjectFactory.class") != null
- || type.getResource("jaxb.index") != null;
- }
-
- private boolean objectFactoryForType(Type genericType) {
- return objectFactoryOrIndexAvailable(InjectionUtils.getActualType(genericType));
- }
-
- protected Unmarshaller createUnmarshaller(Class<?> cls, Type genericType)
- throws JAXBException {
- return createUnmarshaller(cls, genericType, false);
- }
-
- protected Unmarshaller createUnmarshaller(Class<?> cls, Type genericType, boolean isCollection)
- throws JAXBException {
- JAXBContext context = isCollection ? getCollectionContext(cls)
- : getJAXBContext(cls, genericType);
- Unmarshaller unmarshaller = context.createUnmarshaller();
- if (validateInputIfPossible) {
- Schema theSchema = getSchema(cls);
- if (theSchema != null) {
- unmarshaller.setSchema(theSchema);
- }
- }
- if (eventHandler != null) {
- unmarshaller.setEventHandler(eventHandler);
- }
- if (unmarshallerListener != null) {
- unmarshaller.setListener(unmarshallerListener);
- }
- if (uProperties != null) {
- for (Map.Entry<String, Object> entry : uProperties.entrySet()) {
- unmarshaller.setProperty(entry.getKey(), entry.getValue());
- }
- }
- return unmarshaller;
- }
-
- protected Marshaller createMarshaller(Object obj, Class<?> cls, Type genericType, String enc)
- throws JAXBException {
-
- Class<?> objClazz = JAXBElement.class.isAssignableFrom(cls)
- ? ((JAXBElement<?>)obj).getDeclaredType() : cls;
-
- JAXBContext context = getJAXBContext(objClazz, genericType);
- Marshaller marshaller = context.createMarshaller();
- if (enc != null) {
- marshaller.setProperty(Marshaller.JAXB_ENCODING, enc);
- }
- if (marshallerListener != null) {
- marshaller.setListener(marshallerListener);
- }
- validateObjectIfNeeded(marshaller, cls, obj);
- return marshaller;
- }
-
- protected void validateObjectIfNeeded(Marshaller marshaller, Class<?> cls, Object obj)
- throws JAXBException {
- if (validateOutputIfPossible) {
- Schema theSchema = getSchema(cls);
- if (theSchema != null) {
- marshaller.setEventHandler(eventHandler);
- marshaller.setSchema(theSchema);
- if (validateBeforeWrite) {
- marshaller.marshal(obj, new DefaultHandler());
- marshaller.setSchema(null);
- }
- }
- }
- }
-
- protected Class<?> getActualType(Class<?> type, Type genericType, Annotation[] anns) {
- Class<?> theType;
- if (JAXBElement.class.isAssignableFrom(type)) {
- theType = InjectionUtils.getActualType(genericType);
- } else {
- theType = type;
- }
- XmlJavaTypeAdapter adapter = org.apache.cxf.jaxrs.utils.JAXBUtils.getAdapter(theType, anns);
- theType = org.apache.cxf.jaxrs.utils.JAXBUtils.getTypeFromAdapter(adapter, theType, false);
-
- return theType;
- }
-
- protected static Object checkAdapter(Object obj, Class<?> cls, Annotation[] anns, boolean marshal) {
- XmlJavaTypeAdapter adapter = org.apache.cxf.jaxrs.utils.JAXBUtils.getAdapter(cls, anns);
- return org.apache.cxf.jaxrs.utils.JAXBUtils.useAdapter(obj, adapter, marshal);
- }
-
- protected Schema getSchema() {
- return getSchema(null);
- }
-
- protected Schema getSchema(Class<?> cls) {
- // deal with the typical default case first
- if (schema == null && schemaHandlers == null) {
- return null;
- }
-
- if (schema != null) {
- return schema;
- }
- SchemaHandler handler = schemaHandlers.get(cls.getName());
- return handler != null ? handler.getSchema() : null;
- }
-
-
- public void clearContexts() {
- classContexts.clear();
- packageContexts.clear();
- }
-
- //TODO: move these methods into the dedicated utility class
- protected static StringBuilder handleExceptionStart(Exception e) {
- LOG.warning(ExceptionUtils.getStackTrace(e));
- StringBuilder sb = new StringBuilder();
- if (e.getMessage() != null) {
- sb.append(e.getMessage()).append(". ");
- }
- if (e.getCause() != null && e.getCause().getMessage() != null) {
- sb.append(e.getCause().getMessage()).append(". ");
- }
- return sb;
- }
-
- protected static void handleExceptionEnd(Throwable t, String message, boolean read) {
- Response.Status status = read
- ? Response.Status.BAD_REQUEST : Response.Status.INTERNAL_SERVER_ERROR;
- Response r = JAXRSUtils.toResponseBuilder(status)
- .type(MediaType.TEXT_PLAIN).entity(message).build();
- throw read ? ExceptionUtils.toBadRequestException(t, r)
- : ExceptionUtils.toInternalServerErrorException(t, r);
- }
-
- protected void handleJAXBException(JAXBException e, boolean read) {
- StringBuilder sb = handleExceptionStart(e);
- Throwable linked = e.getLinkedException();
- if (linked != null && linked.getMessage() != null) {
- Throwable cause = linked;
- while (read && cause != null) {
- if (cause instanceof XMLStreamException && cause.getMessage().startsWith("Maximum Number")) {
- throw ExceptionUtils.toWebApplicationException(null, JAXRSUtils.toResponse(413));
- }
- if (cause instanceof DepthExceededStaxException) {
- throw ExceptionUtils.toWebApplicationException(null, JAXRSUtils.toResponse(413));
- }
- cause = cause.getCause();
- }
- String msg = linked.getMessage();
- if (sb.lastIndexOf(msg) == -1) {
- sb.append(msg).append(". ");
- }
- }
- Throwable t = linked != null ? linked : e.getCause() != null ? e.getCause() : e;
- String message = new org.apache.cxf.common.i18n.Message("JAXB_EXCEPTION",
- BUNDLE, sb.toString()).toString();
- handleExceptionEnd(t, message, read);
- }
-
- protected void handleXMLStreamException(XMLStreamException e, boolean read) {
- StringBuilder sb = handleExceptionStart(e);
- handleExceptionEnd(e, sb.toString(), read);
- }
-
- public void setOutTransformElements(Map<String, String> outElements) {
- this.outElementsMap = outElements;
- }
-
- public void setInAppendElements(Map<String, String> inElements) {
- this.inAppendMap = inElements;
- }
-
- public void setInTransformElements(Map<String, String> inElements) {
- this.inElementsMap = inElements;
- }
-
- public void setOutAppendElements(Map<String, String> map) {
- this.outAppendMap = map;
- }
-
- public void setOutDropElements(List<String> dropElementsSet) {
- this.outDropElements = dropElementsSet;
- }
-
- public void setInDropElements(List<String> dropElementsSet) {
- this.inDropElements = dropElementsSet;
- }
-
- public void setAttributesToElements(boolean value) {
- this.attributesToElements = value;
- }
-
- public void setSkipJaxbChecks(boolean skipJaxbChecks) {
- this.skipJaxbChecks = skipJaxbChecks;
- }
-
- public boolean isSkipJaxbChecks() {
- return skipJaxbChecks;
- }
-
- protected XMLStreamWriter createTransformWriterIfNeeded(XMLStreamWriter writer,
- OutputStream os,
- boolean dropAtXmlLevel) {
- return TransformUtils.createTransformWriterIfNeeded(writer, os,
- outElementsMap,
- dropAtXmlLevel ? outDropElements : null,
- outAppendMap,
- attributesToElements,
- null);
- }
-
- protected XMLStreamReader createTransformReaderIfNeeded(XMLStreamReader reader, InputStream is) {
- return TransformUtils.createTransformReaderIfNeeded(reader, is,
- inDropElements,
- inElementsMap,
- inAppendMap,
- true);
- }
-
- protected XMLStreamReader createDepthReaderIfNeeded(XMLStreamReader reader, InputStream is) {
- DocumentDepthProperties props = getDepthProperties();
- if (props != null && props.isEffective()) {
- reader = TransformUtils.createNewReaderIfNeeded(reader, is);
- reader = new DepthRestrictingStreamReader(reader, props);
- } else if (reader != null) {
- reader = configureReaderRestrictions(reader);
- }
- return reader;
- }
-
- protected XMLStreamReader configureReaderRestrictions(XMLStreamReader reader) {
- Message message = PhaseInterceptorChain.getCurrentMessage();
- if (message != null) {
- try {
- return StaxUtils.configureReader(reader, message);
- } catch (XMLStreamException ex) {
- throw ExceptionUtils.toInternalServerErrorException(ex, null);
- }
- }
- return reader;
- }
-
- protected DocumentDepthProperties getDepthProperties() {
- return depthProperties;
- }
-
- public void setValidateBeforeWrite(boolean validateBeforeWrite) {
- this.validateBeforeWrite = validateBeforeWrite;
- }
-
- public void setValidateOutput(boolean validateOutput) {
- this.validateOutputIfPossible = validateOutput;
- }
- public void setValidateInput(boolean validateInput) {
- this.validateInputIfPossible = validateInput;
- }
-
- public void setDepthProperties(DocumentDepthProperties depthProperties) {
- this.depthProperties = depthProperties;
- }
-
- public void setUnmarshallerListener(Unmarshaller.Listener unmarshallerListener) {
- this.unmarshallerListener = unmarshallerListener;
- }
-
- public void setMarshallerListener(Marshaller.Listener marshallerListener) {
- this.marshallerListener = marshallerListener;
- }
-
- public void setNamespaceMapperPropertyName(String namespaceMapperProperty) {
- this.namespaceMapperPropertyName = namespaceMapperProperty;
- }
-
- @XmlRootElement
- protected static class CollectionWrapper {
-
- @XmlAnyElement(lax = true)
- private List<?> l;
-
- public void setList(List<?> list) {
- l = list;
- }
-
- public List<?> getList() {
- if (l == null) {
- l = new ArrayList<>();
- }
- return l;
- }
-
- @SuppressWarnings("unchecked")
- public <T> Object getCollectionOrArray(Unmarshaller unm,
- Class<T> type,
- Class<?> collectionType,
- Type genericType,
- XmlJavaTypeAdapter adapter) throws JAXBException {
- List<?> theList = getList();
- boolean adapterChecked = false;
- if (!theList.isEmpty()) {
- Object first = theList.get(0);
-
- if (first instanceof Element) {
- List<Object> newList = new ArrayList<>(theList.size());
- for (Object o : theList) {
- newList.add(unm.unmarshal((Element)o, type));
- }
- theList = newList;
- }
-
- first = theList.get(0);
- Type[] types = InjectionUtils.getActualTypes(genericType);
- boolean isJaxbElement = types != null && types.length > 0
- && InjectionUtils.getRawType(types[0]) == JAXBElement.class;
-
- if (first instanceof JAXBElement && !isJaxbElement && !JAXBElement.class.isAssignableFrom(type)) {
- adapterChecked = true;
- List<Object> newList = new ArrayList<>(theList.size());
- for (Object o : theList) {
- newList.add(org.apache.cxf.jaxrs.utils.JAXBUtils.useAdapter(
- ((JAXBElement<?>)o).getValue(), adapter, false));
- }
- theList = newList;
- } else if (!(first instanceof JAXBElement) && isJaxbElement) {
- List<Object> newList = new ArrayList<>(theList.size());
- XmlRootElement root = type.getAnnotation(XmlRootElement.class);
- QName qname = getQNameFromNamespaceAndName(root.namespace(), root.name(), type, false);
- @SuppressWarnings("rawtypes")
- Class theType = type;
- for (Object o : theList) {
- newList.add(new JAXBElement<Object>(qname, theType, null, o));
- }
- theList = newList;
- }
- }
- if (collectionType.isArray()) {
- T[] values = (T[])Array.newInstance(type, theList.size());
- for (int i = 0; i < theList.size(); i++) {
- values[i] = (T)org.apache.cxf.jaxrs.utils.JAXBUtils.useAdapter(
- theList.get(i), adapter, false);
- }
- return values;
- }
- if (!adapterChecked && adapter != null) {
- List<Object> newList = new ArrayList<>(theList.size());
- for (Object o : theList) {
- newList.add(org.apache.cxf.jaxrs.utils.JAXBUtils.useAdapter(o, adapter, false));
- }
- theList = newList;
- }
- if (collectionType == Set.class) {
- return new HashSet<>(theList);
- }
- return theList;
- }
-
- }
-
- protected static class JAXBCollectionWrapperReader extends DepthXMLStreamReader {
-
- private boolean firstName;
- private boolean firstNs;
-
- public JAXBCollectionWrapperReader(XMLStreamReader reader) {
- super(reader);
- }
-
- @Override
- public String getNamespaceURI() {
- if (!firstNs) {
- firstNs = true;
- return "";
- }
- return super.getNamespaceURI();
- }
-
- @Override
- public String getLocalName() {
- if (!firstName) {
- firstName = true;
- return "collectionWrapper";
- }
-
- return super.getLocalName();
- }
-
- }
-
-
-}
diff --git a/deps/cxf-shade/src/patch/java/org/apache/cxf/jaxrs/provider/GenericArgumentComparator.java b/deps/cxf-shade/src/patch/java/org/apache/cxf/jaxrs/provider/GenericArgumentComparator.java
deleted file mode 100644
index 505acfa796..0000000000
--- a/deps/cxf-shade/src/patch/java/org/apache/cxf/jaxrs/provider/GenericArgumentComparator.java
+++ /dev/null
@@ -1,206 +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.cxf.jaxrs.provider;
-
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.util.Comparator;
-
-import org.apache.cxf.jaxrs.utils.GenericsUtils;
-
-public class GenericArgumentComparator implements Comparator<Class<?>> {
-
- private final Class<?> genericInterface;
-
- public GenericArgumentComparator(final Class<?> genericInterface) {
- if (genericInterface == null) {
- throw new IllegalArgumentException("Generic Interface cannot be null");
- }
- if (genericInterface.getTypeParameters().length == 0) {
- throw new IllegalArgumentException("Interface has no generic type parameters: " + genericInterface);
- }
- if (genericInterface.getTypeParameters().length > 1) {
- throw new IllegalArgumentException("Interface must have only 1 generic type parameter: "
- + genericInterface);
- }
- this.genericInterface = genericInterface;
- }
-
- /**
- * This comparator sorts the most specific type to the top of the list.
- *
- * Effectively, this sorts classes in descending order with java.lang.Object
- * always as the last element if present.
- */
- @Override
- public int compare(final Class<?> a, final Class<?> b) {
- /*
- * To keep things from being too abstract and confusing, this javadoc refers
- * MessageBodyReader as the value of genericInterface.
- *
- * It could be any similar interface with just one generic type parameter,
- * such as MessageBodyWriter, ContextResolver, Consumer, etc.
- */
-
- /*
- * Get the actual type each class specified as its MessageBodyReader generic
- * parameter. An array of one arg will be returned or null if the class does
- * not implement MessageBodyReader.
- */
- final Type[] aTypes = GenericsUtils.getTypeArgumentsFor(genericInterface, a);
- final Type[] bTypes = GenericsUtils.getTypeArgumentsFor(genericInterface, b);
-
- /*
- * If either class does not implement the MessageBodyReader interface and
- * therefore returned a null Types array, that class should have the lower
- * priority.
- */
- if (aTypes == bTypes) {
- return 0;
- }
- if (aTypes == null) {
- return 1;
- }
- if (bTypes == null) {
- return -1;
- }
-
- /*
- * We only support interfaces like MessageBodyReader that have
- * just one type parameter. Neither class returned a null Type
- * array so we know each properly implements the interface and
- * therefore we don't need to check array lengths.
- */
- final Type aType = aTypes[0];
- final Type bType = bTypes[0];
-
- return compare(aType, bType);
- }
-
- public int compare(final Type aType, final Type bType) {
- if (aType == bType) {
- return 0;
- }
-
- /*
- * At this point we're now dealing with actual the value each
- * class specified for their MessageBodyReader implementations.
- *
- * Types like String, Boolean and URI will appear as a Class.
- * Types like JAXBElement which themselves have a parameter will
- * appear as a ParameterizedType.
- *
- * Let's first evaluate them as basic classes. Only if they're
- * the same class do we need to look at their parameters.
- */
- final Class<?> aClass = asClass(aType);
- final Class<?> bClass = asClass(bType);
-
- /*
- * If they aren't the same class we only need to look at the
- * classes themselves and can ignore any parameters they have
- */
- if (!aClass.equals(bClass)) {
- /*
- * For those who can't remember this cryptic method:
- *
- * Red.class.isAssignableFrom(Color.class) == false
- * Color.class.isAssignableFrom(Red.class) == true
- */
-
- // bClass is a more generic version of aClass
- if (bClass.isAssignableFrom(aClass)) {
- return -1;
- }
-
- // aClass is a more generic version of bClass
- if (aClass.isAssignableFrom(bClass)) {
- return 1;
- }
-
- // These classes are unrelated
- return 0;
- }
-
- /*
- * They are the same class, so let's look at their parameters
- * and try to sort based on those.
- */
- final Type aParam = getFirstParameterOrObject(aType);
- final Type bParam = getFirstParameterOrObject(bType);
-
- return compare(aParam, bParam);
- }
-
- private Type getFirstParameterOrObject(final Type type) {
- if (!(type instanceof ParameterizedType)) {
- return Object.class;
- }
-
- final ParameterizedType parameterizedType = (ParameterizedType) type;
- final Type[] types = parameterizedType.getActualTypeArguments();
-
- if (types.length == 0) {
- return Object.class;
- }
-
- /*
- * This parameterized type may have more than one
- * generic argument (like Map or Function do). If
- * so, too bad, we're ignoring it out of laziness.
- *
- * Feel free to come here and implement what makes
- * sense to you if you need this feature. Maybe
- * you have a Map<String,Object> and Map<String,URL>
- * situation you want to support.
- */
- return types[0];
- }
-
- private Class<?> asClass(final Type aType) {
- if (aType instanceof Class) {
- return (Class<?>) aType;
- }
-
- if (aType instanceof ParameterizedType) {
- final ParameterizedType parameterizedType = (ParameterizedType) aType;
- return asClass(parameterizedType.getRawType());
- }
-
- if (aType instanceof TypeVariable) {
- final TypeVariable typeVariable = (TypeVariable) aType;
- final Type[] bounds = typeVariable.getBounds();
-
- if (bounds == null || bounds.length == 0) {
- return Object.class;
- } else {
- return asClass(bounds[0]);
- }
- }
-
- if (aType instanceof WildcardType) {
- // todo
- return Object.class;
- }
-
- return Object.class;
- }
-}
diff --git a/deps/cxf-shade/src/patch/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java b/deps/cxf-shade/src/patch/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
deleted file mode 100644
index fd3abbd9fd..0000000000
--- a/deps/cxf-shade/src/patch/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
+++ /dev/null
@@ -1,1639 +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.cxf.jaxrs.provider;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.logging.Logger;
-
-import jakarta.annotation.Priority;
-import jakarta.ws.rs.ConstrainedTo;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.RuntimeType;
-import jakarta.ws.rs.core.Application;
-import jakarta.ws.rs.core.Configuration;
-import jakarta.ws.rs.core.MediaType;
-import jakarta.ws.rs.core.MultivaluedMap;
-import jakarta.ws.rs.ext.ContextResolver;
-import jakarta.ws.rs.ext.ExceptionMapper;
-import jakarta.ws.rs.ext.MessageBodyReader;
-import jakarta.ws.rs.ext.MessageBodyWriter;
-import jakarta.ws.rs.ext.ParamConverter;
-import jakarta.ws.rs.ext.ParamConverterProvider;
-import jakarta.ws.rs.ext.ReaderInterceptor;
-import jakarta.ws.rs.ext.WriterInterceptor;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.common.classloader.ClassLoaderUtils;
-import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.common.util.ClassHelper;
-import org.apache.cxf.common.util.PropertyUtils;
-import org.apache.cxf.endpoint.Endpoint;
-import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.jaxrs.ext.ContextProvider;
-import org.apache.cxf.jaxrs.impl.MetadataMap;
-import org.apache.cxf.jaxrs.impl.ReaderInterceptorMBR;
-import org.apache.cxf.jaxrs.impl.WriterInterceptorMBW;
-import org.apache.cxf.jaxrs.impl.tl.ThreadLocalProxy;
-import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
-import org.apache.cxf.jaxrs.model.ApplicationInfo;
-import org.apache.cxf.jaxrs.model.ClassResourceInfo;
-import org.apache.cxf.jaxrs.model.FilterProviderInfo;
-import org.apache.cxf.jaxrs.model.ProviderInfo;
-import org.apache.cxf.jaxrs.utils.AnnotationUtils;
-import org.apache.cxf.jaxrs.utils.InjectionUtils;
-import org.apache.cxf.jaxrs.utils.JAXRSUtils;
-import org.apache.cxf.jaxrs.utils.ResourceUtils;
-import org.apache.cxf.message.Message;
-import org.apache.cxf.message.MessageUtils;
-
-import static jakarta.ws.rs.Priorities.USER;
-
-public abstract class ProviderFactory {
- public static final String DEFAULT_FILTER_NAME_BINDING = "org.apache.cxf.filter.binding";
- public static final String PROVIDER_SELECTION_PROPERTY_CHANGED = "provider.selection.property.changed";
- public static final String ACTIVE_JAXRS_PROVIDER_KEY = "active.jaxrs.provider";
-
- protected static final String SERVER_FACTORY_NAME = "org.apache.cxf.jaxrs.provider.ServerProviderFactory";
- protected static final String CLIENT_FACTORY_NAME = "org.apache.cxf.jaxrs.client.ClientProviderFactory";
- protected static final String IGNORE_TYPE_VARIABLES = "org.apache.cxf.jaxrs.providers.ignore.typevars";
-
- private static final Logger LOG = LogUtils.getL7dLogger(ProviderFactory.class);
-
- private static final String JAXB_PROVIDER_NAME = "org.apache.cxf.jaxrs.provider.JAXBElementProvider";
- private static final String JSON_PROVIDER_NAME = "org.apache.cxf.jaxrs.provider.json.JSONProvider";
- private static final String BUS_PROVIDERS_ALL = "org.apache.cxf.jaxrs.bus.providers";
- private static final String PROVIDER_CACHE_ALLOWED = "org.apache.cxf.jaxrs.provider.cache.allowed";
- private static final String PROVIDER_CACHE_CHECK_ALL = "org.apache.cxf.jaxrs.provider.cache.checkAllCandidates";
-
-
- static class LazyProviderClass {
- // class to Lazily call the ClassLoaderUtil.loadClass, but do it once
- // and cache the result. Then use the class to create instances as needed.
- // This avoids calling loadClass every time a factory is initialized as
- // calling loadClass is super expensive, particularly if the class
- // cannot be found and particularly in osgi where the search is very complex.
- // This would record that the class is not found and prevent future
- // searches.
- final String className;
- volatile boolean initialized;
- Class<?> cls;
-
- LazyProviderClass(String cn) {
- className = cn;
- }
-
- synchronized void loadClass() {
- if (!initialized) {
- try {
- cls = ClassLoaderUtils.loadClass(className, ProviderFactory.class);
- } catch (final Throwable ex) {
- LOG.fine(className + " not available, skipping");
- }
- initialized = true;
- }
- }
-
- public Object tryCreateInstance(Bus bus) {
- if (!initialized) {
- loadClass();
- }
- if (cls != null) {
- try {
- for (Constructor<?> c : cls.getConstructors()) {
- if (c.getParameterTypes().length == 1 && c.getParameterTypes()[0] == Bus.class) {
- return c.newInstance(bus);
- }
- }
- return cls.newInstance();
- } catch (Throwable ex) {
- String message = "Problem with creating the provider " + className;
- if (ex.getMessage() != null) {
- message += ": " + ex.getMessage();
- } else {
- message += ", exception class : " + ex.getClass().getName();
- }
- LOG.fine(message);
- }
- }
- return null;
- }
- };
-
- private static final LazyProviderClass DATA_SOURCE_PROVIDER_CLASS =
- new LazyProviderClass("org.apache.cxf.jaxrs.provider.DataSourceProvider");
- private static final LazyProviderClass JAXB_PROVIDER_CLASS =
- new LazyProviderClass(JAXB_PROVIDER_NAME);
- private static final LazyProviderClass JAXB_ELEMENT_PROVIDER_CLASS =
- new LazyProviderClass("org.apache.cxf.jaxrs.provider.JAXBElementTypedProvider");
- private static final LazyProviderClass JSONB_PROVIDER_CLASS =
- new LazyProviderClass("org.apache.openejb.server.cxf.rs.johnzon.TomEEJsonbProvider");
- private static final LazyProviderClass JSONP_PROVIDER_CLASS =
- new LazyProviderClass("org.apache.openejb.server.cxf.rs.johnzon.TomEEJsonpProvider");
- private static final LazyProviderClass MULTIPART_PROVIDER_CLASS =
- new LazyProviderClass("org.apache.cxf.jaxrs.provider.MultipartProvider");
-
- protected Map<NameKey, ProviderInfo<ReaderInterceptor>> readerInterceptors =
- new NameKeyMap<>(true);
- protected Map<NameKey, ProviderInfo<WriterInterceptor>> writerInterceptors =
- new NameKeyMap<>(true);
-
- private List<ProviderInfo<MessageBodyReader<?>>> messageReaders =
- new ArrayList<>();
- private List<ProviderInfo<MessageBodyWriter<?>>> messageWriters =
- new ArrayList<>();
- private List<ProviderInfo<ContextResolver<?>>> contextResolvers =
- new ArrayList<>();
- private List<ProviderInfo<ContextProvider<?>>> contextProviders =
- new ArrayList<>();
-
- private List<ProviderInfo<ParamConverterProvider>> paramConverters =
- new ArrayList<>(1);
- private boolean paramConverterContextsAvailable;
- // List of injected providers
- private Collection<ProviderInfo<?>> injectedProviders =
- new HashSet<>();
-
- private Bus bus;
-
- private Comparator<?> providerComparator;
-
- private ProviderCache providerCache;
-
-
- protected ProviderFactory(Bus bus) {
- this.bus = bus;
- providerCache = initCache(bus);
- }
-
- public Bus getBus() {
- return bus;
- }
- protected static ProviderCache initCache(Bus theBus) {
- Object allowProp = theBus.getProperty(PROVIDER_CACHE_ALLOWED);
- boolean allowed = allowProp == null || PropertyUtils.isTrue(allowProp);
- if (!allowed) {
- return null;
- }
- boolean checkAll = PropertyUtils.isTrue(theBus.getProperty(PROVIDER_CACHE_CHECK_ALL));
- return new ProviderCache(checkAll);
- }
- protected static void initFactory(ProviderFactory factory) {
-
- final List<Object> providers = new ArrayList<>();
- providers.add(new BinaryDataProvider<Object>());
- providers.add(new SourceProvider<Object>());
- providers.add(DATA_SOURCE_PROVIDER_CLASS.tryCreateInstance(factory.getBus()));
- providers.add(new FormEncodingProvider<Object>());
- providers.add(new StringTextProvider());
- providers.add(new PrimitiveTextProvider<Object>());
- providers.add(JAXB_PROVIDER_CLASS.tryCreateInstance(factory.getBus()));
- providers.add(JAXB_ELEMENT_PROVIDER_CLASS.tryCreateInstance(factory.getBus()));
- providers.add(MULTIPART_PROVIDER_CLASS.tryCreateInstance(factory.getBus()));
-
- // property set in CxfRsHttpListener
- if (!PropertyUtils.isFalse(factory.getBus().getProperty("org.apache.openejb.server.cxf.rs.johnzon.TomEEJsonpProvider.activated"))) {
- providers.add(JSONP_PROVIDER_CLASS.tryCreateInstance(factory.getBus()));
- }
- if (!PropertyUtils.isFalse(factory.getBus().getProperty("org.apache.openejb.server.cxf.rs.johnzon.TomEEJsonbProvider.activated"))) {
- providers.add(JSONB_PROVIDER_CLASS.tryCreateInstance(factory.getBus()));
- }
-
- // ensure to not load providers not available in a module environment if not needed
- factory.setProviders(false, false, providers.toArray(new Object[0]));
-
- Object prop = factory.getBus().getProperty("skip.default.json.provider.registration");
- if (!PropertyUtils.isTrue(prop)) {
- factory.setProviders(false, false, createProvider(JSON_PROVIDER_NAME, factory.getBus()));
- }
- }
-
- protected static Object createProvider(String className, Bus bus) {
-
- try {
- Class<?> cls = ClassLoaderUtils.loadClass(className, ProviderFactory.class);
- for (Constructor<?> c : cls.getConstructors()) {
- if (c.getParameterTypes().length == 1 && c.getParameterTypes()[0] == Bus.class) {
- return c.newInstance(bus);
- }
- }
- return cls.getDeclaredConstructor().newInstance();
- } catch (Throwable ex) {
- String message = "Problem with creating the default provider " + className;
- if (ex.getMessage() != null) {
- message += ": " + ex.getMessage();
- } else {
- message += ", exception class : " + ex.getClass().getName();
- }
- LOG.fine(message);
- }
- return null;
- }
-
- public abstract Configuration getConfiguration(Message message);
-
- public <T> ContextResolver<T> createContextResolver(Type contextType,
- Message m) {
- boolean isRequestor = MessageUtils.isRequestor(m);
- Message requestMessage = isRequestor ? m.getExchange().getOutMessage()
- : m.getExchange().getInMessage();
-
- Message responseMessage = isRequestor ? m.getExchange().getInMessage()
- : m.getExchange().getOutMessage();
- final Object ctProperty;
- if (responseMessage != null) {
- ctProperty = responseMessage.get(Message.CONTENT_TYPE);
- } else {
- ctProperty = requestMessage.get(Message.CONTENT_TYPE);
- }
- MediaType mt = ctProperty != null ? JAXRSUtils.toMediaType(ctProperty.toString())
- : MediaType.WILDCARD_TYPE;
- return createContextResolver(contextType, m, mt);
-
- }
-
- @SuppressWarnings("unchecked")
- public <T> ContextResolver<T> createContextResolver(Type contextType,
- Message m,
- MediaType type) {
- Class<?> contextCls = InjectionUtils.getActualType(contextType);
- if (contextCls == null) {
- return null;
- }
- List<ContextResolver<T>> candidates = new LinkedList<>();
- for (ProviderInfo<ContextResolver<?>> cr : contextResolvers) {
- Type[] types = cr.getProvider().getClass().getGenericInterfaces();
- for (Type t : types) {
- if (t instanceof ParameterizedType) {
- ParameterizedType pt = (ParameterizedType)t;
- Type[] args = pt.getActualTypeArguments();
- if (args.length > 0) {
- Class<?> argCls = InjectionUtils.getActualType(args[0]);
-
- if (argCls != null && argCls.isAssignableFrom(contextCls)) {
- List<MediaType> mTypes = JAXRSUtils.getProduceTypes(
- cr.getProvider().getClass().getAnnotation(Produces.class));
- if (JAXRSUtils.doMimeTypesIntersect(mTypes, type)) {
- injectContextValues(cr, m);
- candidates.add((ContextResolver<T>)cr.getProvider());
- }
- }
- }
- }
- }
- }
- if (candidates.isEmpty()) {
- return null;
- } else if (candidates.size() == 1) {
- return candidates.get(0);
- } else {
- Collections.sort(candidates, new PriorityBasedClassComparator());
- return new ContextResolverProxy<T>(candidates);
- }
-
- }
-
- @SuppressWarnings("unchecked")
- public <T> ContextProvider<T> createContextProvider(Type contextType,
- Message m) {
- Class<?> contextCls = InjectionUtils.getActualType(contextType);
- if (contextCls == null) {
- return null;
- }
- for (ProviderInfo<ContextProvider<?>> cr : contextProviders) {
- Type[] types = cr.getProvider().getClass().getGenericInterfaces();
- for (Type t : types) {
- if (t instanceof ParameterizedType) {
- ParameterizedType pt = (ParameterizedType)t;
- Type[] args = pt.getActualTypeArguments();
- if (args.length > 0) {
- Class<?> argCls = InjectionUtils.getActualType(args[0]);
-
- if (argCls != null && argCls.isAssignableFrom(contextCls)) {
- return (ContextProvider<T>)cr.getProvider();
- }
- }
- }
- }
- }
- return null;
- }
-
- public <T> ParamConverter<T> createParameterHandler(Class<T> paramType,
- Type genericType,
- Annotation[] anns,
- Message m) {
-
- anns = anns != null ? anns : new Annotation[]{};
- for (ProviderInfo<ParamConverterProvider> pi : paramConverters) {
- injectContextValues(pi, m);
- ParamConverter<T> converter = pi.getProvider().getConverter(paramType, genericType, anns);
- if (converter != null) {
- return converter;
- }
- pi.clearThreadLocalProxies();
- }
- return null;
- }
-
- protected <T> boolean handleMapper(ProviderInfo<T> em,
- Class<?> expectedType,
- Message m,
- Class<?> providerClass,
- boolean injectContext) {
- return handleMapper(em, expectedType, m, providerClass, null, injectContext);
- }
-
- protected <T> boolean handleMapper(ProviderInfo<T> em,
- Class<?> expectedType,
- Message m,
- Class<?> providerClass,
- Class<?> commonBaseClass,
- boolean injectContext) {
-
- Class<?> mapperClass = ClassHelper.getRealClass(bus, em.getProvider());
- Type[] types;
- if (m != null && MessageUtils.getContextualBoolean(m, IGNORE_TYPE_VARIABLES)) {
- types = new Type[]{mapperClass};
- } else {
- types = getGenericInterfaces(mapperClass, expectedType, commonBaseClass);
- }
- for (Type t : types) {
- if (t instanceof ParameterizedType) {
- ParameterizedType pt = (ParameterizedType)t;
- Type[] args = pt.getActualTypeArguments();
- for (Type arg : args) {
- if (arg instanceof TypeVariable) {
- TypeVariable<?> var = (TypeVariable<?>) arg;
- Type[] bounds = var.getBounds();
- boolean isResolved = false;
- for (Type bound : bounds) {
- Class<?> cls = InjectionUtils.getRawType(bound);
- if (cls != null && (cls == Object.class || cls.isAssignableFrom(expectedType))) {
- isResolved = true;
- break;
- }
- }
- if (!isResolved) {
- return false;
- }
- if (injectContext) {
- injectContextValues(em, m);
- }
- return true;
- }
- Class<?> actualClass = InjectionUtils.getRawType(arg);
- if (actualClass == null) {
- continue;
- }
- if (expectedType.isArray() && !actualClass.isArray()) {
- expectedType = expectedType.getComponentType();
- }
- if (actualClass.isAssignableFrom(expectedType) || actualClass == Object.class) {
- if (injectContext) {
- injectContextValues(em, m);
- }
- return true;
- }
- }
- } else if (t instanceof Class && providerClass.isAssignableFrom((Class<?>)t)) {
- if (injectContext) {
- injectContextValues(em, m);
- }
- return true;
- }
- }
- return false;
- }
-
-
- public <T> List<ReaderInterceptor> createMessageBodyReaderInterceptor(Class<T> bodyType,
- Type parameterType,
- Annotation[] parameterAnnotations,
- MediaType mediaType,
- Message m,
- boolean checkMbrNow,
- Set<String> names) {
- MessageBodyReader<T> mr = !checkMbrNow ? null : createMessageBodyReader(bodyType,
- parameterType,
- parameterAnnotations,
- mediaType,
- m);
- int size = readerInterceptors.size();
- if (mr != null || size > 0) {
- ReaderInterceptor mbrReader = new ReaderInterceptorMBR(mr, getResponseMessage(m));
-
- final List<ReaderInterceptor> interceptors;
- if (size > 0) {
- interceptors = new ArrayList<>(size + 1);
- List<ProviderInfo<ReaderInterceptor>> readers =
- getBoundFilters(readerInterceptors, names);
- for (ProviderInfo<ReaderInterceptor> p : readers) {
- injectContextValues(p, m);
- interceptors.add(p.getProvider());
- }
- interceptors.add(mbrReader);
- } else {
- interceptors = Collections.singletonList(mbrReader);
- }
-
- return interceptors;
- }
- return null;
- }
-
- public <T> List<WriterInterceptor> createMessageBodyWriterInterceptor(Class<T> bodyType,
- Type parameterType,
- Annotation[] parameterAnnotations,
- MediaType mediaType,
- Message m,
- Set<String> names) {
- MessageBodyWriter<T> mw = createMessageBodyWriter(bodyType,
- parameterType,
- parameterAnnotations,
- mediaType,
- m);
- int size = writerInterceptors.size();
- if (mw != null || size > 0) {
-
- @SuppressWarnings({
- "unchecked", "rawtypes"
- })
- WriterInterceptor mbwWriter = new WriterInterceptorMBW((MessageBodyWriter)mw, m);
-
- final List<WriterInterceptor> interceptors;
- if (size > 0) {
- interceptors = new ArrayList<>(size + 1);
- List<ProviderInfo<WriterInterceptor>> writers =
- getBoundFilters(writerInterceptors, names);
- for (ProviderInfo<WriterInterceptor> p : writers) {
- injectContextValues(p, m);
- interceptors.add(p.getProvider());
- }
- interceptors.add(mbwWriter);
- } else {
- interceptors = Collections.singletonList(mbwWriter);
- }
-
- return interceptors;
- }
- return null;
- }
-
-
-
- @SuppressWarnings("unchecked")
- public <T> MessageBodyReader<T> createMessageBodyReader(Class<T> type,
- Type genericType,
- Annotation[] annotations,
- MediaType mediaType,
- Message m) {
- // Step1: check the cache
-
- if (providerCache != null) {
- for (ProviderInfo<MessageBodyReader<?>> ep : providerCache.getReaders(type, mediaType)) {
- if (isReadable(ep, type, genericType, annotations, mediaType, m)) {
- return (MessageBodyReader<T>)ep.getProvider();
- }
- }
- }
-
- boolean checkAll = providerCache != null && providerCache.isCheckAllCandidates();
- List<ProviderInfo<MessageBodyReader<?>>> allCandidates =
- checkAll ? new LinkedList<ProviderInfo<MessageBodyReader<?>>>() : null;
-
- MessageBodyReader<T> selectedReader = null;
- for (ProviderInfo<MessageBodyReader<?>> ep : messageReaders) {
- if (matchesReaderMediaTypes(ep, mediaType)
- && handleMapper(ep, type, m, MessageBodyReader.class, false)) {
- // This writer matches Media Type and Class
- if (checkAll) {
- allCandidates.add(ep);
- } else if (providerCache != null && providerCache.getReaders(type, mediaType).isEmpty()) {
- providerCache.putReaders(type, mediaType, Collections.singletonList(ep));
- }
- if (selectedReader == null
- && isReadable(ep, type, genericType, annotations, mediaType, m)) {
- // This writer is a selected candidate
- selectedReader = (MessageBodyReader<T>)ep.getProvider();
- if (!checkAll) {
- return selectedReader;
- }
- }
-
- }
- }
- if (checkAll) {
- providerCache.putReaders(type, mediaType, allCandidates);
- }
- return selectedReader;
- }
-
- @SuppressWarnings("unchecked")
- public <T> MessageBodyWriter<T> createMessageBodyWriter(Class<T> type,
- Type genericType,
- Annotation[] annotations,
- MediaType mediaType,
- Message m) {
-
- // Step1: check the cache.
- if (providerCache != null) {
- for (ProviderInfo<MessageBodyWriter<?>> ep : providerCache.getWriters(type, mediaType)) {
- if (isWriteable(ep, type, genericType, annotations, mediaType, m)) {
- return (MessageBodyWriter<T>)ep.getProvider();
- }
- }
- }
-
- // Step2: check all the registered writers
-
- // The cache, if enabled, may have been configured to keep the top candidate only
- boolean checkAll = providerCache != null && providerCache.isCheckAllCandidates();
- List<ProviderInfo<MessageBodyWriter<?>>> allCandidates =
- checkAll ? new LinkedList<ProviderInfo<MessageBodyWriter<?>>>() : null;
-
- MessageBodyWriter<T> selectedWriter = null;
- for (ProviderInfo<MessageBodyWriter<?>> ep : messageWriters) {
- if (matchesWriterMediaTypes(ep, mediaType)
- && handleMapper(ep, type, m, MessageBodyWriter.class, false)) {
- // This writer matches Media Type and Class
- if (checkAll) {
- allCandidates.add(ep);
- } else if (providerCache != null && providerCache.getWriters(type, mediaType).isEmpty()) {
- providerCache.putWriters(type, mediaType, Collections.singletonList(ep));
- }
- if (selectedWriter == null
- && isWriteable(ep, type, genericType, annotations, mediaType, m)) {
- // This writer is a selected candidate
- selectedWriter = (MessageBodyWriter<T>)ep.getProvider();
- if (!checkAll) {
- return selectedWriter;
- }
- }
-
- }
- }
- if (checkAll) {
- providerCache.putWriters(type, mediaType, allCandidates);
- }
- return selectedWriter;
-
- }
-
- protected void setBusProviders() {
- List<Object> extensions = new LinkedList<>();
- addBusExtension(extensions,
- MessageBodyReader.class,
- MessageBodyWriter.class,
- ExceptionMapper.class);
- if (!extensions.isEmpty()) {
- setProviders(true, true, extensions.toArray());
- }
- }
-
-
- private void addBusExtension(List<Object> extensions, Class<?>... extClasses) {
- for (Class<?> extClass : extClasses) {
- Object ext = bus.getProperty(extClass.getName());
- if (extClass.isInstance(ext)) {
- extensions.add(ext);
- }
- }
- Object allProp = bus.getProperty(BUS_PROVIDERS_ALL);
- if (allProp instanceof List) {
- @SuppressWarnings("unchecked")
- List<Object> all = (List<Object>)allProp;
- extensions.addAll(all);
- }
- }
-
- protected abstract void setProviders(boolean custom, boolean busGlobal, Object... providers);
-
- @SuppressWarnings("unchecked")
- protected void setCommonProviders(List<ProviderInfo<? extends Object>> theProviders, RuntimeType type) {
- List<ProviderInfo<ReaderInterceptor>> readInts =
- new LinkedList<>();
- List<ProviderInfo<WriterInterceptor>> writeInts =
- new LinkedList<>();
- for (ProviderInfo<? extends Object> provider : theProviders) {
- Class<?> providerCls = ClassHelper.getRealClass(bus, provider.getProvider());
-
- // Check if provider is constrained to runtime type
- if (!constrainedTo(providerCls, type)) {
- continue;
- }
-
- if (filterContractSupported(provider, providerCls, MessageBodyReader.class)) {
- addProviderToList(messageReaders, provider);
- }
-
- if (filterContractSupported(provider, providerCls, MessageBodyWriter.class)) {
- addProviderToList(messageWriters, provider);
- }
-
- if (filterContractSupported(provider, providerCls, ContextResolver.class)) {
- addProviderToList(contextResolvers, provider);
- }
-
- if (ContextProvider.class.isAssignableFrom(providerCls)) {
- addProviderToList(contextProviders, provider);
- }
-
- if (filterContractSupported(provider, providerCls, ReaderInterceptor.class)) {
- readInts.add((ProviderInfo<ReaderInterceptor>)provider);
- }
-
- if (filterContractSupported(provider, providerCls, WriterInterceptor.class)) {
- writeInts.add((ProviderInfo<WriterInterceptor>)provider);
- }
-
- if (filterContractSupported(provider, providerCls, ParamConverterProvider.class)) {
- paramConverters.add((ProviderInfo<ParamConverterProvider>)provider);
- }
- }
- sortReaders();
- sortWriters();
- sortContextResolvers();
- sortParamConverterProviders();
-
- mapInterceptorFilters(readerInterceptors, readInts, ReaderInterceptor.class, true);
- mapInterceptorFilters(writerInterceptors, writeInts, WriterInterceptor.class, true);
-
- injectContextProxies(messageReaders, messageWriters, contextResolvers, paramConverters,
- readerInterceptors.values(), writerInterceptors.values());
- checkParamConverterContexts();
- }
-
- private void checkParamConverterContexts() {
- for (ProviderInfo<ParamConverterProvider> pi : paramConverters) {
- if (pi.contextsAvailable()) {
- paramConverterContextsAvailable = true;
- }
- }
-
- }
- public boolean isParamConverterContextsAvailable() {
- return paramConverterContextsAvailable;
- }
-
-
-
- protected void injectContextValues(ProviderInfo<?> pi, Message m) {
- if (m != null) {
- InjectionUtils.injectContexts(pi.getProvider(), pi, m);
- }
- }
-
- protected void addProviderToList(List<?> list, ProviderInfo<?> provider) {
- List<ProviderInfo<?>> list2 = CastUtils.cast(list);
- for (ProviderInfo<?> pi : list2) {
- if (pi.getProvider() == provider.getProvider()) {
- return;
- }
- }
- list2.add(provider);
- }
-
- protected void injectContextProxies(Collection<?> ... providerLists) {
- for (Collection<?> list : providerLists) {
- Collection<ProviderInfo<?>> l2 = CastUtils.cast(list);
- for (ProviderInfo<?> pi : l2) {
- injectContextProxiesIntoProvider(pi);
- }
- }
- }
-
- protected void injectContextProxiesIntoProvider(ProviderInfo<?> pi) {
- injectContextProxiesIntoProvider(pi, null);
- }
-
- void injectContextProxiesIntoProvider(ProviderInfo<?> pi, Application app) {
- if (pi.contextsAvailable()) {
- InjectionUtils.injectContextProxiesAndApplication(pi, pi.getProvider(), app, this);
- injectedProviders.add(pi);
- }
- }
-
- /*
- * sorts the available providers according to the media types they declare
- * support for. Sorting of media types follows the general rule: x/y < * x < *,
- * i.e. a provider that explicitly lists a media types is sorted before a
- * provider that lists *. Quality parameter values are also used such that
- * x/y;q=1.0 < x/y;q=0.7.
- */
- private void sortReaders() {
- if (!customComparatorAvailable(MessageBodyReader.class)) {
- messageReaders.sort(new MessageBodyReaderComparator());
- } else {
- doCustomSort(messageReaders);
- }
- }
- private <T> void sortWriters() {
- if (!customComparatorAvailable(MessageBodyWriter.class)) {
- messageWriters.sort(new MessageBodyWriterComparator());
- } else {
- doCustomSort(messageWriters);
- }
- }
-
- private <T> void sortParamConverterProviders() {
- if (!customComparatorAvailable(ParamConverterProvider.class)) {
- paramConverters.sort(new ParamConverterProviderComparator(bus));
- } else {
- doCustomSort(paramConverters);
- }
- }
-
- private boolean customComparatorAvailable(Class<?> providerClass) {
- if (providerComparator != null) {
- Type type = ((ParameterizedType)providerComparator.getClass()
- .getGenericInterfaces()[0]).getActualTypeArguments()[0];
- if (type instanceof ParameterizedType) {
- ParameterizedType pt = (ParameterizedType)type;
- if (pt.getRawType() == ProviderInfo.class) {
- Type type2 = pt.getActualTypeArguments()[0];
- if (type2 == providerClass
- || type2 instanceof WildcardType
- || type2 instanceof ParameterizedType
- && ((ParameterizedType)type2).getRawType() == providerClass) {
- return true;
- }
- }
- } else if (type == Object.class) {
- return true;
- }
- }
- return false;
- }
-
- @SuppressWarnings("unchecked")
- private <T> void doCustomSort(List<?> listOfProviders) {
- Comparator<?> theProviderComparator = providerComparator;
- Type type = ((ParameterizedType)providerComparator.getClass()
- .getGenericInterfaces()[0]).getActualTypeArguments()[0];
- if (type == Object.class) {
- theProviderComparator =
- new ProviderInfoClassComparator((Comparator<Object>)theProviderComparator);
- }
- List<T> theProviders = (List<T>)listOfProviders;
- Comparator<? super T> theComparator = (Comparator<? super T>)theProviderComparator;
- theProviders.sort(theComparator);
- }
-
- private void sortContextResolvers() {
- contextResolvers.sort(new ContextResolverComparator());
- }
-
-
-
-
-
- private <T> boolean matchesReaderMediaTypes(ProviderInfo<MessageBodyReader<?>> pi,
- MediaType mediaType) {
- MessageBodyReader<?> ep = pi.getProvider();
- List<MediaType> supportedMediaTypes = JAXRSUtils.getProviderConsumeTypes(ep);
-
- return JAXRSUtils.doMimeTypesIntersect(Collections.singletonList(mediaType), supportedMediaTypes);
- }
-
- private boolean isReadable(ProviderInfo<MessageBodyReader<?>> pi,
- Class<?> type,
- Type genericType,
- Annotation[] annotations,
- MediaType mediaType,
- Message m) {
- MessageBodyReader<?> ep = pi.getProvider();
- if (m.get(ACTIVE_JAXRS_PROVIDER_KEY) != ep) {
- injectContextValues(pi, m);
- }
- return ep.isReadable(type, genericType, annotations, mediaType);
- }
-
- private <T> boolean matchesWriterMediaTypes(ProviderInfo<MessageBodyWriter<?>> pi,
- MediaType mediaType) {
- MessageBodyWriter<?> ep = pi.getProvider();
- List<MediaType> supportedMediaTypes = JAXRSUtils.getProviderProduceTypes(ep);
-
- return JAXRSUtils.doMimeTypesIntersect(Collections.singletonList(mediaType), supportedMediaTypes);
- }
-
- private boolean isWriteable(ProviderInfo<MessageBodyWriter<?>> pi,
- Class<?> type,
- Type genericType,
- Annotation[] annotations,
- MediaType mediaType,
- Message m) {
- MessageBodyWriter<?> ep = pi.getProvider();
- if (m.get(ACTIVE_JAXRS_PROVIDER_KEY) != ep) {
- injectContextValues(pi, m);
- }
- return ep.isWriteable(type, genericType, annotations, mediaType);
- }
-
- List<ProviderInfo<MessageBodyReader<?>>> getMessageReaders() {
- return Collections.unmodifiableList(messageReaders);
- }
-
- List<ProviderInfo<MessageBodyWriter<?>>> getMessageWriters() {
- return Collections.unmodifiableList(messageWriters);
- }
-
- public List<ProviderInfo<ContextResolver<?>>> getContextResolvers() {
- return Collections.unmodifiableList(contextResolvers);
- }
-
-
- public void registerUserProvider(Object provider) {
- setUserProviders(Collections.singletonList(provider));
- }
- /**
- * Use for injection of entityProviders
- * @param userProviders the userProviders to set
- */
- public void setUserProviders(List<?> userProviders) {
- setProviders(true, false, userProviders.toArray());
- }
-
- private static class MessageBodyReaderComparator
- implements Comparator<ProviderInfo<MessageBodyReader<?>>> {
-
- private final GenericArgumentComparator classComparator =
- new GenericArgumentComparator(MessageBodyReader.class);
-
- public int compare(ProviderInfo<MessageBodyReader<?>> p1,
- ProviderInfo<MessageBodyReader<?>> p2) {
- MessageBodyReader<?> e1 = p1.getProvider();
- MessageBodyReader<?> e2 = p2.getProvider();
-
- List<MediaType> types1 = JAXRSUtils.getProviderConsumeTypes(e1);
- types1 = JAXRSUtils.sortMediaTypes(types1, null);
- List<MediaType> types2 = JAXRSUtils.getProviderConsumeTypes(e2);
- types2 = JAXRSUtils.sortMediaTypes(types2, null);
-
- int result = JAXRSUtils.compareSortedMediaTypes(types1, types2, null);
- if (result != 0) {
- return result;
- }
-
- final Class<?> class1 = ClassHelper.getRealClass(e1);
- final Class<?> class2 = ClassHelper.getRealClass(e2);
- result = classComparator.compare(class1, class2);
- if (result != 0) {
- return result;
- }
- result = compareCustomStatus(p1, p2);
- if (result != 0) {
- return result;
- }
-
- result = comparePriorityStatus(p1.getProvider().getClass(), p2.getProvider().getClass());
- if (result != 0) {
- return result;
- }
-
- return p1.getProvider().getClass().getName().compareTo(p2.getProvider().getClass().getName());
- }
- }
-
- private static class MessageBodyWriterComparator
- implements Comparator<ProviderInfo<MessageBodyWriter<?>>> {
-
- private final GenericArgumentComparator classComparator =
- new GenericArgumentComparator(MessageBodyWriter.class);
-
- public int compare(ProviderInfo<MessageBodyWriter<?>> p1,
- ProviderInfo<MessageBodyWriter<?>> p2) {
- MessageBodyWriter<?> e1 = p1.getProvider();
- MessageBodyWriter<?> e2 = p2.getProvider();
-
- final Class<?> class1 = ClassHelper.getRealClass(e1);
- final Class<?> class2 = ClassHelper.getRealClass(e2);
- int result = classComparator.compare(class1, class2);
- if (result != 0) {
- return result;
- }
- List<MediaType> types1 =
- JAXRSUtils.sortMediaTypes(JAXRSUtils.getProviderProduceTypes(e1), JAXRSUtils.MEDIA_TYPE_QS_PARAM);
- List<MediaType> types2 =
- JAXRSUtils.sortMediaTypes(JAXRSUtils.getProviderProduceTypes(e2), JAXRSUtils.MEDIA_TYPE_QS_PARAM);
-
- result = JAXRSUtils.compareSortedMediaTypes(types1, types2, JAXRSUtils.MEDIA_TYPE_QS_PARAM);
- if (result != 0) {
- return result;
- }
-
- result = compareCustomStatus(p1, p2);
- if (result != 0) {
- return result;
- }
-
- result = comparePriorityStatus(p1.getProvider().getClass(), p2.getProvider().getClass());
- if (result != 0) {
- return result;
- }
-
- return p1.getProvider().getClass().getName().compareTo(p2.getProvider().getClass().getName());
- }
- }
-
- private static class ParamConverterProviderComparator implements Comparator<ProviderInfo<ParamConverterProvider>> {
- private final Bus bus;
-
- ParamConverterProviderComparator(Bus bus) {
- this.bus = bus;
- }
-
- @Override
- public int compare(ProviderInfo<ParamConverterProvider> p1, ProviderInfo<ParamConverterProvider> p2) {
- final int result = compareCustomStatus(p1, p2);
- if (result != 0) {
- return result;
- }
-
- final Class<?> cl1 = ClassHelper.getRealClass(bus, p1.getProvider());
- final Class<?> cl2 = ClassHelper.getRealClass(bus, p2.getProvider());
-
- return comparePriorityStatus(cl1, cl2);
- }
- }
-
- protected static int compareCustomStatus(ProviderInfo<?> p1, ProviderInfo<?> p2) {
- boolean custom1 = p1.isCustom();
- int result = Boolean.compare(p2.isCustom(), custom1);
- if (result == 0 && custom1) {
- result = Boolean.compare(p1.isBusGlobal(), p2.isBusGlobal());
- }
- return result;
- }
-
- static int comparePriorityStatus(Class<?> cl1, Class<?> cl2) {
- return Integer.compare(AnnotationUtils.getBindingPriority(cl1), AnnotationUtils.getBindingPriority(cl2));
- }
-
- private static class ContextResolverComparator
- implements Comparator<ProviderInfo<ContextResolver<?>>> {
-
- public int compare(ProviderInfo<ContextResolver<?>> p1,
- ProviderInfo<ContextResolver<?>> p2) {
- ContextResolver<?> e1 = p1.getProvider();
- ContextResolver<?> e2 = p2.getProvider();
-
- List<MediaType> types1 =
- JAXRSUtils.sortMediaTypes(JAXRSUtils.getProduceTypes(
- e1.getClass().getAnnotation(Produces.class)), JAXRSUtils.MEDIA_TYPE_QS_PARAM);
- List<MediaType> types2 =
- JAXRSUtils.sortMediaTypes(JAXRSUtils.getProduceTypes(
- e2.getClass().getAnnotation(Produces.class)), JAXRSUtils.MEDIA_TYPE_QS_PARAM);
-
- return JAXRSUtils.compareSortedMediaTypes(types1, types2, JAXRSUtils.MEDIA_TYPE_QS_PARAM);
- }
- }
-
- public void clearThreadLocalProxies() {
- clearProxies(injectedProviders);
- }
-
- void clearProxies(Collection<?> ...lists) {
- for (Collection<?> list : lists) {
- Collection<ProviderInfo<?>> l2 = CastUtils.cast(list);
- for (ProviderInfo<?> pi : l2) {
- pi.clearThreadLocalProxies();
- }
- }
- }
-
- public void clearProviders() {
- messageReaders.clear();
- messageWriters.clear();
- contextResolvers.clear();
- contextProviders.clear();
- readerInterceptors.clear();
- writerInterceptors.clear();
- paramConverters.clear();
- }
-
- public void setBus(Bus bus) {
- if (bus == null) {
- return;
- }
- for (ProviderInfo<MessageBodyReader<?>> r : messageReaders) {
- injectProviderProperty(r.getProvider(), "setBus", Bus.class, bus);
- }
- }
-
- private boolean injectProviderProperty(Object provider, String mName, Class<?> pClass,
- Object pValue) {
- try {
- Method m = provider.getClass().getMethod(mName, new Class[]{pClass});
- m.invoke(provider, new Object[]{pValue});
- return true;
- } catch (Exception ex) {
- // ignore
- }
- return false;
- }
-
- public void setSchemaLocations(List<String> schemas) {
- for (ProviderInfo<MessageBodyReader<?>> r : messageReaders) {
- injectProviderProperty(r.getProvider(), "setSchemaLocations", List.class, schemas);
- }
- }
-
- protected static <T> List<ProviderInfo<T>> getBoundFilters(Map<NameKey, ProviderInfo<T>> boundFilters,
- Set<String> names) {
- if (boundFilters.isEmpty()) {
- return Collections.emptyList();
- }
- names = names == null ? Collections.<String>emptySet() : names;
-
- MultivaluedMap<ProviderInfo<T>, String> map =
- new MetadataMap<>();
- for (Map.Entry<NameKey, ProviderInfo<T>> entry : boundFilters.entrySet()) {
- String entryName = entry.getKey().getName();
- ProviderInfo<T> provider = entry.getValue();
- if (entryName.equals(DEFAULT_FILTER_NAME_BINDING)) {
- map.put(provider, Collections.<String>emptyList());
- } else {
- if (provider instanceof FilterProviderInfo) {
- FilterProviderInfo<?> fpi = (FilterProviderInfo<?>)provider;
- if (fpi.isDynamic() && !names.containsAll(fpi.getNameBindings())) {
- continue;
- }
- }
- map.add(provider, entryName);
- }
- }
- List<ProviderInfo<T>> list = new LinkedList<>();
- for (Map.Entry<ProviderInfo<T>, List<String>> entry : map.entrySet()) {
- List<String> values = entry.getValue();
- if (names.containsAll(values)) {
- ProviderInfo<T> provider = entry.getKey();
- list.add(provider);
- }
- }
- return list;
- }
-
- public void initProviders(List<ClassResourceInfo> cris) {
- Set<Object> set = getReadersWriters();
- for (Object o : set) {
- Object provider = ((ProviderInfo<?>)o).getProvider();
- if (provider instanceof AbstractConfigurableProvider) {
- ((AbstractConfigurableProvider)provider).init(cris);
- }
- }
- }
-
- Set<Object> getReadersWriters() {
- Set<Object> set = new HashSet<>();
- set.addAll(messageReaders);
- set.addAll(messageWriters);
- return set;
- }
-
- public static class ClassComparator implements
- Comparator<Object> {
- private Class<?> expectedCls;
- public ClassComparator() {
- }
- public ClassComparator(Class<?> expectedCls) {
- this.expectedCls = expectedCls;
- }
-
- public int compare(Object em1, Object em2) {
- return compareClasses(expectedCls, em1, em2);
- }
- }
-
- public static class ProviderInfoClassComparator implements Comparator<ProviderInfo<?>> {
- private Comparator<Object> comp;
- private boolean defaultComp;
- public ProviderInfoClassComparator(Class<?> expectedCls) {
- this.comp = new ClassComparator(expectedCls);
- this.defaultComp = true;
- }
- public ProviderInfoClassComparator(Comparator<Object> comp) {
- this.comp = comp;
- }
- public int compare(ProviderInfo<?> p1, ProviderInfo<?> p2) {
- int result = comp.compare(p1.getProvider(), p2.getProvider());
- if (result == 0 && defaultComp) {
- result = compareCustomStatus(p1, p2);
- }
- return result;
- }
- }
-
- static class PriorityBasedClassComparator extends ClassComparator {
- PriorityBasedClassComparator() {
- super();
- }
-
- PriorityBasedClassComparator(Class<?> expectedCls) {
- super(expectedCls);
- }
-
- @Override
- public int compare(Object em1, Object em2) {
- int result = super.compare(em1, em2);
- if (result == 0) {
- result = comparePriorityStatus(em1.getClass(), em2.getClass());
- }
- return result;
- }
- }
-
- public static ProviderFactory getInstance(Message m) {
- Endpoint e = m.getExchange().getEndpoint();
-
- Message outM = m.getExchange().getOutMessage();
- boolean isClient = outM != null && MessageUtils.isRequestor(outM);
- String name = isClient ? CLIENT_FACTORY_NAME : SERVER_FACTORY_NAME;
-
- return (ProviderFactory)e.get(name);
- }
- protected static int compareClasses(Object o1, Object o2) {
- return compareClasses(null, o1, o2);
- }
- protected static int compareClasses(Class<?> expectedCls, Object o1, Object o2) {
- Class<?> cl1 = ClassHelper.getRealClass(o1);
- Class<?> cl2 = ClassHelper.getRealClass(o2);
- Type[] types1 = getGenericInterfaces(cl1, expectedCls);
- Type[] types2 = getGenericInterfaces(cl2, expectedCls);
- if (types1.length == 0 && types2.length == 0) {
- return 0;
- } else if (types1.length == 0 && types2.length > 0) {
- return 1;
- } else if (types1.length > 0 && types2.length == 0) {
- return -1;
- }
-
- Class<?> realClass1 = InjectionUtils.getActualType(types1[0]);
- Class<?> realClass2 = InjectionUtils.getActualType(types2[0]);
- if (realClass1 == realClass2) {
- return 0;
- }
- if (realClass1.isAssignableFrom(realClass2)) {
- // subclass should go first
- return 1;
- } else if (realClass2.isAssignableFrom(realClass1)) {
- // superclass should go last
- return -1;
- }
-
- // there is no relation between the types returned by the providers
- return 0;
- }
-
- private static Type[] getGenericInterfaces(Class<?> cls, Class<?> expectedClass) {
- return getGenericInterfaces(cls, expectedClass, Object.class);
- }
- private static Type[] getGenericInterfaces(Class<?> cls, Class<?> expectedClass,
- Class<?> commonBaseCls) {
- if (Object.class == cls) {
- return new Type[]{};
- }
- if (expectedClass != null) {
- Type genericSuperType = cls.getGenericSuperclass();
- if (genericSuperType instanceof ParameterizedType) {
- Class<?> actualType = InjectionUtils.getActualType(genericSuperType);
- if (actualType != null && actualType.isAssignableFrom(expectedClass)) {
- return new Type[]{genericSuperType};
- } else if (commonBaseCls != null && commonBaseCls != Object.class
- && commonBaseCls.isAssignableFrom(expectedClass)
- && commonBaseCls.isAssignableFrom(actualType)
- || expectedClass.isAssignableFrom(actualType)) {
- return new Type[]{};
- }
- }
- }
- Type[] types = cls.getGenericInterfaces();
- if (types.length > 0) {
- return types;
- }
- return getGenericInterfaces(cls.getSuperclass(), expectedClass, commonBaseCls);
- }
-
- protected static class AbstractPriorityComparator {
-
- private boolean ascending;
-
- protected AbstractPriorityComparator(boolean ascending) {
- this.ascending = ascending;
- }
-
- protected int compare(Integer b1Value, Integer b2Value) {
- int result = b1Value.compareTo(b2Value);
- return ascending ? result : result * -1;
- }
-
- }
-
- protected static class BindingPriorityComparator extends AbstractPriorityComparator
- implements Comparator<ProviderInfo<?>> {
- private Class<?> providerCls;
-
- public BindingPriorityComparator(Class<?> providerCls, boolean ascending) {
- super(ascending);
- this.providerCls = providerCls;
- }
-
- public int compare(ProviderInfo<?> p1, ProviderInfo<?> p2) {
- return compare(getFilterPriority(p1, providerCls),
- getFilterPriority(p2, providerCls));
- }
-
- }
-
- static class ContextResolverProxy<T> implements ContextResolver<T> {
- private List<ContextResolver<T>> candidates;
- ContextResolverProxy(List<ContextResolver<T>> candidates) {
- this.candidates = candidates;
- }
- public T getContext(Class<?> cls) {
- for (ContextResolver<T> resolver : candidates) {
- T context = resolver.getContext(cls);
- if (context != null) {
- return context;
- }
- }
- return null;
- }
-
- public List<ContextResolver<T>> getResolvers() {
- return candidates;
- }
- }
-
- public static ProviderInfo<? extends Object> createProviderFromConstructor(Constructor<?> c,
- Map<Class<?>, Object> values,
- Bus theBus,
- boolean checkContexts,
- boolean custom) {
-
-
- Map<Class<?>, Map<Class<?>, ThreadLocalProxy<?>>> proxiesMap =
- CastUtils.cast((Map<?, ?>)theBus.getProperty(AbstractResourceInfo.CONSTRUCTOR_PROXY_MAP));
- Map<Class<?>, ThreadLocalProxy<?>> existingProxies = null;
- if (proxiesMap != null) {
- existingProxies = proxiesMap.get(c.getDeclaringClass());
- }
- Class<?>[] paramTypes = c.getParameterTypes();
- Object[] cArgs = ResourceUtils.createConstructorArguments(c, null, false, values);
- if (existingProxies != null && existingProxies.size() <= paramTypes.length) {
- for (int i = 0; i < paramTypes.length; i++) {
- if (cArgs[i] instanceof ThreadLocalProxy) {
- cArgs[i] = existingProxies.get(paramTypes[i]);
- }
- }
- }
- final Object instance;
- try {
- instance = c.newInstance(cArgs);
- } catch (Throwable ex) {
- throw new RuntimeException("Resource or provider class " + c.getDeclaringClass().getName()
- + " can not be instantiated", ex);
- }
- Map<Class<?>, ThreadLocalProxy<?>> proxies =
- new LinkedHashMap<>();
- for (int i = 0; i < paramTypes.length; i++) {
- if (cArgs[i] instanceof ThreadLocalProxy) {
- @SuppressWarnings("unchecked")
- ThreadLocalProxy<Object> proxy = (ThreadLocalProxy<Object>)cArgs[i];
- proxies.put(paramTypes[i], proxy);
- }
- }
- boolean isApplication = Application.class.isAssignableFrom(c.getDeclaringClass());
- if (isApplication) {
- return new ApplicationInfo((Application)instance, proxies, theBus);
- }
- return new ProviderInfo<Object>(instance, proxies, theBus, checkContexts, custom);
- }
-
- private Message getResponseMessage(Message message) {
- Message responseMessage = message.getExchange().getInMessage();
- if (responseMessage == null) {
- responseMessage = message.getExchange().getInFaultMessage();
- }
-
- return responseMessage;
- }
-
- protected static class NameKey {
- private String name;
- private Integer priority;
- private Class<?> providerCls;
- private ProviderInfo<?> providerInfo;
-
- public NameKey(String name,
- int priority,
- Class<?> providerCls) {
-
- this(name, priority, providerCls, null);
- }
-
- public NameKey(String name,
- int priority,
- Class<?> providerCls,
- ProviderInfo<?> provider) {
-
- this.name = name;
- this.priority = priority;
- this.providerCls = providerCls;
- this.providerInfo = provider;
- }
-
- public String getName() {
- return name;
- }
-
- public Integer getPriority() {
- return priority;
- }
-
- public ProviderInfo<?> getProviderInfo() {
- return providerInfo;
- }
-
- public boolean equals(Object o) {
- if (!(o instanceof NameKey)) {
- return false;
- }
- NameKey other = (NameKey)o;
- return name.equals(other.name) && priority.equals(other.priority)
- && providerCls == other.providerCls;
- }
-
- public int hashCode() {
- return super.hashCode();
- }
-
- public String toString() {
- return name + ":" + priority;
- }
- }
-
- protected static <T> void mapInterceptorFilters(Map<NameKey, ProviderInfo<T>> map,
- List<ProviderInfo<T>> filters,
- Class<?> providerCls,
- boolean ascending) {
-
- for (ProviderInfo<T> p : filters) {
- Set<String> names = getFilterNameBindings(p);
-
- int priority = getFilterPriority(p, providerCls);
-
- for (String name : names) {
- map.put(new NameKey(name, priority, p.getClass(), p), p);
- }
- }
-
- }
-
- protected static Set<String> getFilterNameBindings(ProviderInfo<?> p) {
- if (p instanceof FilterProviderInfo) {
- return ((FilterProviderInfo<?>)p).getNameBindings();
- } else {
- return getFilterNameBindings(p.getBus(), p.getProvider());
- }
-
- }
- protected static Set<String> getFilterNameBindings(Bus bus, Object provider) {
- Set<String> names = AnnotationUtils.getInstanceNameBindings(bus, provider);
- if (names.isEmpty()) {
- names = Collections.singleton(DEFAULT_FILTER_NAME_BINDING);
- }
- return names;
- }
-
- protected static int getFilterPriority(ProviderInfo<?> p, Class<?> providerCls) {
- return p instanceof FilterProviderInfo ? ((FilterProviderInfo<?>)p).getPriority(providerCls)
- : AnnotationUtils.getBindingPriority(p.getProvider().getClass());
- }
-
- protected static class NameKeyComparator extends AbstractPriorityComparator
- implements Comparator<NameKey> {
-
- private final Comparator<ProviderInfo<?>> comparator;
-
- public NameKeyComparator(boolean ascending) {
- this(null, ascending);
- }
-
- public NameKeyComparator(
- Comparator<ProviderInfo<?>> comparator, boolean ascending) {
-
- super(ascending);
- this.comparator = comparator;
- }
-
- @Override
- public int compare(NameKey key1, NameKey key2) {
- int result = compare(key1.getPriority(), key2.getPriority());
- if (result != 0) {
- return result;
- }
-
- if (comparator != null) {
- result = comparator.compare(
- key1.getProviderInfo(), key2.getProviderInfo());
-
- if (result != 0) {
- return result;
- }
- }
-
- return compare(key1.hashCode(), key2.hashCode());
- }
- }
-
- protected static class NameKeyMap<T> extends TreeMap<NameKey, T> {
- private static final long serialVersionUID = -4352258671270502204L;
-
- public NameKeyMap(
- Comparator<ProviderInfo<?>> comparator, boolean ascending) {
-
- super(new NameKeyComparator(comparator, ascending));
- }
-
- public NameKeyMap(boolean ascending) {
- super(new NameKeyComparator(ascending));
- }
- }
-
- protected static boolean filterContractSupported(ProviderInfo<?> provider,
- Class<?> providerCls,
- Class<?> contract) {
- boolean result = false;
- if (contract.isAssignableFrom(providerCls)) {
- Set<Class<?>> actualContracts = null;
- if (provider instanceof FilterProviderInfo) {
- actualContracts = ((FilterProviderInfo<?>)provider).getSupportedContracts();
- }
- if (actualContracts != null) {
- result = actualContracts.contains(contract);
- } else {
- result = true;
- }
- }
- return result;
- }
-
- protected List<ProviderInfo<? extends Object>> prepareProviders(boolean custom,
- boolean busGlobal,
- Object[] providers,
- ProviderInfo<Application> application) {
- List<ProviderInfo<? extends Object>> theProviders =
- new ArrayList<>(providers.length);
- for (Object o : providers) {
- if (o == null) {
- continue;
- }
- Object provider = o;
- if (provider.getClass() == Class.class) {
- provider = ResourceUtils.createProviderInstance((Class<?>)provider);
- }
- if (provider instanceof Constructor) {
- Map<Class<?>, Object> values = CastUtils.cast(application == null ? null
- : Collections.singletonMap(Application.class, application.getProvider()));
- theProviders.add(
- createProviderFromConstructor((Constructor<?>)provider, values, getBus(), true, custom));
- } else if (provider instanceof ProviderInfo) {
- theProviders.add((ProviderInfo<?>)provider);
- } else {
- ProviderInfo<Object> theProvider = new ProviderInfo<>(provider, getBus(), custom);
- theProvider.setBusGlobal(busGlobal);
- theProviders.add(theProvider);
- }
- }
- return theProviders;
- }
-
- public MessageBodyWriter<?> getDefaultJaxbWriter() {
- for (ProviderInfo<MessageBodyWriter<?>> pi : this.messageWriters) {
- Class<?> cls = pi.getProvider().getClass();
- if (cls.getName().equals(JAXB_PROVIDER_NAME)) {
- return pi.getProvider();
- }
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public void setProviderComparator(Comparator<?> providerComparator) {
- this.providerComparator = providerComparator;
-
- sortReaders();
- sortWriters();
-
- NameKeyMap<ProviderInfo<ReaderInterceptor>> sortedReaderInterceptors =
- new NameKeyMap<>(
- (Comparator<ProviderInfo<?>>) providerComparator, true);
- sortedReaderInterceptors.putAll(readerInterceptors);
- NameKeyMap<ProviderInfo<WriterInterceptor>> sortedWriterInterceptors =
- new NameKeyMap<>(
- (Comparator<ProviderInfo<?>>) providerComparator, true);
- sortedWriterInterceptors.putAll(writerInterceptors);
-
- readerInterceptors = sortedReaderInterceptors;
- writerInterceptors = sortedWriterInterceptors;
- }
-
- protected static class ParamConverterComparator implements Comparator<ProviderInfo<ParamConverterProvider>> {
-
- @Override
- public int compare(final ProviderInfo<ParamConverterProvider> a,
- final ProviderInfo<ParamConverterProvider> b) {
-
- /*
- * Primary sort. Also takes care of sorting custom
- * converters from system converters due to priority
- * defaults
- */
- int result = sortByPriority(a, b);
-
- /*
- * Secondary sort as this list *will* change order
- * once in a while between jvm restarts, which can
- * have frustrating consequences for users who are
- * expecting no change in behavior as they aren't
- * changing their code.
- */
- if (result == 0) {
- result = sortByClassName(a, b);
- }
-
- return result;
- }
-
- public int sortByPriority(final ProviderInfo<ParamConverterProvider> a,
- final ProviderInfo<ParamConverterProvider> b) {
- final int aPriority = getPriority(a);
- final int bPriority = getPriority(b);
-
- // Sort ascending as the priority with the lowest number wins
- return Integer.compare(aPriority, bPriority);
- }
-
- public int sortByClassName(final ProviderInfo<ParamConverterProvider> a,
- final ProviderInfo<ParamConverterProvider> b) {
-
- // Sort ascending as the priority with the lowest number wins
- return a.getProvider().getClass().getName().compareTo(b.getProvider().getClass().getName());
- }
-
- private int getPriority(final ProviderInfo<ParamConverterProvider> providerInfo) {
- final Priority priority = providerInfo.getProvider().getClass().getAnnotation(Priority.class);
- if (priority!=null) {
- return priority.value();
- }
- return providerInfo.isCustom() ? USER : USER + 1000;
- }
- }
-
- /**
- * Checks the presence of {@link ConstrainedTo} annotation and, if present, applicability to
- * the runtime type.
- * @param providerCls provider class
- * @param type runtime type
- * @return "true" if provider could be used with runtime type, "false" otherwise
- */
- protected static boolean constrainedTo(Class<?> providerCls, RuntimeType type) {
- final ConstrainedTo constrained = AnnotationUtils.getClassAnnotation(providerCls, ConstrainedTo.class);
- return constrained == null || constrained.value() == type;
- }
-
-}
diff --git a/deps/cxf-shade/src/patch/java/org/apache/cxf/jaxrs/utils/GenericsUtils.java b/deps/cxf-shade/src/patch/java/org/apache/cxf/jaxrs/utils/GenericsUtils.java
deleted file mode 100644
index ad7cca8550..0000000000
--- a/deps/cxf-shade/src/patch/java/org/apache/cxf/jaxrs/utils/GenericsUtils.java
+++ /dev/null
@@ -1,224 +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.cxf.jaxrs.utils;
-
-import java.lang.reflect.GenericDeclaration;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.stream.Stream;
-
-public final class GenericsUtils {
-
- private GenericsUtils() {
- // no-op
- }
-
- /**
- * Get the generic parameter for a specific interface we implement. The generic types
- * of other interfaces the specified class may implement will be ignored and not reported.
- *
- * If the interface has multiple generic parameters then multiple types will be returned.
- * If the interface has no generic parameters, then a zero-length array is returned.
- * If the class does not implement this interface, null will be returned.
- *
- * @param intrface The interface that has generic parameters
- * @param clazz The class implementing the interface and specifying the generic type
- * @return the parameter types for this interface or null if the class does not implement the interface
- */
- public static Type[] getTypeArgumentsFor(final Class<?> intrface, final Class<?> clazz) {
- if (!intrface.isAssignableFrom(clazz)) {
- return null;
- }
-
- // Is this one of our immediate interfaces or super classes?
- final Optional<Type[]> directTypes = genericTypes(clazz)
- .filter(type -> type instanceof ParameterizedType)
- .map(ParameterizedType.class::cast)
- .filter(parameterizedType -> intrface.equals(parameterizedType.getRawType()))
- .map(ParameterizedType::getActualTypeArguments)
- .findFirst();
-
- if (directTypes.isPresent()) {
- return directTypes.get();
- }
-
- // Look at our parent and interface parents for the type
- final Type[] types = declaredTypes(clazz)
- .filter(Objects::nonNull)
- .map(aClass -> getTypeArgumentsFor(intrface, aClass))
- .filter(Objects::nonNull)
- .findFirst()
- .orElse(null);
-
- if (types == null) {
- // Our parent does not implement this interface. We are
- // assignable to this interface, so it must be coming from
- // a place we aren't yet looking. Feature gap.
- return null;
- }
-
- // The types we got back may in fact have variables in them,
- // in which case we need resolve them.
- for (int i = 0; i < types.length; i++) {
- types[i] = resolveTypeVariable(types[i], clazz);
- types[i] = resolveParameterizedTypes(types[i], clazz);
- }
-
- return types;
- }
-
- private static Type resolveParameterizedTypes(final Type parameterized, final Class<?> clazz) {
- // If this isn't actually a variable, return what they passed us
- // as there is nothing to resolve
- if (!(parameterized instanceof ParameterizedType)) {
- return parameterized;
- }
-
- final ParameterizedType parameterizedType = (ParameterizedType) parameterized;
-
- final Type[] types = parameterizedType.getActualTypeArguments();
- boolean modified = false;
- // The types we got back may in fact have variables in them,
- // in which case we need resolve them.
- for (int i = 0; i < types.length; i++) {
- final Type original = types[i];
- types[i] = resolveTypeVariable(types[i], clazz);
- types[i] = resolveParameterizedTypes(types[i], clazz);
- if (!original.equals(types[i])) {
- modified = true;
- }
- }
-
- // We didn't have any work to do
- if (!modified) {
- return parameterized;
- }
-
- return new ResolvedParameterizedType(parameterizedType, types);
- }
-
- private static class ResolvedParameterizedType implements ParameterizedType {
- private final ParameterizedType parameterizedType;
- private final Type[] actualTypesResolved;
-
- ResolvedParameterizedType(final ParameterizedType parameterizedType, final Type[] actualTypes) {
- this.parameterizedType = parameterizedType;
- this.actualTypesResolved = actualTypes;
- }
-
- @Override
- public Type[] getActualTypeArguments() {
- return actualTypesResolved;
- }
-
- @Override
- public Type getRawType() {
- return parameterizedType.getRawType();
- }
-
- @Override
- public Type getOwnerType() {
- return parameterizedType.getOwnerType();
- }
-
- @Override
- public String getTypeName() {
- return parameterizedType.getTypeName();
- }
- }
-
- private static Type resolveTypeVariable(final Type variable, final Class<?> clazz) {
- // If this isn't actually a variable, return what they passed us
- // as there is nothing to resolve
- if (!(variable instanceof TypeVariable)) {
- return variable;
- }
-
- final TypeVariable<?> typeVariable = (TypeVariable<?>) variable;
-
- // Where was this type variable declared?
- final GenericDeclaration genericDeclaration = typeVariable.getGenericDeclaration();
-
- // At the moment we only support type variables on class definitions
- // so if it isn't of type Class, return the unresolved variable
- if (!(genericDeclaration instanceof Class)) {
- return variable;
- }
- final Class<?> declaringClass = (Class<?>) genericDeclaration;
-
- // Get the position of the variable in the generic signature
- // where variable names are specified
- final int typePosition = positionOf(variable, declaringClass.getTypeParameters());
-
- // We cannot seem to find our type variable in the list of parameters?
- // This shouldn't happen, but it did. Return the unresolved variable
- if (typePosition == -1) {
- return variable;
- }
-
- // Get the actual type arguments passed from the place where the declaringClass
- // was used by clazz in either an 'extends' or 'implements' context
- final Type[] actualTypes = genericTypes(clazz)
- .filter(type -> type instanceof ParameterizedType)
- .map(ParameterizedType.class::cast)
- .filter(parameterizedType -> declaringClass.equals(parameterizedType.getRawType()))
- .map(ParameterizedType::getActualTypeArguments)
- .findFirst().orElse(null);
-
- // We cannot seem to find where the types are specified. We have a
- // feature gap in our code. Return the unresolved variable
- if (actualTypes == null) {
- return variable;
- }
-
- // We found where the actual types were supplied, but somehow the
- // array lengths don't line up? This shouldn't happen, but did.
- // Return the unresolved variable
- if (actualTypes.length != declaringClass.getTypeParameters().length) {
- return variable;
- }
-
- final Type resolvedType = actualTypes[typePosition];
-
- return resolvedType;
- }
-
- private static Stream<Type> genericTypes(Class<?> clazz) {
- return Stream.concat(Stream.of(clazz.getGenericSuperclass()), Stream.of(clazz.getGenericInterfaces()));
- }
-
- private static Stream<Class<?>> declaredTypes(Class<?> clazz) {
- return Stream.concat(Stream.of(clazz.getSuperclass()), Stream.of(clazz.getInterfaces()));
- }
-
- private static int positionOf(final Type variable, final TypeVariable<? extends Class<?>>[] typeParameters) {
- for (int i = 0; i < typeParameters.length; i++) {
- final TypeVariable<? extends Class<?>> typeParameter = typeParameters[i];
- if (variable.equals(typeParameter)) {
- return i;
- }
- }
- return -1;
- }
-
-}
diff --git a/deps/cxf-shade/src/patch/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java b/deps/cxf-shade/src/patch/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
deleted file mode 100644
index 1e41abe2da..0000000000
--- a/deps/cxf-shade/src/patch/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
+++ /dev/null
@@ -1,1589 +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.cxf.jaxrs.utils;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.GenericDeclaration;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.ResourceBundle;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import jakarta.ws.rs.WebApplicationException;
-import jakarta.ws.rs.core.Application;
-import jakarta.ws.rs.core.GenericEntity;
-import jakarta.ws.rs.core.HttpHeaders;
-import jakarta.ws.rs.core.MediaType;
-import jakarta.ws.rs.core.MultivaluedMap;
-import jakarta.ws.rs.core.PathSegment;
-import jakarta.ws.rs.core.Request;
-import jakarta.ws.rs.core.Response;
-import jakarta.ws.rs.core.SecurityContext;
-import jakarta.ws.rs.core.UriInfo;
-import jakarta.ws.rs.ext.ContextResolver;
-import jakarta.ws.rs.ext.ParamConverter;
-import jakarta.ws.rs.ext.Providers;
-
-import org.apache.cxf.common.classloader.ClassLoaderUtils;
-import org.apache.cxf.common.i18n.BundleUtils;
-import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.common.util.ClassHelper;
-import org.apache.cxf.common.util.PrimitiveUtils;
-import org.apache.cxf.common.util.ProxyClassLoaderCache;
-import org.apache.cxf.common.util.ReflectionUtil;
-import org.apache.cxf.common.util.StringUtils;
-import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.jaxrs.ext.ContextProvider;
-import org.apache.cxf.jaxrs.ext.MessageContext;
-import org.apache.cxf.jaxrs.ext.ProtocolHeaders;
-import org.apache.cxf.jaxrs.impl.MetadataMap;
-import org.apache.cxf.jaxrs.impl.PathSegmentImpl;
-import org.apache.cxf.jaxrs.impl.tl.ThreadLocalContextResolver;
-import org.apache.cxf.jaxrs.impl.tl.ThreadLocalHttpHeaders;
-import org.apache.cxf.jaxrs.impl.tl.ThreadLocalInvocationHandler;
-import org.apache.cxf.jaxrs.impl.tl.ThreadLocalMessageContext;
-import org.apache.cxf.jaxrs.impl.tl.ThreadLocalProtocolHeaders;
-import org.apache.cxf.jaxrs.impl.tl.ThreadLocalProviders;
-import org.apache.cxf.jaxrs.impl.tl.ThreadLocalProxy;
-import org.apache.cxf.jaxrs.impl.tl.ThreadLocalRequest;
-import org.apache.cxf.jaxrs.impl.tl.ThreadLocalSecurityContext;
-import org.apache.cxf.jaxrs.impl.tl.ThreadLocalUriInfo;
-import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
-import org.apache.cxf.jaxrs.model.Parameter;
-import org.apache.cxf.jaxrs.model.ParameterType;
-import org.apache.cxf.jaxrs.provider.ProviderFactory;
-import org.apache.cxf.jaxrs.provider.ServerProviderFactory;
-import org.apache.cxf.message.Exchange;
-import org.apache.cxf.message.Message;
-import org.apache.cxf.message.MessageUtils;
-
-public final class InjectionUtils {
- public static final Set<String> STANDARD_CONTEXT_CLASSES = new HashSet<>();
- public static final Set<String> VALUE_CONTEXTS = new HashSet<>();
-
- private static final boolean USE_JAXB;
-
- static {
- // JAX-RS 1.0-1.1
- STANDARD_CONTEXT_CLASSES.add(Application.class.getName());
- STANDARD_CONTEXT_CLASSES.add(UriInfo.class.getName());
- STANDARD_CONTEXT_CLASSES.add(HttpHeaders.class.getName());
- STANDARD_CONTEXT_CLASSES.add(Request.class.getName());
- STANDARD_CONTEXT_CLASSES.add(SecurityContext.class.getName());
- STANDARD_CONTEXT_CLASSES.add(Providers.class.getName());
- STANDARD_CONTEXT_CLASSES.add(ContextResolver.class.getName());
- STANDARD_CONTEXT_CLASSES.add("jakarta.servlet.http.HttpServletRequest");
- STANDARD_CONTEXT_CLASSES.add("jakarta.servlet.http.HttpServletResponse");
- STANDARD_CONTEXT_CLASSES.add("jakarta.servlet.ServletContext");
- // JAX-RS 2.0
- STANDARD_CONTEXT_CLASSES.add("jakarta.ws.rs.container.ResourceContext");
- STANDARD_CONTEXT_CLASSES.add("jakarta.ws.rs.container.ResourceInfo");
- STANDARD_CONTEXT_CLASSES.add("jakarta.ws.rs.core.Configuration");
- // JAX-RS 2.1
- STANDARD_CONTEXT_CLASSES.add("jakarta.ws.rs.sse.Sse");
- STANDARD_CONTEXT_CLASSES.add("jakarta.ws.rs.sse.SseEventSink");
-
- VALUE_CONTEXTS.add(Application.class.getName());
- VALUE_CONTEXTS.add("jakarta.ws.rs.sse.Sse");
-
- boolean useJaxb;
- try {
- ClassLoaderUtils.loadClass(
- "jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter",
- InjectionUtils.class);
- useJaxb = true;
- } catch (final ClassNotFoundException cnfe) {
- useJaxb = false;
- }
- USE_JAXB = useJaxb;
- }
-
- private static final Logger LOG = LogUtils.getL7dLogger(InjectionUtils.class);
- private static final ResourceBundle BUNDLE = BundleUtils.getBundle(InjectionUtils.class);
-
- private static final String SERVLET_CONFIG_CLASS_NAME = "jakarta.servlet.ServletConfig";
- private static final String SERVLET_CONTEXT_CLASS_NAME = "jakarta.servlet.ServletContext";
- private static final String HTTP_SERVLET_REQUEST_CLASS_NAME = "jakarta.servlet.http.HttpServletRequest";
- private static final String HTTP_SERVLET_RESPONSE_CLASS_NAME = "jakarta.servlet.http.HttpServletResponse";
- private static final String ENUM_CONVERSION_CASE_SENSITIVE = "enum.conversion.case.sensitive";
-
- private static final String IGNORE_MATRIX_PARAMETERS = "ignore.matrix.parameters";
-
- private static ProxyClassLoaderCache proxyClassLoaderCache =
- new ProxyClassLoaderCache();
-
- private InjectionUtils() {
-
- }
-
- public static Field getDeclaredField(Class<?> cls, String fieldName) {
- if (cls == null || cls == Object.class) {
- return null;
- }
- Field f = ReflectionUtil.getDeclaredField(cls, fieldName);
- if (f != null) {
- return f;
- }
- return getDeclaredField(cls.getSuperclass(), fieldName);
- }
-
- public static boolean isConcreteClass(Class<?> cls) {
- return !cls.isInterface() && !Modifier.isAbstract(cls.getModifiers());
- }
-
- private static ParameterizedType findGenericDeclaration(GenericDeclaration declaration, Type scope) {
- if (scope instanceof ParameterizedType) {
- ParameterizedType type = (ParameterizedType) scope;
- if (type.getRawType() == declaration) {
- return type;
- }
- scope = type.getRawType();
- }
- if (scope instanceof Class) {
- Class<?> classScope = (Class<?>)scope;
- ParameterizedType result = findGenericDeclaration(declaration, classScope.getGenericSuperclass());
- if (result == null) {
- for (Type type : classScope.getGenericInterfaces()) {
- result = findGenericDeclaration(declaration, type);
- if (result != null) {
- break;
- }
- }
- }
- return result;
- }
- return null;
- }
-
- public static Type getSuperType(Class<?> serviceClass, TypeVariable<?> var) {
-
- int pos = 0;
- GenericDeclaration genericDeclaration = var.getGenericDeclaration();
- TypeVariable<?>[] vars = genericDeclaration.getTypeParameters();
- for (; pos < vars.length; pos++) {
- if (vars[pos].getName().equals(var.getName())) {
- break;
- }
- }
-
- ParameterizedType genericSubtype = findGenericDeclaration(genericDeclaration, serviceClass);
- Type result = null;
- if (genericSubtype != null) {
- result = genericSubtype.getActualTypeArguments()[pos];
- }
- if (result instanceof TypeVariable) {
- result = getSuperType(serviceClass, (TypeVariable<?>) result);
- }
-
- if (result == null || result == Object.class) {
- for (Type bound : var.getBounds()) {
- if (bound != Object.class) {
- result = bound;
- break;
- }
- }
- }
- return result;
- }
-
- public static Method checkProxy(Method methodToInvoke, Object resourceObject) {
- if (Proxy.class.isInstance(resourceObject)) {
- String methodToInvokeName = methodToInvoke.getName();
- Class<?>[] methodToInvokeTypes = methodToInvoke.getParameterTypes();
-
- for (Class<?> c : resourceObject.getClass().getInterfaces()) {
- try {
- return c.getMethod(methodToInvokeName, methodToInvokeTypes);
- } catch (NoSuchMethodException ex) {
- //ignore
- }
- if (methodToInvokeTypes.length > 0) {
- for (Method m : c.getMethods()) {
- if (m.getName().equals(methodToInvokeName)
- && m.getParameterTypes().length == methodToInvokeTypes.length) {
- Class<?>[] methodTypes = m.getParameterTypes();
- for (int i = 0; i < methodTypes.length; i++) {
- if (!methodTypes[i].isAssignableFrom(methodToInvokeTypes[i])) {
- break;
- }
- }
- return m;
- }
-
- }
- }
-
- }
- }
- return methodToInvoke;
-
- }
-
- public static void injectFieldValue(final Field f,
- final Object o,
- final Object v) {
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- try {
- f.setAccessible(true);
- f.set(o, v);
- } catch (IllegalAccessException ex) {
- reportServerError("FIELD_ACCESS_FAILURE",
- f.getType().getName());
- }
- return null;
- }
- });
- }
-
- public static Object extractFieldValue(final Field f,
- final Object o) {
- return AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- try {
- f.setAccessible(true);
- return f.get(o);
- } catch (IllegalAccessException ex) {
- reportServerError("FIELD_ACCESS_FAILURE",
- f.getType().getName());
- }
- return null;
- }
- });
- }
-
- public static Class<?> getActualType(Type genericType) {
-
- return getActualType(genericType, 0);
- }
-
- public static Class<?> getActualType(Type genericType, int pos) {
-
- if (genericType == null) {
- return null;
- }
- if (genericType == Object.class) {
- return (Class<?>)genericType;
- }
- if (!ParameterizedType.class.isAssignableFrom(genericType.getClass())) {
- if (genericType instanceof TypeVariable) {
- genericType = getType(((TypeVariable<?>)genericType).getBounds(), pos);
- } else if (genericType instanceof WildcardType) {
- WildcardType wildcardType = (WildcardType)genericType;
- Type[] bounds = wildcardType.getLowerBounds();
- if (bounds.length == 0) {
- bounds = wildcardType.getUpperBounds();
- }
- genericType = getType(bounds, pos);
- } else if (genericType instanceof GenericArrayType) {
- genericType = ((GenericArrayType)genericType).getGenericComponentType();
- }
- final Class<?> cls;
- if (!(genericType instanceof ParameterizedType)) {
- cls = (Class<?>)genericType;
- } else {
- cls = (Class<?>)((ParameterizedType)genericType).getRawType();
- }
- return cls.isArray() ? cls.getComponentType() : cls;
-
- }
- ParameterizedType paramType = (ParameterizedType)genericType;
- Type t = getType(paramType.getActualTypeArguments(), pos);
- return t instanceof Class ? (Class<?>)t : getActualType(t, 0);
- }
-
- public static Type getType(Type[] types, int pos) {
- if (pos >= types.length) {
- throw new RuntimeException("No type can be found at position " + pos);
- }
- return types[pos];
- }
-
- public static Class<?> getRawType(Type genericType) {
-
- if (genericType instanceof Class) {
- return (Class<?>) genericType;
- } else if (genericType instanceof ParameterizedType) {
- ParameterizedType paramType = (ParameterizedType)genericType;
- Type t = paramType.getRawType();
- if (t instanceof Class) {
- return (Class<?>)t;
- }
- } else if (genericType instanceof GenericArrayType) {
- return getRawType(((GenericArrayType)genericType).getGenericComponentType());
- }
- return null;
- }
-
-
- public static Type[] getActualTypes(Type genericType) {
- if (genericType == null
- || !ParameterizedType.class.isAssignableFrom(genericType.getClass())) {
- return null;
- }
- ParameterizedType paramType = (ParameterizedType)genericType;
- return paramType.getActualTypeArguments();
- }
-
- public static void injectThroughMethod(Object requestObject,
- Method method,
- Object parameterValue) {
- injectThroughMethod(requestObject, method, parameterValue, null);
- }
-
- public static void injectThroughMethod(Object requestObject,
- Method method,
- Object parameterValue,
- Message inMessage) {
- try {
- Method methodToInvoke = checkProxy(method, requestObject);
- methodToInvoke.invoke(requestObject, new Object[]{parameterValue});
- } catch (IllegalAccessException ex) {
- reportServerError("METHOD_ACCESS_FAILURE", method.getName());
- } catch (InvocationTargetException ex) {
- LOG.log(Level.SEVERE, ex.getCause().getMessage(), ex);
- Response r = JAXRSUtils.convertFaultToResponse(ex.getCause(), inMessage);
- if (r != null) {
- inMessage.getExchange().put(Response.class, r);
- throw new WebApplicationException();
- }
- reportServerError("METHOD_ACCESS_FAILURE", method.getName());
- } catch (Exception ex) {
- reportServerError("METHOD_INJECTION_FAILURE", method.getName());
- }
- }
-
- public static Object extractFromMethod(Object requestObject, Method method) {
- return extractFromMethod(requestObject, method, true);
- }
-
- public static Object extractFromMethod(Object requestObject,
- Method method,
- boolean logError) {
- try {
- Method methodToInvoke = checkProxy(method, requestObject);
- return methodToInvoke.invoke(requestObject);
- } catch (IllegalAccessException ex) {
- reportServerError("METHOD_ACCESS_FAILURE", method.getName(), logError);
- } catch (Exception ex) {
- reportServerError("METHOD_INJECTION_FAILURE", method.getName(), logError);
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public static <T> T handleParameter(String value,
- boolean decoded,
- Class<T> pClass,
- Type genericType,
- Annotation[] paramAnns,
- ParameterType pType,
- Message message) {
- if (value == null) {
- return null;
- }
- if (pType == ParameterType.PATH) {
- if (PathSegment.class.isAssignableFrom(pClass)) {
- return pClass.cast(new PathSegmentImpl(value, decoded));
- } else if (!MessageUtils.getContextualBoolean(message, IGNORE_MATRIX_PARAMETERS)) {
- value = new PathSegmentImpl(value, false).getPath();
- }
- }
-
- value = decodeValue(value, decoded, pType);
-
- final Optional<ParamConverter<T>> converter = getParamConverter(pClass, genericType, paramAnns, message);
- Object result = null;
- try {
- if (converter.isPresent()) {
- result = converter.get().fromString(value);
- }
- } catch (IllegalArgumentException nfe) {
- throw createParamConversionException(pType, nfe);
- }
- if (result != null) {
- final T theResult;
- if (pClass.isPrimitive()) {
- theResult = (T)result;
- } else {
- theResult = pClass.cast(result);
- }
- return theResult;
- } else if (converter.isPresent() && !pClass.isPrimitive()) {
- // The converter was applied and returned null value, acceptable
- // outcome for non-primitive type.
- return pClass.cast(result);
- }
-
- if (Number.class.isAssignableFrom(pClass) && "".equals(value)) {
- //pass empty string to boxed number type will result in 404
- return null;
- }
- if (Boolean.class == pClass) {
- // allow == checks for Boolean object
- pClass = (Class<T>) Boolean.TYPE;
- }
- if (pClass.isPrimitive()) {
- try {
- // cannot us pClass.cast as the pClass is something like
- // Boolean.TYPE (representing the boolean primitive) and
- // the object is a Boolean object
- return (T)PrimitiveUtils.read(value, pClass);
- } catch (NumberFormatException nfe) {
- throw createParamConversionException(pType, nfe);
- }
- }
-
- boolean adapterHasToBeUsed = false;
- Class<?> cls = pClass;
- Class<?> valueType = !USE_JAXB
- ? cls
- : JAXBUtils.getValueTypeFromAdapter(pClass, pClass, paramAnns);
- if (valueType != cls) {
- cls = valueType;
- adapterHasToBeUsed = true;
- }
- if (pClass == String.class && !adapterHasToBeUsed) {
- return pClass.cast(value);
- }
- // check constructors accepting a single String value
- try {
- Constructor<?> c = cls.getConstructor(new Class<?>[]{String.class});
- result = c.newInstance(new Object[]{value});
- } catch (NoSuchMethodException ex) {
- // try valueOf
- } catch (WebApplicationException ex) {
- throw ex;
- } catch (Exception ex) {
- Throwable t = getOrThrowActualException(ex);
- LOG.warning(new org.apache.cxf.common.i18n.Message("CLASS_CONSTRUCTOR_FAILURE",
- BUNDLE,
- pClass.getName()).toString());
- Response r = JAXRSUtils.toResponse(HttpUtils.getParameterFailureStatus(pType));
- throw ExceptionUtils.toHttpException(t, r);
- }
- if (result == null) {
- // check for valueOf(String) static methods
- String[] methodNames = cls.isEnum()
- ? new String[] {"fromString", "fromValue", "valueOf"}
- : new String[] {"valueOf", "fromString"};
- result = evaluateFactoryMethods(value, pType, result, cls, methodNames);
- }
-
- if (adapterHasToBeUsed) {
- // as the last resort, try XmlJavaTypeAdapters
- Object valueToReplace = result != null ? result : value;
- try {
- result = JAXBUtils.convertWithAdapter(valueToReplace, pClass, paramAnns);
- } catch (Throwable ex) {
- result = null;
- }
- }
-
- if (result == null) {
- reportServerError("WRONG_PARAMETER_TYPE", pClass.getName());
- }
-
- try {
- return pClass.cast(result);
- } catch (ClassCastException ex) {
- reportServerError("WRONG_PARAMETER_TYPE", pClass.getName());
- return null;
- }
- }
-
- private static RuntimeException createParamConversionException(ParameterType pType, Exception ex) {
- /*
- * Loosely related to the following section of the Jakarta REST specification:
- *
- * At least one of the acceptable response entity body media types is a supported output data
- * format (see Section 3.5). If no methods support one of the acceptable response entity body
- * media types an implementation MUST generate a NotAcceptableException (406 status)
- * and no entity.
- *
- * Tested by:
- * com.sun.ts.tests.jaxrs.ee.rs.ext.paramconverter.JAXRSClient
- * atomicIntegerIsLazyDeployableAndThrowsErrorTest_from_standalone
- */
- return ExceptionUtils.toNotAcceptableException(ex, null);
- }
-
- public static <T> Optional<ParamConverter<T>> getParamConverter(Class<T> pClass,
- Type genericType, Annotation[] anns, Message message) {
-
- if (message != null) {
- ServerProviderFactory pf = ServerProviderFactory.getInstance(message);
- ParamConverter<T> pm = pf.createParameterHandler(pClass, genericType, anns, message);
- return Optional.ofNullable(pm);
- }
-
- return Optional.empty();
- }
-
- public static <T> T createFromParameterHandler(String value,
- Class<T> pClass,
- Type genericType,
- Annotation[] anns,
- Message message) {
- return getParamConverter(pClass, genericType, anns, message)
- .map(pm -> pm.fromString(value))
- .orElse(null);
- }
-
-
-
- public static void reportServerError(String messageName, String parameter) {
- reportServerError(messageName, parameter, true);
- }
-
- public static void reportServerError(String messageName, String parameter, boolean logError) {
- org.apache.cxf.common.i18n.Message errorMessage =
- new org.apache.cxf.common.i18n.Message(messageName,
- BUNDLE,
- parameter);
- if (logError) {
- LOG.severe(errorMessage.toString());
- }
- Response r = JAXRSUtils.toResponseBuilder(Response.Status.INTERNAL_SERVER_ERROR)
- .type(MediaType.TEXT_PLAIN_TYPE)
- .entity(errorMessage.toString()).build();
- throw ExceptionUtils.toInternalServerErrorException(null, r);
- }
-
- private static Object evaluateFactoryMethods(String value, ParameterType pType, Object result,
- Class<?> cls, String[] methodNames) {
- Exception factoryMethodEx = null;
- for (String mName : methodNames) {
- try {
- result = evaluateFactoryMethod(value, cls, mName);
- if (result != null) {
- factoryMethodEx = null;
- break;
- }
- } catch (Exception ex) {
- // If it is enum and the method name is "fromValue" then don't throw
- // the exception immediately but try the next factory method
- factoryMethodEx = ex;
- if (!cls.isEnum() || !"fromValue".equals(mName)) {
- break;
- }
- }
- }
- if (factoryMethodEx != null) {
- Throwable t = getOrThrowActualException(factoryMethodEx);
- LOG.warning(new org.apache.cxf.common.i18n.Message("CLASS_VALUE_OF_FAILURE",
- BUNDLE,
- cls.getName()).toString());
- throw new WebApplicationException(t, HttpUtils.getParameterFailureStatus(pType));
- }
- return result;
- }
-
- private static <T> T evaluateFactoryMethod(String value,
- Class<T> pClass,
- String methodName)
- throws InvocationTargetException {
- try {
- Method m = pClass.getMethod(methodName, new Class<?>[]{String.class});
- if (Modifier.isStatic(m.getModifiers())) {
- return pClass.cast(m.invoke(null, new Object[]{value}));
- }
- } catch (NoSuchMethodException ex) {
- // no luck: try another factory methods
- } catch (IllegalAccessException ex) {
- // factory method is not accessible: try another
- }
-
- return null;
- }
-
- private static Throwable getOrThrowActualException(Throwable ex) {
- Throwable t = ex instanceof InvocationTargetException ? ((InvocationTargetException)ex).getCause() : ex;
- if (t instanceof WebApplicationException) {
- throw (WebApplicationException)t;
- }
- return t;
- }
-
- public static Object handleBean(Class<?> paramType, Annotation[] paramAnns,
- MultivaluedMap<String, String> values,
- ParameterType pType, Message message, boolean decoded) {
- Object bean = null;
- try {
- if (paramType.isInterface()) {
- paramType = org.apache.cxf.jaxrs.utils.JAXBUtils.getValueTypeFromAdapter(paramType,
- paramType,
- paramAnns);
- }
- bean = paramType.getDeclaredConstructor().newInstance();
- } catch (IllegalAccessException ex) {
- reportServerError("CLASS_ACCESS_FAILURE", paramType.getName());
- } catch (Exception ex) {
- reportServerError("CLASS_INSTANTIATION_FAILURE", paramType.getName());
- }
-
- Map<String, MultivaluedMap<String, String>> parsedValues =
- new HashMap<>();
- for (Map.Entry<String, List<String>> entry : values.entrySet()) {
- String memberKey = entry.getKey();
- final String beanKey;
-
- int idx = memberKey.indexOf('.');
- if (idx == -1) {
- beanKey = '.' + memberKey;
- } else {
- beanKey = memberKey.substring(0, idx);
- memberKey = memberKey.substring(idx + 1);
- }
-
- MultivaluedMap<String, String> value = parsedValues.get(beanKey);
- if (value == null) {
- value = new MetadataMap<>();
- parsedValues.put(beanKey, value);
- }
- value.put(memberKey, entry.getValue());
- }
-
- if (!parsedValues.isEmpty()) {
- for (Map.Entry<String, MultivaluedMap<String, String>> entry : parsedValues.entrySet()) {
- String memberKey = entry.getKey();
-
- boolean isbean = !memberKey.startsWith(".");
- if (!isbean) {
- memberKey = memberKey.substring(1);
- }
-
- Object setter = null;
- Object getter = null;
- for (Method m : paramType.getMethods()) {
- if (m.getName().equalsIgnoreCase("set" + memberKey)
- && m.getParameterTypes().length == 1) {
- setter = m;
- } else if (m.getName().equalsIgnoreCase("get" + memberKey)
- || isBooleanType(m.getReturnType())
- && m.getName().equalsIgnoreCase("is" + memberKey)) {
- getter = m;
- }
- if (setter != null && getter != null) {
- break;
- }
- }
- if (setter == null) {
- for (Field f : paramType.getFields()) {
- if (f.getName().equalsIgnoreCase(memberKey)) {
- setter = f;
- getter = f;
- break;
- }
- }
- }
-
- if (setter != null && getter != null) {
- final Class<?> type;
- final Type genericType;
- Object paramValue;
- if (setter instanceof Method) {
- type = Method.class.cast(setter).getParameterTypes()[0];
- genericType = Method.class.cast(setter).getGenericParameterTypes()[0];
- paramValue = InjectionUtils.extractFromMethod(bean, (Method) getter);
- } else {
- type = Field.class.cast(setter).getType();
- genericType = Field.class.cast(setter).getGenericType();
- paramValue = InjectionUtils.extractFieldValue((Field) getter, bean);
- }
-
- List<MultivaluedMap<String, String>> processedValuesList =
- processValues(type, genericType, entry.getValue(), isbean);
-
- for (MultivaluedMap<String, String> processedValues : processedValuesList) {
- if (InjectionUtils.isSupportedCollectionOrArray(type)) {
- Object appendValue = InjectionUtils.injectIntoCollectionOrArray(type,
- genericType, paramAnns, processedValues,
- isbean, true,
- pType, message);
- paramValue = InjectionUtils.mergeCollectionsOrArrays(paramValue, appendValue,
- genericType);
- } else if (isSupportedMap(genericType)) {
- Object appendValue = injectIntoMap(
- genericType, paramAnns, processedValues, true, pType, message);
- paramValue = mergeMap(paramValue, appendValue);
-
- } else if (isbean) {
- paramValue = InjectionUtils.handleBean(type, paramAnns, processedValues,
- pType, message, decoded);
- } else {
- paramValue = InjectionUtils.handleParameter(
- processedValues.values().iterator().next().get(0),
- decoded, type, type, paramAnns, pType, message);
- }
-
- if (paramValue != null) {
- if (setter instanceof Method) {
- InjectionUtils.injectThroughMethod(bean, (Method) setter, paramValue);
- } else {
- InjectionUtils.injectFieldValue((Field) setter, bean, paramValue);
- }
- }
- }
- }
- }
- }
-
- return bean;
- }
-
- @SuppressWarnings("unchecked")
- private static Object mergeMap(Object first, Object second) {
- if (first == null) {
- return second;
- } else if (first instanceof Map) {
- Map.class.cast(first).putAll((Map<?, ?>) second);
- return first;
- }
- return null;
- }
-
- private static Object injectIntoMap(Type genericType,
- Annotation[] paramAnns,
- MultivaluedMap<String, String> processedValues,
- boolean decoded,
- ParameterType pathParam, Message message) {
- ParameterizedType paramType = (ParameterizedType) genericType;
- Class<?> keyType = (Class<?>)paramType.getActualTypeArguments()[0];
- Type secondType = InjectionUtils.getType(paramType.getActualTypeArguments(), 1);
-
- if (secondType instanceof ParameterizedType) {
- MultivaluedMap<Object, Object> theValues = new MetadataMap<>();
- ParameterizedType valueParamType = (ParameterizedType) secondType;
- Class<?> valueType = (Class<?>) InjectionUtils.getType(valueParamType
- .getActualTypeArguments(), 0);
-
- for (Map.Entry<String, List<String>> processedValuesEntry : processedValues.entrySet()) {
- List<String> valuesList = processedValuesEntry.getValue();
- for (String value : valuesList) {
- Object o = InjectionUtils.handleParameter(value,
- decoded, valueType, valueType, paramAnns, pathParam, message);
- theValues.add(convertStringToPrimitive(processedValuesEntry.getKey(), keyType), o);
- }
- }
- return theValues;
- }
- Map<Object, Object> theValues = new HashMap<>();
- Class<?> valueType =
- (Class<?>) InjectionUtils.getType(paramType.getActualTypeArguments(), 1);
- for (Map.Entry<String, List<String>> processedValuesEntry : processedValues.entrySet()) {
- List<String> valuesList = processedValuesEntry.getValue();
- for (String value : valuesList) {
- Object o = InjectionUtils.handleParameter(value,
- decoded, valueType, valueType, paramAnns, pathParam, message);
- theValues.put(
- convertStringToPrimitive(processedValuesEntry.getKey(), keyType),
- o);
- }
- }
- return theValues;
-
- }
-
-
- private static boolean isSupportedMap(Type genericType) {
- Class<?> rawType = getRawType(genericType);
- if (Map.class.isAssignableFrom(rawType) && genericType instanceof ParameterizedType) {
- ParameterizedType paramType = (ParameterizedType) genericType;
- if (paramType.getActualTypeArguments().length == 2) {
- Class<?> firstType = getRawType(getType(paramType.getActualTypeArguments(), 0));
- Type secondType = getType(paramType.getActualTypeArguments(), 1);
- Class<?> secondRawType = getRawType(secondType);
-
- return InjectionUtils.isPrimitive(firstType)
- && (InjectionUtils.isPrimitive(secondRawType)
- || allowedMapListValue(secondRawType, secondType));
- }
- }
- return false;
- }
-
- private static boolean allowedMapListValue(Class<?> cls, Type type) {
- if (List.class.isAssignableFrom(cls)) {
- Class<?> listtype = getRawType(
- getType(((ParameterizedType)type).getActualTypeArguments(), 0));
- return InjectionUtils.isPrimitive(listtype);
- }
- return false;
- }
-
- private static List<MultivaluedMap<String, String>> processValues(Class<?> type, Type genericType,
- MultivaluedMap<String, String> values,
- boolean isbean) {
- final List<MultivaluedMap<String, String>> valuesList;
-
- if (isbean && InjectionUtils.isSupportedCollectionOrArray(type)) {
- valuesList = new ArrayList<>();
- Class<?> realType = InjectionUtils.getActualType(genericType);
- for (Map.Entry<String, List<String>> entry : values.entrySet()) {
- String memberKey = entry.getKey();
- Class<?> memberType = null;
-
- for (Method m : realType.getMethods()) {
- if (m.getName().equalsIgnoreCase("set" + memberKey)
- && m.getParameterTypes().length == 1) {
- memberType = m.getParameterTypes()[0];
- break;
- }
- }
- if (memberType == null) {
- for (Field f : realType.getFields()) {
- if (f.getName().equalsIgnoreCase(memberKey)) {
- memberType = f.getType();
- break;
- }
- }
- }
-
- // Strip values tied to collection/array fields from beans that are within
- // collection/array themselves, the only way to support this would be to have
- // an indexing syntax for nested beans, perhaps like this:
- // a(0).b=1&a(0).b=2&a(1).b=3&a(1).b=4
- // For now though we simply don't support this capability. To illustrate, the 'c'
- // param is dropped from this multivaluedmap example since it is a list:
- // {c=[71, 81, 91, 72, 82, 92], a=[C1, C2], b=[790, 791]}
- if (memberType != null && InjectionUtils.isSupportedCollectionOrArray(memberType)) {
- continue;
- }
-
- // Split multivaluedmap value list contents into separate multivaluedmap instances
- // whose list contents are only 1 level deep, for example:
- // {a=[C1, C2], b=[790, 791]}
- // becomes these 2 separate multivaluedmap instances:
- // {a=[C1], b=[790]} and {a=[C2], b=[791]}
- int idx = 0;
- for (String value : entry.getValue()) {
- MultivaluedMap<String, String> splitValues =
- (idx < valuesList.size()) ? valuesList.get(idx) : null;
- if (splitValues == null) {
- splitValues = new MetadataMap<>();
- valuesList.add(splitValues);
- }
- splitValues.add(memberKey, value);
- idx++;
- }
- }
- } else {
- valuesList = Collections.singletonList(values);
- }
-
- return valuesList;
- }
-
- public static boolean isSupportedCollectionOrArray(Class<?> type) {
- return Collection.class.isAssignableFrom(type) || type.isArray();
- }
-
- @SuppressWarnings("unchecked")
- private static Object mergeCollectionsOrArrays(Object first, Object second, Type genericType) {
- if (first == null) {
- return second;
- } else if (first instanceof Collection) {
- Collection.class.cast(first).addAll((Collection<?>) second);
- return first;
- } else {
- int firstLen = Array.getLength(first);
- int secondLen = Array.getLength(second);
- Object mergedArray = Array.newInstance(InjectionUtils.getActualType(genericType),
- firstLen + secondLen);
- System.arraycopy(first, 0, mergedArray, 0, firstLen);
- System.arraycopy(second, 0, mergedArray, firstLen, secondLen);
- return mergedArray;
- }
- }
-
-
- static Class<?> getCollectionType(Class<?> rawType) {
- Class<?> type = null;
- if (SortedSet.class.isAssignableFrom(rawType)) {
- type = TreeSet.class; //NOPMD
- } else if (Set.class.isAssignableFrom(rawType)) {
- type = HashSet.class; //NOPMD
- } else if (Collection.class.isAssignableFrom(rawType)) {
- type = ArrayList.class; //NOPMD
- }
- return type;
-
- }
- //CHECKSTYLE:OFF
- private static Object injectIntoCollectionOrArray(Class<?> rawType,
- Type genericType,
- Annotation[] paramAnns,
- MultivaluedMap<String, String> values,
- boolean isbean, boolean decoded,
- ParameterType pathParam, Message message) {
- //CHECKSTYLE:ON
- Class<?> type = getCollectionType(rawType);
-
- final Class<?> realType;
- final Type realGenericType;
- if (rawType.isArray()) {
- realType = rawType.getComponentType();
- realGenericType = realType;
- } else {
- Type[] types = getActualTypes(genericType);
- if (types == null || types.length == 0 || !(types[0] instanceof ParameterizedType)) {
- realType = getActualType(genericType);
- realGenericType = realType;
- } else {
- realType = getRawType(types[0]);
- realGenericType = types[0];
- }
- }
- Object theValues = null;
- if (type != null) {
- try {
- theValues = type.getDeclaredConstructor().newInstance();
- } catch (IllegalAccessException ex) {
- reportServerError("CLASS_ACCESS_FAILURE", type.getName());
- } catch (Exception ex) {
- reportServerError("CLASS_INSTANTIATION_FAILURE", type.getName());
- }
- } else {
- theValues = Array.newInstance(realType, isbean ? 1 : values.values().iterator().next().size());
- }
- if (isbean) {
- Object o = InjectionUtils.handleBean(realType, paramAnns, values, pathParam, message, decoded);
- addToCollectionValues(theValues, o, 0);
- } else {
- List<String> valuesList = values.values().iterator().next();
- valuesList = checkPathSegment(valuesList, realType, pathParam);
- for (int ind = 0; ind < valuesList.size(); ind++) {
- Object o = InjectionUtils.handleParameter(valuesList.get(ind), decoded,
- realType, realGenericType, paramAnns, pathParam, message);
- addToCollectionValues(theValues, o, ind);
- }
- }
- return theValues;
- }
-
- @SuppressWarnings("unchecked")
- private static void addToCollectionValues(Object theValues, Object o, int index) {
- if (o != null) {
- if (theValues instanceof Collection) {
- Collection.class.cast(theValues).add(o);
- } else if (theValues.getClass().getComponentType().isPrimitive()) {
- Array.set(theValues, index, o);
- } else {
- ((Object[]) theValues)[index] = o;
- }
- }
- }
-
- private static List<String> checkPathSegment(List<String> values, Class<?> type,
- ParameterType pathParam) {
- if (pathParam != ParameterType.PATH || !PathSegment.class.isAssignableFrom(type)) {
- return values;
- }
- List<String> newValues = new ArrayList<>();
- for (String v : values) {
- String[] segments = v.split("/");
- for (String s : segments) {
- if (!s.isEmpty()) {
- newValues.add(s);
- }
- }
- if (v.endsWith("/")) {
- newValues.add("");
- }
- }
- return newValues;
- }
- //
- //CHECKSTYLE:OFF
- public static Object createParameterObject(List<String> paramValues,
- Class<?> paramType,
- Type genericType,
- Annotation[] paramAnns,
- String defaultValue,
- boolean decoded,
- ParameterType pathParam,
- Message message) {
- //CHECKSTYLE:ON
-
- if (paramValues == null || paramValues.size() == 1 && paramValues.get(0) == null) {
- if (defaultValue != null) {
- paramValues = Collections.singletonList(defaultValue);
- } else {
- if (paramType.isPrimitive()) {
- paramValues = Collections.singletonList(
- boolean.class == paramType ? "false"
- : char.class == paramType ? Character.toString('\u0000') : "0");
- } else if (InjectionUtils.isSupportedCollectionOrArray(paramType)) {
- paramValues = Collections.emptyList();
- } else {
- return null;
- }
- }
- }
-
- Object value = null;
- if (InjectionUtils.isSupportedCollectionOrArray(paramType)) {
- MultivaluedMap<String, String> paramValuesMap = new MetadataMap<>();
- paramValuesMap.put("", paramValues);
- value = InjectionUtils.injectIntoCollectionOrArray(paramType, genericType, paramAnns,
- paramValuesMap, false, decoded, pathParam, message);
- } else {
- String result = null;
- if (!paramValues.isEmpty()) {
- boolean isLast = pathParam == ParameterType.PATH ? true : false;
- result = isLast ? paramValues.get(paramValues.size() - 1)
- : paramValues.get(0);
- }
- if (result != null) {
- value = InjectionUtils.handleParameter(result, decoded, paramType, genericType,
- paramAnns, pathParam, message);
- }
- }
- return value;
- }
-
- // TODO : investigate the possibility of using generic proxies only
- @SuppressWarnings("unchecked")
- public static <T> ThreadLocalProxy<T> createThreadLocalProxy(Class<T> type) {
- ThreadLocalProxy<?> proxy = null;
- if (UriInfo.class.isAssignableFrom(type)) {
- proxy = new ThreadLocalUriInfo();
- } else if (HttpHeaders.class.isAssignableFrom(type)) {
- proxy = new ThreadLocalHttpHeaders();
- } else if (ProtocolHeaders.class.isAssignableFrom(type)) {
- proxy = new ThreadLocalProtocolHeaders();
- } else if (SecurityContext.class.isAssignableFrom(type)) {
- proxy = new ThreadLocalSecurityContext();
- } else if (ContextResolver.class.isAssignableFrom(type)) {
- proxy = new ThreadLocalContextResolver<>();
- } else if (Request.class.isAssignableFrom(type)) {
- proxy = new ThreadLocalRequest();
- } else if (Providers.class.isAssignableFrom(type)) {
- proxy = new ThreadLocalProviders();
- } else if (MessageContext.class.isAssignableFrom(type)) {
- proxy = new ThreadLocalMessageContext();
- }
-
- if (proxy == null && isServletApiContext(type.getName())) {
- proxy = createThreadLocalServletApiContext(type.getName());
- }
- if (proxy == null) {
- ClassLoader loader
- = proxyClassLoaderCache.getProxyClassLoader(Proxy.class.getClassLoader(),
- new Class<?>[]{Proxy.class, ThreadLocalProxy.class, type});
- if (!canSeeAllClasses(loader, new Class<?>[]{Proxy.class, ThreadLocalProxy.class, type})) {
- LOG.log(Level.FINE, "find a loader from ProxyClassLoader cache,"
- + " but can't see all interfaces");
-
- LOG.log(Level.FINE, "create a new one with parent " + Proxy.class.getClassLoader());
- proxyClassLoaderCache.removeStaleProxyClassLoader(type);
- proxyClassLoaderCache.getProxyClassLoader(Proxy.class.getClassLoader(),
- new Class<?>[]{Proxy.class, ThreadLocalProxy.class, type});
-
-
- }
- return (ThreadLocalProxy<T>)Proxy.newProxyInstance(loader,
- new Class[] {type, ThreadLocalProxy.class },
- new ThreadLocalInvocationHandler<T>());
- }
-
- return (ThreadLocalProxy<T>)proxy;
- }
-
- private static boolean canSeeAllClasses(ClassLoader loader, Class<?>[] interfaces) {
- for (Class<?> currentInterface : interfaces) {
- String ifName = currentInterface.getName();
- try {
- Class<?> ifClass = Class.forName(ifName, true, loader);
- if (ifClass != currentInterface) {
- return false;
- }
-
- } catch (NoClassDefFoundError | ClassNotFoundException e) {
- return false;
- }
- }
- return true;
- }
-
- private static boolean isServletApiContext(String name) {
- return name.startsWith("jakarta.servlet.");
- }
-
- private static ThreadLocalProxy<?> createThreadLocalServletApiContext(String name) {
- String proxyClassName = null;
- if (HTTP_SERVLET_REQUEST_CLASS_NAME.equals(name)) {
- proxyClassName = "org.apache.cxf.jaxrs.impl.tl.ThreadLocalHttpServletRequest";
- } else if (HTTP_SERVLET_RESPONSE_CLASS_NAME.equals(name)) {
- proxyClassName = "org.apache.cxf.jaxrs.impl.tl.ThreadLocalHttpServletResponse";
- } else if (SERVLET_CONTEXT_CLASS_NAME.equals(name)) {
- proxyClassName = "org.apache.cxf.jaxrs.impl.tl.ThreadLocalServletContext";
- } else if (SERVLET_CONFIG_CLASS_NAME.equals(name)) {
- proxyClassName = "org.apache.cxf.jaxrs.impl.tl.ThreadLocalServletConfig";
- }
- if (proxyClassName != null) {
- try {
- return (ThreadLocalProxy<?>)ClassLoaderUtils.loadClass(proxyClassName, InjectionUtils.class)
- .getDeclaredConstructor().newInstance();
- } catch (Throwable t) {
- throw new RuntimeException(t);
- }
- }
- return null;
- }
-
- public static Method getGetterFromSetter(Method setter) throws Exception {
- return setter.getDeclaringClass().getMethod("get" + setter.getName().substring(3));
- }
-
- public static void injectContextProxiesAndApplication(AbstractResourceInfo cri,
- Object instance,
- Application app,
- ProviderFactory factory) {
- if (!cri.contextsAvailable() || !cri.isSingleton()) {
- return;
- }
- synchronized (instance) {
- for (Map.Entry<Class<?>, Method> entry : cri.getContextMethods().entrySet()) {
- Method method = entry.getValue();
- Object value = null;
- Class<?> cls = method.getParameterTypes()[0];
- if (cls == Application.class) {
- value = app;
- } else if (VALUE_CONTEXTS.contains(cls.getName()) && factory != null) {
- ContextProvider<?> p = factory.createContextProvider(cls, null);
- if (p != null) {
- value = p.createContext(null);
- }
- } else {
- value = cri.getContextSetterProxy(method);
- }
- try {
- if (value == InjectionUtils.extractFromMethod(instance,
- getGetterFromSetter(method),
- false)) {
- continue;
- }
-
- } catch (Throwable t) {
- // continue
- }
- InjectionUtils.injectThroughMethod(instance, method, value);
- }
-
- for (Field f : cri.getContextFields()) {
- Object value = null;
- Class<?> cls = f.getType();
- if (cls == Application.class) {
- value = app;
- } else if (VALUE_CONTEXTS.contains(cls.getName()) && factory != null) {
- ContextProvider<?> p = factory.createContextProvider(cls, null);
- if (p != null) {
- value = p.createContext(null);
- }
- } else {
- value = cri.getContextFieldProxy(f);
- }
- try {
- if (value == InjectionUtils.extractFieldValue(f, instance)) {
- continue;
- }
- } catch (Throwable t) {
- // continue
- }
- InjectionUtils.injectFieldValue(f, instance, value);
- }
- }
- }
-
- public static void injectContextProxies(AbstractResourceInfo cri, Object instance) {
- injectContextProxiesAndApplication(cri, instance, null, null);
- }
-
- @SuppressWarnings("unchecked")
- public static void injectContextField(AbstractResourceInfo cri,
- Field f, Object o, Object value) {
- if (!cri.isSingleton()) {
- InjectionUtils.injectFieldValue(f, o, value);
- } else {
- ThreadLocalProxy<Object> proxy = (ThreadLocalProxy<Object>)cri.getContextFieldProxy(f);
- if (proxy != null) {
- proxy.set(value);
- }
- }
- }
-
- public static void injectContexts(Object requestObject,
- AbstractResourceInfo resource,
- Message message) {
- if (resource.contextsAvailable()) {
- injectContextMethods(requestObject, resource, message);
- injectContextFields(requestObject, resource, message);
- injectConstructorProxies(requestObject, resource, message);
- }
- }
-
- @SuppressWarnings("unchecked")
- public static void injectContextMethods(Object requestObject,
- AbstractResourceInfo cri,
- Message message) {
-
- for (Map.Entry<Class<?>, Method> entry : cri.getContextMethods().entrySet()) {
- Method method = entry.getValue();
- if (VALUE_CONTEXTS.contains(method.getParameterTypes()[0].getName()) && cri.isSingleton()) {
- continue;
- }
- Object o = JAXRSUtils.createContextValue(message,
- method.getGenericParameterTypes()[0],
- entry.getKey());
-
- if (o != null) {
- if (!cri.isSingleton()) {
- InjectionUtils.injectThroughMethod(requestObject, method, o, message);
- } else {
- ThreadLocalProxy<Object> proxy
- = (ThreadLocalProxy<Object>)cri.getContextSetterProxy(method);
- if (proxy != null) {
- proxy.set(o);
- }
- }
-
- }
- }
- }
-
- public static void injectContextFields(Object o,
- AbstractResourceInfo cri,
- Message m) {
-
- for (Field f : cri.getContextFields()) {
- if (VALUE_CONTEXTS.contains(f.getType().getName()) && cri.isSingleton()) {
- continue;
- }
- Object value = JAXRSUtils.createContextValue(m, f.getGenericType(), f.getType());
- InjectionUtils.injectContextField(cri, f, o, value);
- }
- }
-
- @SuppressWarnings("unchecked")
- public static void injectConstructorProxies(Object o,
- AbstractResourceInfo cri,
- Message m) {
-
- Map<Class<?>, ThreadLocalProxy<?>> proxies = cri.getConstructorProxies();
- if (proxies != null) {
- for (Map.Entry<Class<?>, ThreadLocalProxy<?>> entry : proxies.entrySet()) {
- Object value = JAXRSUtils.createContextValue(m, entry.getKey(), entry.getKey());
- ((ThreadLocalProxy<Object>)entry.getValue()).set(value);
- }
- }
- }
-
- public static MultivaluedMap<String, Object> extractValuesFromBean(Object bean, String baseName) {
- MultivaluedMap<String, Object> values = new MetadataMap<>();
- fillInValuesFromBean(bean, baseName, values);
- return values;
- }
-
- private static boolean isBooleanType(Class<?> cls) {
- return boolean.class == cls || Boolean.class == cls;
- }
-
- public static void fillInValuesFromBean(Object bean, String baseName,
- MultivaluedMap<String, Object> values) {
- for (Method m : bean.getClass().getMethods()) {
- String methodName = m.getName();
- boolean startsFromGet = methodName.startsWith("get");
- if ((startsFromGet
- || isBooleanType(m.getReturnType()) && methodName.startsWith("is"))
- && m.getParameterTypes().length == 0) {
-
- int minLen = startsFromGet ? 3 : 2;
- if (methodName.length() <= minLen) {
- continue;
- }
-
- String propertyName = StringUtils.uncapitalize(methodName.substring(minLen));
- if (baseName.contains(propertyName)
- || "class".equals(propertyName)
- || "declaringClass".equals(propertyName)) {
- continue;
- }
- if (!"".equals(baseName)) {
- propertyName = baseName + '.' + propertyName;
- }
-
- Object value = extractFromMethod(bean, m);
- if (value == null) {
- continue;
- }
- if (isPrimitive(value.getClass()) || Date.class.isAssignableFrom(value.getClass())) {
- values.putSingle(propertyName, value);
- } else if (value.getClass().isEnum()) {
- values.putSingle(propertyName, value.toString());
- } else if (isSupportedCollectionOrArray(value.getClass())) {
- final List<Object> theValues;
- if (value.getClass().isArray()) {
- theValues = Arrays.asList((Object[])value);
- } else if (value instanceof Set) {
- theValues = new ArrayList<>((Set<?>)value);
- } else {
- theValues = CastUtils.cast((List<?>)value);
- }
- values.put(propertyName, theValues);
- } else if (Map.class.isAssignableFrom(value.getClass())) {
- if (isSupportedMap(m.getGenericReturnType())) {
- Map<Object, Object> map = CastUtils.cast((Map<?, ?>)value);
- for (Map.Entry<Object, Object> entry : map.entrySet()) {
- values.add(propertyName + '.' + entry.getKey().toString(),
- entry.getValue().toString());
- }
- }
- } else {
- fillInValuesFromBean(value, propertyName, values);
- }
- }
- }
- }
-
- public static Map<Parameter, Class<?>> getParametersFromBeanClass(Class<?> beanClass,
- ParameterType type,
- boolean checkIgnorable) {
- Map<Parameter, Class<?>> params = new LinkedHashMap<>();
- for (Method m : beanClass.getMethods()) {
- String methodName = m.getName();
- boolean startsFromGet = methodName.startsWith("get");
- if ((startsFromGet
- || isBooleanType(m.getReturnType()) && methodName.startsWith("is"))
- && m.getParameterTypes().length == 0) {
-
- int minLen = startsFromGet ? 3 : 2;
- if (methodName.length() <= minLen) {
- continue;
- }
- String propertyName = StringUtils.uncapitalize(methodName.substring(minLen));
- if (m.getReturnType() == Class.class
- || checkIgnorable && canPropertyBeIgnored(m, propertyName)) {
- continue;
- }
- params.put(new Parameter(type, propertyName), m.getReturnType());
- }
- }
- return params;
- }
-
- private static boolean canPropertyBeIgnored(Method m, String propertyName) {
- for (Annotation ann : m.getAnnotations()) {
- String annType = ann.annotationType().getName();
- if ("org.apache.cxf.aegis.type.java5.IgnoreProperty".equals(annType)
- || "jakarta.xml.bind.annotation.XmlTransient".equals(annType)) {
- return true;
- }
- }
- return false;
- }
- public static boolean isPrimitive(Class<?> type) {
- return String.class == type
- || isPrimitiveOnly(type);
- }
- public static boolean isPrimitiveOnly(Class<?> type) {
- return type.isPrimitive()
- || Number.class.isAssignableFrom(type)
- || Boolean.class == type
- || Character.class == type;
- }
-
- public static String decodeValue(String value, boolean decode, ParameterType param) {
- if (!decode) {
- return value;
- }
- if (param == ParameterType.PATH || param == ParameterType.MATRIX) {
- return HttpUtils.pathDecode(value);
- }
- return HttpUtils.urlDecode(value);
- }
-
- public static void invokeLifeCycleMethod(Object instance, Method method) {
- if (method != null) {
- method = InjectionUtils.checkProxy(method, instance);
- try {
- method.invoke(instance, new Object[]{});
- } catch (InvocationTargetException ex) {
- String msg = "Method " + method.getName() + " can not be invoked"
- + " due to InvocationTargetException";
- throw new WebApplicationException(JAXRSUtils.toResponseBuilder(500).entity(msg).build());
- } catch (IllegalAccessException ex) {
- String msg = "Method " + method.getName() + " can not be invoked"
- + " due to IllegalAccessException";
- throw ExceptionUtils.toInternalServerErrorException(ex,
- JAXRSUtils.toResponseBuilder(500).entity(msg).build());
- }
- }
- }
- public static Object convertStringToPrimitive(String value, Class<?> cls) {
- return convertStringToPrimitive(value, cls, new Annotation[]{});
- }
- public static Object convertStringToPrimitive(String value, Class<?> cls, Annotation[] anns) {
- Message m = JAXRSUtils.getCurrentMessage();
- Object obj = createFromParameterHandler(value, cls, cls, anns, m);
- if (obj != null) {
- return obj;
- }
- if (String.class == cls) {
- return value;
- } else if (cls.isPrimitive()) {
- return PrimitiveUtils.read(value, cls);
- } else if (cls.isEnum()) {
- if (m != null && !MessageUtils.getContextualBoolean(m, ENUM_CONVERSION_CASE_SENSITIVE, false)) {
- obj = invokeValueOf(value.toUpperCase(), cls);
- }
- if (obj == null) {
- try {
- obj = invokeValueOf(value, cls);
- } catch (RuntimeException ex) {
- if (m == null) {
- obj = invokeValueOf(value.toUpperCase(), cls);
- } else {
- throw ex;
- }
- }
- }
- return obj;
- } else {
- try {
- Constructor<?> c = cls.getConstructor(new Class<?>[]{String.class});
- return c.newInstance(new Object[]{value});
- } catch (Throwable ex) {
- // try valueOf
- }
- return invokeValueOf(value, cls);
- }
- }
-
- private static Object invokeValueOf(String value, Class<?> cls) {
- try {
- Method m = cls.getMethod("valueOf", new Class[]{String.class});
- return m.invoke(null, value);
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
- }
-
- public static Class<?> getRawResponseClass(Object targetObject) {
- if (targetObject != null) {
- Class<?> targetClass = targetObject.getClass();
- return ClassHelper.getRealClassFromClass(targetClass);
- }
- return null;
- }
-
- public static Type getGenericResponseType(Method invoked,
- Class<?> serviceCls,
- Object targetObject,
- Class<?> targetType,
- Exchange exchange) {
- if (targetObject == null) {
- return null;
- }
- final Type type;
- if (GenericEntity.class.isAssignableFrom(targetObject.getClass())) {
- type = processGenericTypeIfNeeded(serviceCls, targetType, ((GenericEntity<?>)targetObject).getType());
- } else if (invoked == null
- || !invoked.getReturnType().isAssignableFrom(targetType)) {
- // when a method has been invoked it is still possible that either an ExceptionMapper
- // or a ResponseHandler filter overrides a response entity; if it happens then
- // the Type is the class of the response object, unless this new entity is assignable
- // to invoked.getReturnType(); same applies to the case when a method returns Response
- type = targetObject.getClass();
- } else {
- type = processGenericTypeIfNeeded(serviceCls, targetType, invoked.getGenericReturnType());
- }
-
- return type;
- }
- public static Class<?> updateParamClassToTypeIfNeeded(Class<?> paramCls, Type type) {
- if (paramCls != type && type instanceof Class) {
- Class<?> clsType = (Class<?>)type;
- if (paramCls.isAssignableFrom(clsType)
- || clsType != Object.class && !clsType.isInterface() && clsType.isAssignableFrom(paramCls)) {
- paramCls = clsType;
- }
- }
- return paramCls;
- }
-
- public static Type processGenericTypeIfNeeded(Class<?> serviceCls, Class<?> paramCls, Type type) {
-
- if (type instanceof TypeVariable) {
- type = InjectionUtils.getSuperType(serviceCls, (TypeVariable<?>)type);
- } else if (type instanceof ParameterizedType) {
- ParameterizedType pt = (ParameterizedType)type;
- if (pt.getActualTypeArguments()[0] instanceof TypeVariable
- && isSupportedCollectionOrArray(getRawType(pt))) {
- TypeVariable<?> typeVar = (TypeVariable<?>)pt.getActualTypeArguments()[0];
- Type theType = InjectionUtils.getSuperType(serviceCls, typeVar);
- if (theType instanceof Class) {
- type = new ParameterizedCollectionType((Class<?>)theType);
- } else {
- type = processGenericTypeIfNeeded(serviceCls, paramCls, theType);
- type = new ParameterizedCollectionType(type);
- }
- }
- }
-
- if (type == null || type == Object.class) {
- type = paramCls;
- }
- return type;
-
- }
-
- public static Object getEntity(Object o) {
- return o instanceof GenericEntity ? ((GenericEntity<?>)o).getEntity() : o;
- }
-}
diff --git a/deps/cxf-shade/src/patch/java/org/apache/cxf/message/MessageUtils.java b/deps/cxf-shade/src/patch/java/org/apache/cxf/message/MessageUtils.java
deleted file mode 100644
index ffe9584986..0000000000
--- a/deps/cxf-shade/src/patch/java/org/apache/cxf/message/MessageUtils.java
+++ /dev/null
@@ -1,302 +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.cxf.message;
-
-import java.lang.reflect.Method;
-import java.net.HttpURLConnection;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Optional;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.logging.Logger;
-
-import org.w3c.dom.Node;
-
-import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.common.util.PropertyUtils;
-import org.apache.cxf.common.util.StringUtils;
-import org.apache.cxf.service.invoker.MethodDispatcher;
-import org.apache.cxf.service.model.BindingOperationInfo;
-
-
-/**
- * Holder for utility methods relating to messages.
- */
-public final class MessageUtils {
-
- private static final Logger LOG = LogUtils.getL7dLogger(MessageUtils.class);
-
- /**
- * Prevents instantiation.
- */
- private MessageUtils() {
- }
-
- /**
- * Determine if message is outbound.
- *
- * @param message the current Message
- * @return true if the message direction is outbound
- */
- public static boolean isOutbound(Message message) {
- if (message == null) {
- return false;
- }
-
- Exchange exchange = message.getExchange();
- return exchange != null
- && (message == exchange.getOutMessage() || message == exchange.getOutFaultMessage());
- }
-
- /**
- * Determine if message is fault.
- *
- * @param message the current Message
- * @return true if the message is a fault
- */
- public static boolean isFault(Message message) {
- return message != null
- && message.getExchange() != null
- && (message == message.getExchange().getInFaultMessage() || message == message.getExchange()
- .getOutFaultMessage());
- }
-
- /**
- * Determine the fault mode for the underlying (fault) message
- * (for use on server side only).
- *
- * @param message the fault message
- * @return the FaultMode
- */
- public static FaultMode getFaultMode(Message message) {
- if (message != null
- && message.getExchange() != null
- && message == message.getExchange().getOutFaultMessage()) {
- FaultMode mode = message.get(FaultMode.class);
- if (null != mode) {
- return mode;
- }
- return FaultMode.RUNTIME_FAULT;
- }
- return null;
- }
-
- /**
- * Determine if current messaging role is that of requestor.
- *
- * @param message the current Message
- * @return true if the current messaging role is that of requestor
- */
- public static boolean isRequestor(Message message) {
- if (message != null) {
- Boolean requestor = (Boolean) message.get(Message.REQUESTOR_ROLE);
- return requestor != null && requestor;
- }
- return false;
- }
-
- /**
- * Determine if the current message is a partial response.
- *
- * @param message the current message
- * @return true if the current messags is a partial response
- */
- public static boolean isPartialResponse(Message message) {
- return message != null && Boolean.TRUE.equals(message.get(Message.PARTIAL_RESPONSE_MESSAGE));
- }
-
- /**
- * Determines if the current message is an empty partial response, which
- * is a partial response with an empty content.
- *
- * @param message the current message
- * @return true if the current messags is a partial empty response
- */
- public static boolean isEmptyPartialResponse(Message message) {
- return message != null && Boolean.TRUE.equals(message.get(Message.EMPTY_PARTIAL_RESPONSE_MESSAGE));
- }
-
- /**
- * Returns true if a value is either the String "true" (regardless of case) or Boolean.TRUE.
- * @param value
- * @return true if value is either the String "true" or Boolean.TRUE
- * @deprecated replaced by {@link #PropertyUtils#isTrue(Object)}
- */
- @Deprecated
- public static boolean isTrue(Object value) {
- return PropertyUtils.isTrue(value);
- }
-
- public static boolean getContextualBoolean(Message m, String key) {
- return getContextualBoolean(m, key, false);
- }
- public static boolean getContextualBoolean(Message m, String key, boolean defaultValue) {
- if (m != null) {
- Object o = m.getContextualProperty(key);
- if (o != null) {
- return PropertyUtils.isTrue(o);
- }
- }
- return defaultValue;
- }
-
- public static Collection<Integer> getContextualIntegers(Message m, String key, Collection<Integer> defaultValue) {
- if (m != null) {
- Object o = m.getContextualProperty(key);
- if (o instanceof String) {
- Collection<Integer> intValues = new ArrayList<>();
- for (String value : ((String) o).split(",")) {
- try {
- if (!StringUtils.isEmpty(value)) {
- intValues.add(Integer.parseInt(value.trim()));
- }
- } catch (NumberFormatException ex) {
- LOG.warning("Incorrect integer value of " + value + " specified for: " + key);
- }
- }
- return intValues;
- }
- }
- return defaultValue;
- }
-
- public static int getContextualInteger(Message m, String key, int defaultValue) {
- if (m != null) {
- Object o = m.getContextualProperty(key);
- if (o instanceof String) {
- try {
- int i = Integer.parseInt((String)o);
- if (i > 0) {
- return i;
- }
- } catch (NumberFormatException ex) {
- LOG.warning("Incorrect integer value of " + o + " specified for: " + key);
- }
- }
- }
- return defaultValue;
- }
-
- public static Set<String> getContextualStrings(Message m, String key, Set<String> defaultValue) {
- if (m != null) {
- Object o = m.getContextualProperty(key);
- if (o instanceof String) {
- Set<String> values = new TreeSet<>();
- for (String value : ((String) o).split(",")) {
- if (!StringUtils.isEmpty(value)) {
- values.add(value.trim());
- }
- }
- return values;
- }
- }
- return defaultValue;
- }
-
- public static Object getContextualProperty(Message m, String propPreferred, String propDefault) {
- Object prop = null;
- if (m != null) {
- prop = m.getContextualProperty(propPreferred);
- if (prop == null && propDefault != null) {
- prop = m.getContextualProperty(propDefault);
- }
- }
- return prop;
- }
-
- /**
- * Returns true if the underlying content format is a W3C DOM or a SAAJ message.
- */
- public static boolean isDOMPresent(Message m) {
- return m != null && m.getContent(Node.class) != null;
- /*
- for (Class c : m.getContentFormats()) {
- if (c.equals(Node.class) || "jakarta.xml.soap.SOAPMessage".equals(c.getName())) {
- return true;
- }
- }
- return false;
- */
- }
-
- public static Optional<Method> getTargetMethod(Message m) {
- Method method;
- BindingOperationInfo bop = m.getExchange().getBindingOperationInfo();
- if (bop != null) {
- MethodDispatcher md = (MethodDispatcher) m.getExchange().getService().get(MethodDispatcher.class.getName());
- method = md.getMethod(bop);
- } else {
- // See please JAXRSInInterceptor#RESOURCE_METHOD for the reference
- method = (Method) m.get("org.apache.cxf.resource.method");
- }
- return Optional.ofNullable(method);
- }
-
- /**
- * Gets the response code from the message and tries to deduct one if it
- * is not set yet.
- * @param message message to get response code from
- * @return response code (or deducted value assuming success)
- */
- public static int getReponseCodeFromMessage(Message message) {
- Integer i = (Integer)message.get(Message.RESPONSE_CODE);
- if (i != null) {
- return i.intValue();
- }
- int code = hasNoResponseContent(message) ? HttpURLConnection.HTTP_ACCEPTED : HttpURLConnection.HTTP_OK;
- // put the code in the message so that others can get it
- message.put(Message.RESPONSE_CODE, code);
- return code;
- }
-
- /**
- * Determines if the current message has no response content.
- * The message has no response content if either:
- * - the request is oneway and the current message is no partial
- * response or an empty partial response.
- * - the request is not oneway but the current message is an empty partial
- * response.
- * @param message
- * @return
- */
- public static boolean hasNoResponseContent(Message message) {
- final boolean ow = isOneWay(message);
- final boolean pr = MessageUtils.isPartialResponse(message);
- final boolean epr = MessageUtils.isEmptyPartialResponse(message);
-
- //REVISIT may need to provide an option to choose other behavior?
- // old behavior not suppressing any responses => ow && !pr
- // suppress empty responses for oneway calls => ow && (!pr || epr)
- // suppress additionally empty responses for decoupled twoway calls =>
- return (ow && !pr) || epr;
- }
-
- /**
- * Checks if the message is oneway or not
- * @param message the message under consideration
- * @return true if the message has been marked as oneway
- */
- public static boolean isOneWay(Message message) {
- final Exchange ex = message.getExchange();
- return ex != null && ex.isOneWay();
- }
-
-}
diff --git a/deps/cxf-shade/src/patch/java/org/apache/cxf/security/wss4j/AbstractWSS4JInterceptor.java b/deps/cxf-shade/src/patch/java/org/apache/cxf/security/wss4j/AbstractWSS4JInterceptor.java
deleted file mode 100644
index ad6bec5b23..0000000000
--- a/deps/cxf-shade/src/patch/java/org/apache/cxf/security/wss4j/AbstractWSS4JInterceptor.java
+++ /dev/null
@@ -1,228 +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.cxf.ws.security.wss4j;
-
-import java.net.URI;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.xml.namespace.QName;
-
-import org.apache.cxf.binding.soap.SoapMessage;
-import org.apache.cxf.binding.soap.interceptor.SoapInterceptor;
-import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.message.Message;
-import org.apache.cxf.message.MessageUtils;
-import org.apache.cxf.phase.PhaseInterceptor;
-import org.apache.cxf.rt.security.utils.SecurityUtils;
-import org.apache.cxf.ws.security.SecurityConstants;
-import org.apache.wss4j.common.ConfigurationConstants;
-import org.apache.wss4j.common.WSS4JConstants;
-import org.apache.wss4j.common.crypto.Crypto;
-import org.apache.wss4j.common.crypto.PasswordEncryptor;
-import org.apache.wss4j.common.ext.WSSecurityException;
-import org.apache.wss4j.dom.handler.RequestData;
-import org.apache.wss4j.dom.handler.WSHandler;
-
-public abstract class AbstractWSS4JInterceptor extends WSHandler implements SoapInterceptor,
- PhaseInterceptor<SoapMessage> {
-
- private static final Set<QName> HEADERS = new HashSet<>();
-
- static {
- HEADERS.add(new QName(WSS4JConstants.WSSE_NS, "Security"));
- HEADERS.add(new QName(WSS4JConstants.ENC_NS, "EncryptedData"));
- HEADERS.add(new QName(WSS4JConstants.WSSE11_NS, "EncryptedHeader"));
- }
-
- private Map<String, Object> properties = new ConcurrentHashMap<>();
- private final Set<String> before = new HashSet<>();
- private final Set<String> after = new HashSet<>();
- private String phase;
- private String id;
-
- public AbstractWSS4JInterceptor() {
- super();
- id = getClass().getName();
- }
-
- public Set<URI> getRoles() {
- return null;
- }
-
- public void handleFault(SoapMessage message) {
- }
-
- public void postHandleMessage(SoapMessage message) throws Fault {
- }
- public Collection<PhaseInterceptor<? extends Message>> getAdditionalInterceptors() {
- return null;
- }
-
- public String getPhase() {
- return phase;
- }
-
- public void setPhase(String phase) {
- this.phase = phase;
- }
-
- public Object getOption(String key) {
- return properties.get(key);
- }
-
- public void setProperty(String key, String value) {
- properties.put(key, value);
- }
-
- public String getPassword(Object msgContext) {
- return (String)((Message)msgContext).getContextualProperty("password");
- }
-
- public Object getProperty(Object msgContext, String key) {
- if (msgContext == null) {
- return null;
- }
-
- Object obj = SecurityUtils.getSecurityPropertyValue(key, (Message)msgContext);
- if (obj == null) {
- obj = getOption(key);
- }
- return obj;
- }
-
- public void setPassword(Object msgContext, String password) {
- ((Message)msgContext).put("password", password);
- }
-
- public void setProperty(Object msgContext, String key, Object value) {
- ((Message)msgContext).put(key, value);
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Set<QName> getUnderstoodHeaders() {
- return HEADERS;
- }
-
- public Map<String, Object> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, Object> properties) {
- this.properties = properties;
- }
-
- public Set<String> getAfter() {
- return after;
- }
-
- public Set<String> getBefore() {
- return before;
- }
-
- protected boolean isRequestor(SoapMessage message) {
- return MessageUtils.isRequestor(message);
- }
-
- protected void translateProperties(SoapMessage msg) {
- String bspCompliant = (String)msg.getContextualProperty(SecurityConstants.IS_BSP_COMPLIANT);
- if (bspCompliant != null) {
- msg.put(ConfigurationConstants.IS_BSP_COMPLIANT, bspCompliant);
- }
- String futureTTL =
- (String)msg.getContextualProperty(SecurityConstants.TIMESTAMP_FUTURE_TTL);
- if (futureTTL != null) {
- msg.put(ConfigurationConstants.TTL_FUTURE_TIMESTAMP, futureTTL);
- }
- String ttl =
- (String)msg.getContextualProperty(SecurityConstants.TIMESTAMP_TTL);
- if (ttl != null) {
- msg.put(ConfigurationConstants.TTL_TIMESTAMP, ttl);
- }
-
- String utFutureTTL =
- (String)msg.getContextualProperty(SecurityConstants.USERNAMETOKEN_FUTURE_TTL);
- if (utFutureTTL != null) {
- msg.put(ConfigurationConstants.TTL_FUTURE_USERNAMETOKEN, utFutureTTL);
- }
- String utTTL =
- (String)msg.getContextualProperty(SecurityConstants.USERNAMETOKEN_TTL);
- if (utTTL != null) {
- msg.put(ConfigurationConstants.TTL_USERNAMETOKEN, utTTL);
- }
-
- String certConstraints =
- (String)SecurityUtils.getSecurityPropertyValue(SecurityConstants.SUBJECT_CERT_CONSTRAINTS, msg);
- if (certConstraints != null) {
- msg.put(ConfigurationConstants.SIG_SUBJECT_CERT_CONSTRAINTS, certConstraints);
- }
-
- String certConstraintsSeparator =
- (String)SecurityUtils.getSecurityPropertyValue(SecurityConstants.CERT_CONSTRAINTS_SEPARATOR, msg);
- if (certConstraintsSeparator != null && !certConstraintsSeparator.isEmpty()) {
- msg.put(ConfigurationConstants.SIG_CERT_CONSTRAINTS_SEPARATOR, certConstraintsSeparator);
- }
-
- // Now set SAML SenderVouches + Holder Of Key requirements
- String valSAMLSubjectConf =
- (String)SecurityUtils.getSecurityPropertyValue(SecurityConstants.VALIDATE_SAML_SUBJECT_CONFIRMATION,
- msg);
- boolean validateSAMLSubjectConf = true;
- if (valSAMLSubjectConf != null) {
- validateSAMLSubjectConf = Boolean.parseBoolean(valSAMLSubjectConf);
- }
- msg.put(
- ConfigurationConstants.VALIDATE_SAML_SUBJECT_CONFIRMATION,
- Boolean.toString(validateSAMLSubjectConf)
- );
-
- PasswordEncryptor passwordEncryptor =
- (PasswordEncryptor)msg.getContextualProperty(SecurityConstants.PASSWORD_ENCRYPTOR_INSTANCE);
- if (passwordEncryptor != null) {
- msg.put(ConfigurationConstants.PASSWORD_ENCRYPTOR_INSTANCE, passwordEncryptor);
- }
- }
-
- @Override
- protected Crypto loadCryptoFromPropertiesFile(
- String propFilename,
- RequestData reqData
- ) throws WSSecurityException {
- Message message = (Message)reqData.getMsgContext();
- // Not compatible with version WSS4J 3
- // ClassLoader classLoader = this.getClassLoader(reqData.getMsgContext());
- ClassLoader classLoader = this.getClassLoader();
- PasswordEncryptor passwordEncryptor = getPasswordEncryptor(reqData);
- return
- WSS4JUtils.loadCryptoFromPropertiesFile(
- message, propFilename, classLoader, passwordEncryptor
- );
- }
-
-}
diff --git a/deps/cxf-shade/src/patch/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java b/deps/cxf-shade/src/patch/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java
deleted file mode 100644
index bff113e5f2..0000000000
--- a/deps/cxf-shade/src/patch/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java
+++ /dev/null
@@ -1,619 +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.cxf.workqueue;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.concurrent.DelayQueue;
-import java.util.concurrent.Delayed;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.locks.ReentrantLock;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.cxf.common.classloader.ClassLoaderUtils;
-import org.apache.cxf.common.classloader.ClassLoaderUtils.ClassLoaderHolder;
-import org.apache.cxf.common.injection.NoJSR250Annotations;
-import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.common.util.ReflectionUtil;
-
-@NoJSR250Annotations
-public class AutomaticWorkQueueImpl implements AutomaticWorkQueue {
- public static final String PROPERTY_NAME = "name";
- static final int DEFAULT_MAX_QUEUE_SIZE = 256;
- private static final Logger LOG =
- LogUtils.getL7dLogger(AutomaticWorkQueueImpl.class);
-
-
- String name = "default";
- int maxQueueSize;
- int initialThreads;
- int lowWaterMark;
- int highWaterMark;
- long dequeueTimeout;
- AtomicInteger approxThreadCount = new AtomicInteger();
-
- ThreadPoolExecutor executor;
- Method addWorkerMethod;
- Object[] addWorkerArgs;
-
- AWQThreadFactory threadFactory;
- ReentrantLock mainLock;
- final ReentrantLock addThreadLock = new ReentrantLock();
-
- DelayQueue<DelayedTaskWrapper> delayQueue;
- WatchDog watchDog;
-
- boolean shared;
- int sharedCount;
-
- private List<PropertyChangeListener> changeListenerList;
-
- public AutomaticWorkQueueImpl() {
- this(DEFAULT_MAX_QUEUE_SIZE);
- }
- public AutomaticWorkQueueImpl(String name) {
- this(DEFAULT_MAX_QUEUE_SIZE, name);
- }
- public AutomaticWorkQueueImpl(int max) {
- this(max, "default");
- }
- public AutomaticWorkQueueImpl(int max, String name) {
- this(max,
- 0,
- 25,
- 5,
- 2 * 60 * 1000L,
- name);
- }
- public AutomaticWorkQueueImpl(int mqs,
- int initialThreads,
- int highWaterMark,
- int lowWaterMark,
- long dequeueTimeout) {
- this(mqs, initialThreads, highWaterMark, lowWaterMark, dequeueTimeout, "default");
- }
- public AutomaticWorkQueueImpl(int mqs,
- int initialThreads,
- int highWaterMark,
- int lowWaterMark,
- long dequeueTimeout,
- String name) {
- this.maxQueueSize = mqs == -1 ? DEFAULT_MAX_QUEUE_SIZE : mqs;
- this.initialThreads = initialThreads;
- this.highWaterMark = -1 == highWaterMark ? Integer.MAX_VALUE : highWaterMark;
- this.lowWaterMark = -1 == lowWaterMark ? Integer.MAX_VALUE : lowWaterMark;
- this.dequeueTimeout = dequeueTimeout;
- this.name = name;
- this.changeListenerList = new ArrayList<>();
- }
-
- public void addChangeListener(PropertyChangeListener listener) {
- this.changeListenerList.add(listener);
- }
-
- public void removeChangeListener(PropertyChangeListener listener) {
- this.changeListenerList.remove(listener);
- }
-
- public void notifyChangeListeners(PropertyChangeEvent event) {
- for (PropertyChangeListener listener : changeListenerList) {
- listener.propertyChange(event);
- }
- }
-
- public void setShared(boolean shared) {
- this.shared = shared;
- }
- public boolean isShared() {
- return shared;
- }
- public void addSharedUser() {
- sharedCount++;
- }
- public void removeSharedUser() {
- sharedCount--;
- }
- public int getShareCount() {
- return sharedCount;
- }
-
- protected synchronized ThreadPoolExecutor getExecutor() {
- if (executor == null) {
- threadFactory = createThreadFactory(name);
- executor = new ThreadPoolExecutor(lowWaterMark,
- highWaterMark,
- TimeUnit.MILLISECONDS.toMillis(dequeueTimeout),
- TimeUnit.MILLISECONDS,
- new LinkedBlockingQueue<Runnable>(maxQueueSize),
- threadFactory) {
- @Override
- protected void terminated() {
- ThreadFactory f = executor.getThreadFactory();
- if (f instanceof AWQThreadFactory) {
- ((AWQThreadFactory)f).shutdown();
- }
- if (watchDog != null) {
- watchDog.shutdown();
- }
- }
- };
-
-
- if (LOG.isLoggable(Level.FINE)) {
- StringBuilder buf = new StringBuilder(128).append("Constructing automatic work queue with:\n")
- .append("max queue size: ").append(maxQueueSize).append('\n')
- .append("initialThreads: ").append(initialThreads).append('\n')
- .append("lowWaterMark: ").append(lowWaterMark).append('\n')
- .append("highWaterMark: ").append(highWaterMark).append('\n');
- LOG.fine(buf.toString());
- }
-
- if (initialThreads > highWaterMark) {
- initialThreads = highWaterMark;
- }
-
- // as we cannot prestart more core than corePoolSize initial threads, we temporarily
- // change the corePoolSize to the number of initial threads
- // this is important as otherwise these threads will be created only when
- // the queue has filled up,
- // potentially causing problems with starting up under heavy load
- if (initialThreads < Integer.MAX_VALUE && initialThreads > 0) {
- executor.setCorePoolSize(initialThreads);
- int started = executor.prestartAllCoreThreads();
- if (started < initialThreads) {
- LOG.log(Level.WARNING, "THREAD_START_FAILURE_MSG",
- new Object[] {started, initialThreads});
- }
- executor.setCorePoolSize(lowWaterMark);
- }
-
- ReentrantLock l;
- try {
- Field f = ThreadPoolExecutor.class.getDeclaredField("mainLock");
- ReflectionUtil.setAccessible(f);
- l = (ReentrantLock)f.get(executor);
- } catch (Throwable t) {
- l = new ReentrantLock();
- }
- mainLock = l;
-
-
- try {
- //java 7
- addWorkerMethod = ThreadPoolExecutor.class.getDeclaredMethod("addWorker",
- Runnable.class, Boolean.TYPE);
- addWorkerArgs = new Object[] {null, Boolean.FALSE};
- } catch (Throwable t2) {
- //nothing we cando
- }
- }
- return executor;
- }
- private AWQThreadFactory createThreadFactory(final String nm) {
- ThreadGroup group;
- try {
- //Try and find the highest level ThreadGroup that we're allowed to use.
- //That SHOULD allow the default classloader and thread locals and such
- //to be the least likely to cause issues down the road.
- group = AccessController.doPrivileged(
- new PrivilegedAction<ThreadGroup>() {
- public ThreadGroup run() {
- ThreadGroup group = Thread.currentThread().getThreadGroup();
- ThreadGroup parent = group;
- try {
- while (parent != null) {
- group = parent;
- parent = parent.getParent();
- }
- } catch (SecurityException se) {
- //ignore - if we get here, the "group" is as high as
- //the security manager will allow us to go. Use that one.
- }
- return new ThreadGroup(group, nm + "-workqueue");
- }
- }
- );
- } catch (SecurityException e) {
- group = new ThreadGroup(nm + "-workqueue");
- }
- return new AWQThreadFactory(group, nm);
- }
-
- static class DelayedTaskWrapper implements Delayed, Runnable {
- long trigger;
- Runnable work;
-
- DelayedTaskWrapper(Runnable work, long delay) {
- this.work = work;
- trigger = System.currentTimeMillis() + delay;
- }
-
- public long getDelay(TimeUnit unit) {
- long n = trigger - System.currentTimeMillis();
- return unit.convert(n, TimeUnit.MILLISECONDS);
- }
-
- public int compareTo(Delayed delayed) {
- long other = ((DelayedTaskWrapper)delayed).trigger;
- int returnValue;
- if (this.trigger < other) {
- returnValue = -1;
- } else if (this.trigger > other) {
- returnValue = 1;
- } else {
- returnValue = 0;
- }
- return returnValue;
- }
-
- public void run() {
- work.run();
- }
-
- }
-
- class WatchDog extends Thread {
- DelayQueue<DelayedTaskWrapper> delayQueue;
- AtomicBoolean shutdown = new AtomicBoolean(false);
-
- WatchDog(DelayQueue<DelayedTaskWrapper> queue) {
- delayQueue = queue;
- }
-
- public void shutdown() {
- shutdown.set(true);
- // to exit the waiting thread
- interrupt();
- }
-
- public void run() {
- DelayedTaskWrapper task;
- try {
- while (!shutdown.get()) {
- task = delayQueue.take();
- if (task != null) {
- try {
- execute(task);
- } catch (Exception ex) {
- LOG.warning("Executing the task from DelayQueue with exception: " + ex);
- }
- }
- }
- } catch (InterruptedException e) {
- if (LOG.isLoggable(Level.FINE)) {
- LOG.finer("The DelayQueue watchdog Task is stopping");
- }
- }
-
- }
-
- }
- class AWQThreadFactory implements ThreadFactory {
- final AtomicInteger threadNumber = new AtomicInteger(1);
- ThreadGroup group;
- String name;
- ClassLoader loader;
-
- AWQThreadFactory(ThreadGroup gp, String nm) {
- group = gp;
- name = nm;
- //force the loader to be the loader of CXF, not the application loader
- loader = AutomaticWorkQueueImpl.class.getClassLoader();
- }
-
- public Thread newThread(final Runnable r) {
- if (group.isDestroyed()) {
- group = new ThreadGroup(group.getParent(), name + "-workqueue");
- }
- Runnable wrapped = new Runnable() {
- public void run() {
- approxThreadCount.incrementAndGet();
- try {
- r.run();
- } finally {
- approxThreadCount.decrementAndGet();
- }
- }
- };
- final Thread t = new Thread(group,
- wrapped,
- name + "-workqueue-" + threadNumber.getAndIncrement(),
- 0);
- AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
- public Boolean run() {
- t.setContextClassLoader(loader);
- return true;
- }
- });
- t.setDaemon(true);
- if (t.getPriority() != Thread.NORM_PRIORITY) {
- t.setPriority(Thread.NORM_PRIORITY);
- }
- return t;
- }
- public void setName(String s) {
- name = s;
- }
- public void shutdown() {
- if (!group.isDestroyed()) {
- try {
- group.destroy();
- group.setDaemon(true);
- } catch (Throwable t) {
- //ignore
- }
- }
- }
- }
-
- public void setName(String s) {
- name = s;
- if (threadFactory != null) {
- threadFactory.setName(s);
- }
- }
- public String getName() {
- return name;
- }
-
- public String toString() {
- return new StringBuilder(super.toString())
- .append(" [queue size: ").append(getSize())
- .append(", max size: ").append(maxQueueSize)
- .append(", threads: ").append(getPoolSize())
- .append(", active threads: ").append(getActiveCount())
- .append(", low water mark: ").append(getLowWaterMark())
- .append(", high water mark: ").append(getHighWaterMark())
- .append(']').toString();
- }
-
- public void execute(final Runnable command) {
- //Grab the context classloader of this thread. We'll make sure we use that
- //on the thread the runnable actually runs on.
-
- final ClassLoader loader = Thread.currentThread().getContextClassLoader();
- Runnable r = new Runnable() {
- public void run() {
- ClassLoaderHolder orig = ClassLoaderUtils.setThreadContextClassloader(loader);
- try {
- command.run();
- } finally {
- if (orig != null) {
- orig.reset();
- }
- }
- }
- };
- //The ThreadPoolExecutor in the JDK doesn't expand the number
- //of threads until the queue is full. However, we would
- //prefer the number of threads to expand immediately and
- //only uses the queue if we've reached the maximum number
- //of threads.
- ThreadPoolExecutor ex = getExecutor();
- ex.execute(r);
- if (addWorkerMethod != null
- && !ex.getQueue().isEmpty()
- && this.approxThreadCount.get() < highWaterMark
- && addThreadLock.tryLock()) {
- try {
- mainLock.lock();
- try {
- int ps = this.getPoolSize();
- int sz = executor.getQueue().size();
- int sz2 = this.getActiveCount();
-
- if ((sz + sz2) > ps) {
- // Needs --add-opens java.base/java.util.concurrent=ALL-UNNAMED for JDK16+
- ReflectionUtil.setAccessible(addWorkerMethod).invoke(executor, addWorkerArgs);
- }
- } catch (Exception exc) {
- //ignore
- } finally {
- mainLock.unlock();
- }
- } finally {
- addThreadLock.unlock();
- }
- }
- }
-
- // WorkQueue interface
- public void execute(Runnable work, long timeout) {
- try {
- execute(work);
- } catch (RejectedExecutionException ree) {
- try {
- if (!getExecutor().getQueue().offer(work, timeout, TimeUnit.MILLISECONDS)) {
- throw ree;
- }
- } catch (InterruptedException ie) {
- throw ree;
- }
- }
- }
-
- public synchronized void schedule(final Runnable work, final long delay) {
- if (delayQueue == null) {
- delayQueue = new DelayQueue<>();
- watchDog = new WatchDog(delayQueue);
- watchDog.setDaemon(true);
- watchDog.start();
- }
- delayQueue.put(new DelayedTaskWrapper(work, delay));
- }
-
- // AutomaticWorkQueue interface
-
- public void shutdown(boolean processRemainingWorkItems) {
- if (executor != null) {
- if (!processRemainingWorkItems) {
- executor.getQueue().clear();
- }
- executor.shutdown();
- }
- }
-
-
- /**
- * Gets the maximum size (capacity) of the backing queue.
- * @return the maximum size (capacity) of the backing queue.
- */
- public long getMaxSize() {
- return maxQueueSize;
- }
-
- /**
- * Gets the current size of the backing queue.
- * @return the current size of the backing queue.
- */
- public long getSize() {
- return executor == null ? 0 : executor.getQueue().size();
- }
-
-
- public boolean isEmpty() {
- return executor == null || executor.getQueue().isEmpty();
- }
-
- public boolean isFull() {
- return executor != null && executor.getQueue().remainingCapacity() == 0;
- }
-
- public int getHighWaterMark() {
- int hwm = executor == null ? highWaterMark : executor.getMaximumPoolSize();
- return hwm == Integer.MAX_VALUE ? -1 : hwm;
- }
-
- public int getLowWaterMark() {
- int lwm = executor == null ? lowWaterMark : executor.getCorePoolSize();
- return lwm == Integer.MAX_VALUE ? -1 : lwm;
- }
-
- public int getInitialSize() {
- return this.initialThreads;
- }
-
- public void setHighWaterMark(int hwm) {
- highWaterMark = hwm < 0 ? Integer.MAX_VALUE : hwm;
- if (executor != null) {
- notifyChangeListeners(new PropertyChangeEvent(this, "highWaterMark",
- this.executor.getMaximumPoolSize(), hwm));
- executor.setMaximumPoolSize(highWaterMark);
- }
- }
-
- public void setLowWaterMark(int lwm) {
- lowWaterMark = lwm < 0 ? 0 : lwm;
- if (executor != null) {
- notifyChangeListeners(new PropertyChangeEvent(this, "lowWaterMark",
- this.executor.getCorePoolSize(), lwm));
- executor.setCorePoolSize(lowWaterMark);
- }
- }
-
- public void setInitialSize(int initialSize) {
- notifyChangeListeners(new PropertyChangeEvent(this, "initialSize", this.initialThreads, initialSize));
- this.initialThreads = initialSize;
- }
-
- public void setQueueSize(int size) {
- notifyChangeListeners(new PropertyChangeEvent(this, "queueSize", this.maxQueueSize, size));
- this.maxQueueSize = size;
- }
-
- public void setDequeueTimeout(long l) {
- notifyChangeListeners(new PropertyChangeEvent(this, "dequeueTimeout", this.dequeueTimeout, l));
- this.dequeueTimeout = l;
- }
-
- public boolean isShutdown() {
- if (executor == null) {
- return false;
- }
- return executor.isShutdown();
- }
- public int getLargestPoolSize() {
- if (executor == null) {
- return 0;
- }
- return executor.getLargestPoolSize();
- }
- public int getPoolSize() {
- if (executor == null) {
- return 0;
- }
- return executor.getPoolSize();
- }
- public int getActiveCount() {
- if (executor == null) {
- return 0;
- }
- return executor.getActiveCount();
- }
- public void update(Dictionary<String, String> config) {
- String s = config.get("highWaterMark");
- if (s != null) {
- this.highWaterMark = Integer.parseInt(s);
- }
- s = config.get("lowWaterMark");
- if (s != null) {
- this.lowWaterMark = Integer.parseInt(s);
- }
- s = config.get("initialSize");
- if (s != null) {
- this.initialThreads = Integer.parseInt(s);
- }
- s = config.get("dequeueTimeout");
- if (s != null) {
- this.dequeueTimeout = Long.parseLong(s);
- }
- s = config.get("queueSize");
- if (s != null) {
- this.maxQueueSize = Integer.parseInt(s);
- }
- }
- public Dictionary<String, String> getProperties() {
- Dictionary<String, String> properties = new Hashtable<>();
- NumberFormat nf = NumberFormat.getIntegerInstance();
- properties.put("name", nf.format(getName()));
- properties.put("highWaterMark", nf.format(getHighWaterMark()));
- properties.put("lowWaterMark", nf.format(getLowWaterMark()));
- properties.put("initialSize", nf.format(getLowWaterMark()));
- properties.put("dequeueTimeout", nf.format(getLowWaterMark()));
- properties.put("queueSize", nf.format(getLowWaterMark()));
- return properties;
- }
-}
diff --git a/deps/pom.xml b/deps/pom.xml
index 21f9f1df0d..c54c076bd9 100644
--- a/deps/pom.xml
+++ b/deps/pom.xml
@@ -29,8 +29,6 @@
<modules>
<module>taglibs-shade</module>
- <module>cxf-shade</module>
- <module>cxf-rt-rs-mp-client-shade</module>
<module>sxc-shade</module>
<module>activemq-broker-shade</module>
<module>activemq-kahadb-store-shade</module>
diff --git a/examples/async-servlet/pom.xml b/examples/async-servlet/pom.xml
index f2392592ae..9e5d15baf4 100644
--- a/examples/async-servlet/pom.xml
+++ b/examples/async-servlet/pom.xml
@@ -21,7 +21,7 @@
<artifactId>async-servlet</artifactId>
<packaging>war</packaging>
<version>10.0.0-SNAPSHOT</version>
- <name>OpenEJB :: Examples :: Async Servlet</name>
+ <name>TomEE :: Examples :: Async Servlet</name>
<url>http://maven.apache.org</url>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
diff --git a/examples/bval-evaluation-redeployment/pom.xml b/examples/bval-evaluation-redeployment/pom.xml
index faf33aa8cd..dc8dcbd10a 100644
--- a/examples/bval-evaluation-redeployment/pom.xml
+++ b/examples/bval-evaluation-redeployment/pom.xml
@@ -23,6 +23,8 @@
<version>10.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
+ <name>TomEE :: Examples :: Bean Validation Evaluation on Re-Deployment</name>
+
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<tomee.test.version>10.0.0-SNAPSHOT</tomee.test.version>
diff --git a/examples/connector-ear/connector-sample-functional-tests/pom.xml b/examples/connector-ear/connector-sample-functional-tests/pom.xml
index 0cc2e19f99..3ef49115dc 100644
--- a/examples/connector-ear/connector-sample-functional-tests/pom.xml
+++ b/examples/connector-ear/connector-sample-functional-tests/pom.xml
@@ -88,13 +88,11 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
- <version>1.7.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/examples/jsonb-custom-serializer/pom.xml b/examples/jsonb-custom-serializer/pom.xml
index 9f33f7268b..ba1791c074 100644
--- a/examples/jsonb-custom-serializer/pom.xml
+++ b/examples/jsonb-custom-serializer/pom.xml
@@ -42,7 +42,7 @@
<dependency>
<groupId>org.apache.tomee</groupId>
<artifactId>openejb-cxf-rs</artifactId>
- <version>10.0.0-SNAPSHOT</version>
+ <version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/examples/mp-opentracing-traced/pom.xml b/examples/mp-opentracing-traced/pom.xml
index 06ab1079c4..7c4373b393 100644
--- a/examples/mp-opentracing-traced/pom.xml
+++ b/examples/mp-opentracing-traced/pom.xml
@@ -19,7 +19,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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.superbiz</groupId>
- <artifactId>mp-opentracing.traced</artifactId>
+ <artifactId>mp-opentracing-traced</artifactId>
<name>TomEE :: Examples :: MicroProfile OpenTracing Traced</name>
<version>10.0.0-SNAPSHOT</version>
<packaging>war</packaging>
diff --git a/examples/serverless-builder/pom.xml b/examples/serverless-builder/pom.xml
index a0c048f9cc..16a017d4c0 100644
--- a/examples/serverless-builder/pom.xml
+++ b/examples/serverless-builder/pom.xml
@@ -22,7 +22,7 @@
<artifactId>serverless-builder</artifactId>
<version>10.0.0-SNAPSHOT</version>
- <name>TomEE :: Examples :: Serverless Apache TomEE WebProfile</name>
+ <name>TomEE :: Examples :: Serverless Builder</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
diff --git a/examples/serverless-tomee-plume/pom.xml b/examples/serverless-tomee-plume/pom.xml
index 7614a5bff1..d2a3b4a91d 100644
--- a/examples/serverless-tomee-plume/pom.xml
+++ b/examples/serverless-tomee-plume/pom.xml
@@ -31,7 +31,7 @@
<dependencies>
<dependency>
<groupId>org.apache.tomee.bom</groupId>
- <artifactId>tomee-webprofile</artifactId>
+ <artifactId>tomee-plume</artifactId>
<version>${version.tomee}</version>
</dependency>
<dependency>
diff --git a/pom.xml b/pom.xml
index d3e458463b..87388c1dac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -210,7 +210,7 @@
<version.activemq>5.18.1</version.activemq>
<version.batchee>1.0.2</version.batchee>
<version.bval>2.0.6</version.bval>
- <version.cxf>3.5.5</version.cxf>
+ <version.cxf>4.0.3-SNAPSHOT</version.cxf>
<version.geronimo.components>3.1.5</version.geronimo.components>
<!-- we currently rely on Mail Impl. from Geronimo, this might change in the future -->
<version.geronimo-mail_2.1_provider>1.0.0</version.geronimo-mail_2.1_provider>
@@ -1187,6 +1187,150 @@
<classifier>jakarta</classifier>
<version>${version.bval}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-core</artifactId>
+ <version>${version.cxf}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.eclipse.angus</groupId>
+ <artifactId>angus-activation</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.annotation</groupId>
+ <artifactId>jakarta.annotation-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.glassfish.jaxb</groupId>
+ <artifactId>jaxb-runtime</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.xml.bind</groupId>
+ <artifactId>jakarta.xml.bind-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http</artifactId>
+ <version>${version.cxf}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-client</artifactId>
+ <version>${version.cxf}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.glassfish.jaxb</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.activation</groupId>
+ <artifactId>jakarta.activation-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.glassfish.jaxb</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>${version.cxf}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.eclipse.angus</groupId>
+ <artifactId>angus-mail</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.eclipse.angus</groupId>
+ <artifactId>angus-activation</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.xml.soap</groupId>
+ <artifactId>jakarta.xml.soap-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.jws</groupId>
+ <artifactId>jakarta.jws-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.xml.ws</groupId>
+ <artifactId>jakarta.xml.ws-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ <version>${version.cxf}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.eclipse.angus</groupId>
+ <artifactId>angus-mail</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.eclipse.angus</groupId>
+ <artifactId>angus-activation</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.xml.soap</groupId>
+ <artifactId>jakarta.xml.soap-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.jws</groupId>
+ <artifactId>jakarta.jws-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.xml.ws</groupId>
+ <artifactId>jakarta.xml.ws-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.ws.rs</groupId>
+ <artifactId>jakarta.ws.rs-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.annotation</groupId>
+ <artifactId>jakarta.annotation-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-security</artifactId>
+ <version>${version.cxf}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.ehcache</groupId>
+ <artifactId>ehcache</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-sse</artifactId>
+ <version>${version.cxf}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-management</artifactId>
+ <version>${version.cxf}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-service-description</artifactId>
+ <version>${version.cxf}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-extension-providers</artifactId>
+ <version>${version.cxf}</version>
+ </dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
diff --git a/server/openejb-cxf-rs/pom.xml b/server/openejb-cxf-rs/pom.xml
index 42e9e9de3a..512850cfc5 100644
--- a/server/openejb-cxf-rs/pom.xml
+++ b/server/openejb-cxf-rs/pom.xml
@@ -31,45 +31,6 @@
</properties>
<dependencies>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>cxf-shade</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.glassfish.jaxb</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jakarta.annotation</groupId>
- <artifactId>jakarta.annotation-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jakarta.activation</groupId>
- <artifactId>jakarta.activation-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jakarta.ws.rs</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xalan</groupId>
- <artifactId>xalan</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xalan</groupId>
- <artifactId>serializer</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>openejb-http</artifactId>
@@ -85,7 +46,26 @@
<artifactId>openejb-cxf-transport</artifactId>
<version>${project.version}</version>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-sse</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-service-description</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-extension-providers</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-spi</artifactId>
@@ -122,7 +102,6 @@
<artifactId>johnzon-mapper</artifactId>
<classifier>jakarta</classifier>
</dependency>
-
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
diff --git a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRSService.java b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRSService.java
index 70d52549a7..b2eea0bac9 100644
--- a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRSService.java
+++ b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRSService.java
@@ -227,7 +227,9 @@ public class CxfRSService extends RESTService {
List<String> jsonProviders;
String userConfiguredJsonProviders = SystemInstance.get().getProperty("openejb.jaxrs.jsonProviders");
if (userConfiguredJsonProviders == null) {
- jsonProviders = Collections.emptyList();
+ jsonProviders = asList(
+ "org.apache.openejb.server.cxf.rs.johnzon.TomEEJsonbProvider",
+ "org.apache.openejb.server.cxf.rs.johnzon.TomEEJsonpProvider");
} else {
jsonProviders = asList(userConfiguredJsonProviders.split(","));
}
diff --git a/server/openejb-cxf-transport/pom.xml b/server/openejb-cxf-transport/pom.xml
index 51d1a54ab3..e8282c47bf 100644
--- a/server/openejb-cxf-transport/pom.xml
+++ b/server/openejb-cxf-transport/pom.xml
@@ -31,29 +31,22 @@
</properties>
<dependencies>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>cxf-shade</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.glassfish.jaxb</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jakarta.activation</groupId>
- <artifactId>jakarta.activation-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>openejb-http</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-management</artifactId>
+ </dependency>
</dependencies>
</project>
diff --git a/server/openejb-cxf/pom.xml b/server/openejb-cxf/pom.xml
index b2f2eb1647..0dc1d9e153 100644
--- a/server/openejb-cxf/pom.xml
+++ b/server/openejb-cxf/pom.xml
@@ -55,6 +55,18 @@
<artifactId>openejb-cxf-transport</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-security</artifactId>
+ </dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
@@ -201,21 +213,6 @@
<artifactId>jaxb-runtime</artifactId>
<type>pom</type>
</dependency>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>cxf-shade</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.glassfish.jaxb</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
@@ -239,6 +236,12 @@
<version>1.4.5</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
diff --git a/tck/microprofile-tck/jwt/pom.xml b/tck/microprofile-tck/jwt/pom.xml
index 2b9711bdef..12981acb31 100644
--- a/tck/microprofile-tck/jwt/pom.xml
+++ b/tck/microprofile-tck/jwt/pom.xml
@@ -46,35 +46,6 @@
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>cxf-shade</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.glassfish.jaxb</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jakarta.ws.rs</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jakarta.annotation</groupId>
- <artifactId>jakarta.annotation-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jakarta.activation</groupId>
- <artifactId>jakarta.activation-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
<dependency>
<groupId>org.apache.johnzon</groupId>
<artifactId>johnzon-core</artifactId>
@@ -150,6 +121,12 @@
<artifactId>tomcat-catalina</artifactId>
<version>${tomcat.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-client</artifactId>
+ <version>${version.cxf}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/tck/microprofile-tck/openapi/pom.xml b/tck/microprofile-tck/openapi/pom.xml
index a09f7c3b8b..a6f1ba5546 100644
--- a/tck/microprofile-tck/openapi/pom.xml
+++ b/tck/microprofile-tck/openapi/pom.xml
@@ -152,30 +152,6 @@
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>cxf-shade</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.glassfish.jaxb</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jakarta.ws.rs</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jakarta.annotation</groupId>
- <artifactId>jakarta.annotation-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
</dependencies>
</project>
diff --git a/tck/microprofile-tck/opentracing/pom.xml b/tck/microprofile-tck/opentracing/pom.xml
index 961711f31d..24c68f30c5 100644
--- a/tck/microprofile-tck/opentracing/pom.xml
+++ b/tck/microprofile-tck/opentracing/pom.xml
@@ -112,9 +112,9 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>cxf-rt-rs-mp-client-shade</artifactId>
- <version>${project.version}</version>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-client</artifactId>
+ <version>${version.cxf}</version>
<scope>test</scope>
</dependency>
<!--
diff --git a/tck/microprofile-tck/rest-client/pom.xml b/tck/microprofile-tck/rest-client/pom.xml
index 6eab9a4bfe..8263f6e267 100644
--- a/tck/microprofile-tck/rest-client/pom.xml
+++ b/tck/microprofile-tck/rest-client/pom.xml
@@ -63,22 +63,34 @@
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>3.0.0-M6</version>
- <configuration>
- <suiteXmlFiles>
- <suiteXmlFile>tck-suite.xml</suiteXmlFile>
- </suiteXmlFiles>
- <!--
- <dependenciesToScan>
- <dependency>org.eclipse.microprofile.rest.client:microprofile-rest-client-tck</dependency>
- </dependenciesToScan>
- -->
- <excludes>
- <!-- TODO - Remove once issue https://github.com/eclipse/microprofile-rest-client/issues/166 is solved -->
- <exclude>org.eclipse.microprofile.rest.client.tck.InvokeWithJsonBProviderTest</exclude>
- </excludes>
- </configuration>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <suiteXmlFiles>
+ <suiteXmlFile>tck-suite.xml</suiteXmlFile>
+ </suiteXmlFiles>
+ </configuration>
+ </execution>
+ <execution>
+ <id>mp-clienb-jsonb-solo</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <suiteXmlFiles>
+ <suiteXmlFile>tck-suite-jsonb-solo.xml</suiteXmlFile>
+ </suiteXmlFiles>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
</plugins>
</build>
@@ -217,32 +229,36 @@
<scope>test</scope>
</dependency>
-
<dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>cxf-shade</artifactId>
- <version>${project.version}</version>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-mp-client</artifactId>
+ <version>${version.cxf}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.glassfish.jaxb</groupId>
- <artifactId>*</artifactId>
+ <artifactId>jaxb-xjc</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.json</groupId>
+ <artifactId>jakarta.json-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.json.bind</groupId>
+ <artifactId>jakarta.json.bind-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.ws.rs</groupId>
- <artifactId>*</artifactId>
+ <artifactId>jakarta.ws.rs-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</exclusion>
- <exclusion>
- <groupId>jakarta.json</groupId>
- <artifactId>jakarta.json-api</artifactId>
- </exclusion>
</exclusions>
</dependency>
+
<dependency>
<groupId>org.apache.johnzon</groupId>
<artifactId>johnzon-core</artifactId>
diff --git a/tck/microprofile-tck/rest-client/tck-dev.xml b/tck/microprofile-tck/rest-client/tck-dev.xml
index 8c702dfd90..bdbb509513 100644
--- a/tck/microprofile-tck/rest-client/tck-dev.xml
+++ b/tck/microprofile-tck/rest-client/tck-dev.xml
@@ -20,7 +20,7 @@
<test name="microprofile-rest-client TCK">
<classes>
- <class name="org.eclipse.microprofile.rest.client.tck.ClientHeaderParamTest"></class>
+ <class name="org.eclipse.microprofile.rest.client.tck.jsonb.InvokeWithJsonBProviderTest"></class>
</classes>
</test>
diff --git a/tck/microprofile-tck/rest-client/tck-dev.xml b/tck/microprofile-tck/rest-client/tck-suite-jsonb-solo.xml
similarity index 88%
copy from tck/microprofile-tck/rest-client/tck-dev.xml
copy to tck/microprofile-tck/rest-client/tck-suite-jsonb-solo.xml
index 8c702dfd90..973f2adf76 100644
--- a/tck/microprofile-tck/rest-client/tck-dev.xml
+++ b/tck/microprofile-tck/rest-client/tck-suite-jsonb-solo.xml
@@ -19,9 +19,9 @@
<suite name="microprofile-rest-client-TCK" verbose="2" configfailurepolicy="continue" >
<test name="microprofile-rest-client TCK">
- <classes>
- <class name="org.eclipse.microprofile.rest.client.tck.ClientHeaderParamTest"></class>
- </classes>
+ <packages>
+ <package name="org.eclipse.microprofile.rest.client.tck.jsonb.*"></package>
+ </packages>
</test>
</suite>
\ No newline at end of file
diff --git a/tck/microprofile-tck/rest-client/tck-suite.xml b/tck/microprofile-tck/rest-client/tck-suite.xml
index bfe81eb405..49ddb969fb 100644
--- a/tck/microprofile-tck/rest-client/tck-suite.xml
+++ b/tck/microprofile-tck/rest-client/tck-suite.xml
@@ -21,8 +21,10 @@
<test name="microprofile-rest-client TCK">
<packages>
<package name="org.eclipse.microprofile.rest.client.tck.*">
- <!-- bug in MyEventSourceServlet which depends on javax servlet api -->
+ <!-- bug in MyEventSourceServlet which depends on javax servlet api, see https://github.com/eclipse/microprofile-rest-client/issues/316-->
<exclude name="org.eclipse.microprofile.rest.client.tck.sse.*"></exclude>
+ <!-- will pass if run in solo mode -->
+ <exclude name="org.eclipse.microprofile.rest.client.tck.jsonb.*"></exclude>
</package>
</packages>
</test>
diff --git a/tomee/tomee-microprofile/mp-common/pom.xml b/tomee/tomee-microprofile/mp-common/pom.xml
index 826cbbbc40..415d5fe39c 100644
--- a/tomee/tomee-microprofile/mp-common/pom.xml
+++ b/tomee/tomee-microprofile/mp-common/pom.xml
@@ -301,14 +301,41 @@
</dependency>
<dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>cxf-rt-rs-mp-client-shade</artifactId>
- <version>${project.version}</version>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-mp-client</artifactId>
+ <version>${version.cxf}</version>
<exclusions>
- <!-- exclude in favor of cxf-shade -->
<exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
+ <groupId>org.glassfish.jaxb</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.json</groupId>
+ <artifactId>javax.json-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.ws.rs</groupId>
+ <artifactId>jakarta.ws.rs-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.activation</groupId>
+ <artifactId>jakarta.activation-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.json.bind</groupId>
+ <artifactId>jakarta.json.bind-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.json</groupId>
+ <artifactId>jakarta.json-api</artifactId>
</exclusion>
</exclusions>
</dependency>
diff --git a/tomee/tomee-microprofile/tomee-microprofile-webapp/pom.xml b/tomee/tomee-microprofile/tomee-microprofile-webapp/pom.xml
index ec284c8d10..6e53241ece 100644
--- a/tomee/tomee-microprofile/tomee-microprofile-webapp/pom.xml
+++ b/tomee/tomee-microprofile/tomee-microprofile-webapp/pom.xml
@@ -53,12 +53,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>mp-common</artifactId>
<version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
@@ -81,10 +75,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>jakartaee-api</artifactId>
</exclusion>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -96,10 +86,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>jakartaee-api</artifactId>
</exclusion>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
</exclusions>
</dependency>
<dependency>
diff --git a/tomee/tomee-microprofile/tomee-microprofile-webapp/src/main/assembly/war.xml b/tomee/tomee-microprofile/tomee-microprofile-webapp/src/main/assembly/war.xml
index 35a661b910..8a8feef5b1 100644
--- a/tomee/tomee-microprofile/tomee-microprofile-webapp/src/main/assembly/war.xml
+++ b/tomee/tomee-microprofile/tomee-microprofile-webapp/src/main/assembly/war.xml
@@ -92,7 +92,6 @@
<exclude>org.apache.activemq:activemq-ra</exclude>
<exclude>org.apache.commons.dbcp2:*</exclude>
<exclude>commons-fileupload:*</exclude>
- <exclude>org.apache.cxf:*</exclude>
<exclude>org.metatype.sxc:*</exclude>
<exclude>org.apache.taglibs:*</exclude>
diff --git a/tomee/tomee-plume-webapp/pom.xml b/tomee/tomee-plume-webapp/pom.xml
index 0402e03d09..4b57cd4961 100644
--- a/tomee/tomee-plume-webapp/pom.xml
+++ b/tomee/tomee-plume-webapp/pom.xml
@@ -83,12 +83,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>mp-common</artifactId>
<version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
@@ -140,10 +134,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>jakartaee-api</artifactId>
</exclusion>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -155,10 +145,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>jakartaee-api</artifactId>
</exclusion>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
</exclusions>
</dependency>
<dependency>
diff --git a/tomee/tomee-plume-webapp/src/main/assembly/war.xml b/tomee/tomee-plume-webapp/src/main/assembly/war.xml
index 227c0afb5d..9106bd3084 100644
--- a/tomee/tomee-plume-webapp/src/main/assembly/war.xml
+++ b/tomee/tomee-plume-webapp/src/main/assembly/war.xml
@@ -111,7 +111,6 @@
<exclude>org.apache.activemq:activemq-ra</exclude>
<exclude>org.apache.commons.dbcp2:*</exclude>
<exclude>commons-fileupload:*</exclude>
- <exclude>org.apache.cxf:*</exclude>
<exclude>org.metatype.sxc:*</exclude>
<exclude>org.apache.taglibs:*</exclude>
diff --git a/tomee/tomee-plus-webapp/pom.xml b/tomee/tomee-plus-webapp/pom.xml
index fbd7e85b09..d046ed65bd 100644
--- a/tomee/tomee-plus-webapp/pom.xml
+++ b/tomee/tomee-plus-webapp/pom.xml
@@ -80,12 +80,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>mp-common</artifactId>
<version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
@@ -132,10 +126,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>jakartaee-api</artifactId>
</exclusion>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -147,10 +137,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>jakartaee-api</artifactId>
</exclusion>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
</exclusions>
</dependency>
<dependency>
diff --git a/tomee/tomee-plus-webapp/src/main/assembly/war.xml b/tomee/tomee-plus-webapp/src/main/assembly/war.xml
index c0d3995690..40ae4fe9cb 100644
--- a/tomee/tomee-plus-webapp/src/main/assembly/war.xml
+++ b/tomee/tomee-plus-webapp/src/main/assembly/war.xml
@@ -105,7 +105,6 @@
<exclude>org.apache.activemq:activemq-ra</exclude>
<exclude>org.apache.commons.dbcp2:*</exclude>
<exclude>commons-fileupload:*</exclude>
- <exclude>org.apache.cxf:*</exclude>
<exclude>org.metatype.sxc:*</exclude>
<exclude>org.apache.taglibs:*</exclude>
diff --git a/tomee/tomee-webapp/pom.xml b/tomee/tomee-webapp/pom.xml
index 6e372ef964..8806aca64e 100644
--- a/tomee/tomee-webapp/pom.xml
+++ b/tomee/tomee-webapp/pom.xml
@@ -207,10 +207,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>jakartaee-api</artifactId>
</exclusion>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -223,10 +219,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>jakartaee-api</artifactId>
</exclusion>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>*</artifactId>
- </exclusion>
</exclusions>
</dependency>
<dependency>
diff --git a/tomee/tomee-webapp/src/main/assembly/war.xml b/tomee/tomee-webapp/src/main/assembly/war.xml
index 5a8b9a886d..2ddf1e4df9 100644
--- a/tomee/tomee-webapp/src/main/assembly/war.xml
+++ b/tomee/tomee-webapp/src/main/assembly/war.xml
@@ -96,7 +96,6 @@
<exclude>org.eclipse.microprofile.rest.client:*</exclude>
<exclude>org.reactivestreams:*</exclude>
<exclude>org.opensaml:*</exclude>
- <exclude>org.apache.wss4j:*</exclude>
<!-- wars and pom -->
<exclude>*:war</exclude>
@@ -116,7 +115,6 @@
<exclude>org.apache.activemq:activemq-ra</exclude>
<exclude>org.apache.commons.dbcp2:*</exclude>
<exclude>commons-fileupload:*</exclude>
- <exclude>org.apache.cxf:*</exclude>
<exclude>org.metatype.sxc:*</exclude>
<exclude>org.apache.taglibs:*</exclude>