This is an automated email from the ASF dual-hosted git repository.
Croway pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new dc0681a57ecd CAMEL-27030: Migrate Undertow servlet dependencies to
Undertow EE (#30200)
dc0681a57ecd is described below
commit dc0681a57ecd7dd5c1380afe041b681a6c8ac437
Author: Federico Mariani <[email protected]>
AuthorDate: Tue Nov 17 12:03:21 2026 +0100
CAMEL-27030: Migrate Undertow servlet dependencies to Undertow EE (#30200)
* CAMEL-27030: Migrate Undertow servlet dependencies to Undertow EE
Use Undertow EE 2.0.3.Final for the Jakarta Servlet 6.1 implementation,
keeping Undertow core at 2.4.4.Final. Align the affected servlet test
fixtures and document the dependency-coordinate and parent-property changes.
Add an asynchronous Servlet 6.1 deployment test alongside a Camel Undertow
consumer to cover coexistence with the new servlet implementation.
* CAMEL-27030: Document the Undertow EE migration for 4.22.3
---
components/camel-cxf/camel-cxf-spring-soap/pom.xml | 4 +-
components/camel-oauth/pom.xml | 4 +-
components/camel-servlet/pom.xml | 4 +-
components/camel-undertow/pom.xml | 4 +-
.../component/undertow/UndertowServlet61Test.java | 115 +++++++++++++++++++++
.../ROOT/pages/camel-4x-upgrade-guide-4_22.adoc | 14 +++
.../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 14 +++
parent/pom.xml | 2 +-
8 files changed, 152 insertions(+), 9 deletions(-)
diff --git a/components/camel-cxf/camel-cxf-spring-soap/pom.xml
b/components/camel-cxf/camel-cxf-spring-soap/pom.xml
index 97b871883387..f45dee5f9aa1 100644
--- a/components/camel-cxf/camel-cxf-spring-soap/pom.xml
+++ b/components/camel-cxf/camel-cxf-spring-soap/pom.xml
@@ -145,9 +145,9 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>io.undertow</groupId>
+ <groupId>io.undertow.ee</groupId>
<artifactId>undertow-servlet</artifactId>
- <version>${undertow-servlet-version}</version>
+ <version>${undertow-ee-version}</version>
<scope>test</scope>
</dependency>
diff --git a/components/camel-oauth/pom.xml b/components/camel-oauth/pom.xml
index 4b2db347f188..43e6bd8c3fa6 100644
--- a/components/camel-oauth/pom.xml
+++ b/components/camel-oauth/pom.xml
@@ -114,9 +114,9 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>io.undertow</groupId>
+ <groupId>io.undertow.ee</groupId>
<artifactId>undertow-servlet</artifactId>
- <version>${undertow-servlet-version}</version>
+ <version>${undertow-ee-version}</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-servlet/pom.xml b/components/camel-servlet/pom.xml
index a129655ba8d1..f4599d2500c7 100644
--- a/components/camel-servlet/pom.xml
+++ b/components/camel-servlet/pom.xml
@@ -113,9 +113,9 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>io.undertow</groupId>
+ <groupId>io.undertow.ee</groupId>
<artifactId>undertow-servlet</artifactId>
- <version>${undertow-servlet-version}</version>
+ <version>${undertow-ee-version}</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-undertow/pom.xml
b/components/camel-undertow/pom.xml
index e8c296d65986..f692b47ae6d2 100644
--- a/components/camel-undertow/pom.xml
+++ b/components/camel-undertow/pom.xml
@@ -57,9 +57,9 @@
<version>${undertow-version}</version>
</dependency>
<dependency>
- <groupId>io.undertow</groupId>
+ <groupId>io.undertow.ee</groupId>
<artifactId>undertow-servlet</artifactId>
- <version>${undertow-servlet-version}</version>
+ <version>${undertow-ee-version}</version>
</dependency>
<!-- testing -->
diff --git
a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowServlet61Test.java
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowServlet61Test.java
new file mode 100644
index 000000000000..dbbf6ab95658
--- /dev/null
+++
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowServlet61Test.java
@@ -0,0 +1,115 @@
+/*
+ * 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.camel.component.undertow;
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+import java.time.Duration;
+
+import jakarta.servlet.AsyncContext;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+
+import io.undertow.Undertow;
+import io.undertow.servlet.Servlets;
+import io.undertow.servlet.api.DeploymentManager;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class UndertowServlet61Test extends BaseUndertowTest {
+
+ @Test
+ void servlet61AndCamelConsumerCoexist() throws Exception {
+ DeploymentManager deployment =
Servlets.newContainer().addDeployment(Servlets.deployment()
+ .setClassLoader(getClass().getClassLoader())
+ .setContextPath("/")
+ .setDeploymentName("servlet61")
+ .addServlet(Servlets.servlet("echo", AsyncEchoServlet.class)
+ .addMapping("/servlet").setAsyncSupported(true)));
+ deployment.deploy();
+ Undertow server = null;
+ try {
+ server = Undertow.builder().addHttpListener(getPort2(),
"localhost")
+ .setHandler(deployment.start()).build();
+ server.start();
+
+ assertEquals(6,
deployment.getDeployment().getServletContext().getMajorVersion());
+ assertEquals(1,
deployment.getDeployment().getServletContext().getMinorVersion());
+ try (HttpClient client = HttpClient.newHttpClient()) {
+ HttpResponse<String> servlet =
client.send(HttpRequest.newBuilder()
+ .uri(URI.create("http://localhost:" + getPort2() +
"/servlet"))
+ .timeout(Duration.ofSeconds(10))
+ .POST(HttpRequest.BodyPublishers.ofString("Hello
Servlet"))
+ .build(), HttpResponse.BodyHandlers.ofString());
+ assertEquals(200, servlet.statusCode());
+ assertEquals("Hello Servlet", servlet.body());
+
+ HttpResponse<String> camel =
client.send(HttpRequest.newBuilder()
+ .uri(URI.create("http://localhost:" + getPort() +
"/camel"))
+ .timeout(Duration.ofSeconds(10))
+ .POST(HttpRequest.BodyPublishers.ofString("Hello
Camel"))
+ .build(), HttpResponse.BodyHandlers.ofString());
+ assertEquals(200, camel.statusCode());
+ assertEquals("Hello Camel", camel.body());
+ }
+ } finally {
+ if (server != null) {
+ server.stop();
+ }
+ deployment.stop();
+ deployment.undeploy();
+ }
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("undertow:http://localhost:{{port}}/camel")
+ .convertBodyTo(String.class);
+ }
+ };
+ }
+
+ public static class AsyncEchoServlet extends HttpServlet {
+
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse
response) {
+ AsyncContext async = request.startAsync();
+ async.start(() -> {
+ try {
+ response.setCharacterEncoding(StandardCharsets.UTF_8);
+
response.getOutputStream().write(ByteBuffer.wrap(request.getInputStream().readAllBytes()));
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ } finally {
+ async.complete();
+ }
+ });
+ }
+ }
+}
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
index 59dd5fd7c2c7..56ade44c6d8b 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
@@ -13,6 +13,20 @@ See the xref:camel-upgrade-recipes-tool.adoc[documentation]
page for details.
== Upgrading from 4.22.2 to 4.22.3
+=== Undertow servlet implementation
+
+`camel-undertow` now uses the Jakarta Servlet 6.1 implementation from Undertow
EE,
+`io.undertow.ee:undertow-servlet:2.0.3.Final`, instead of
`io.undertow:undertow-servlet`.
+Undertow core is upgraded from `2.4.2.Final` to `2.4.4.Final` to match this
Undertow EE release.
+The Camel parent property for the servlet implementation changes from
`undertow-servlet-version`
+to `undertow-ee-version`.
+
+Applications that declare or override the Undertow servlet dependency must
migrate to the new coordinates.
+Remove or exclude the old servlet artifact from other dependencies: the two
artifacts contain the same
+`io.undertow.servlet` packages and must not be included together.
+This also applies when combining `camel-undertow` with a Spring Boot Undertow
server integration
+that uses Undertow EE.
+
=== camel-aws2-sns - string array message attributes
String values in list-valued message headers are now JSON-escaped when mapped
to SNS
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index a3fa2a04f84e..c1c5b8ad02af 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -13,6 +13,20 @@ See the xref:camel-upgrade-recipes-tool.adoc[documentation]
page for details.
== Upgrading Camel 4.23 to 4.24
+=== Undertow servlet implementation
+
+`camel-undertow` now uses the Jakarta Servlet 6.1 implementation from Undertow
EE,
+`io.undertow.ee:undertow-servlet`, instead of `io.undertow:undertow-servlet`.
+Undertow core continues to use `io.undertow:undertow-core` and has its own
version.
+The Camel parent property for the servlet implementation changes from
`undertow-servlet-version`
+to `undertow-ee-version`.
+
+Applications that declare or override the Undertow servlet dependency must
migrate to the new coordinates.
+Remove or exclude the old servlet artifact from other dependencies: the two
artifacts contain the same
+`io.undertow.servlet` packages and must not be included together.
+This also applies when combining `camel-undertow` with a Spring Boot Undertow
server integration
+that uses Undertow EE.
+
=== camel-opa - batch fail-open marker
Batch evaluation now sets `CamelOpaDecisionFailedOpen=true` when any element
proceeds because its decision point
diff --git a/parent/pom.xml b/parent/pom.xml
index b5be0dbafdd8..f928c3e2d71d 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -546,7 +546,7 @@
<tika-version>4.1.0</tika-version>
<twilio-version>13.1.0</twilio-version>
<twitter4j-version>4.1.2</twitter4j-version>
- <undertow-servlet-version>2.3.27.Final</undertow-servlet-version>
+ <undertow-ee-version>2.0.3.Final</undertow-ee-version>
<undertow-version>2.4.4.Final</undertow-version>
<univocity-parsers-version>2.10.2</univocity-parsers-version>
<velocity-tools-version>3.1</velocity-tools-version>