You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2024/01/22 17:32:26 UTC
(cxf) branch CXF-8671 updated: Update to Jetty 12 (#1633)
This is an automated email from the ASF dual-hosted git repository.
ffang pushed a commit to branch CXF-8671
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/CXF-8671 by this push:
new c1704e7c39 Update to Jetty 12 (#1633)
c1704e7c39 is described below
commit c1704e7c39472198873854d88ce79f63e7e980da
Author: Freeman(Yue) Fang <fr...@gmail.com>
AuthorDate: Mon Jan 22 12:32:18 2024 -0500
Update to Jetty 12 (#1633)
* Update to Jetty 12
---
distribution/javadoc/pom.xml | 14 +-
.../release/samples/groovy_spring_support/pom.xml | 4 +-
.../samples/java_first_spring_support/pom.xml | 4 +-
.../samples/jax_rs/basic_http2_jetty/pom.xml | 2 +-
.../samples/jax_rs/description_openapi_v3/pom.xml | 4 +-
.../src/main/release/samples/jax_rs/search/pom.xml | 4 +-
.../release/samples/jax_rs/spring_security/pom.xml | 4 +-
.../main/release/samples/jax_rs/sse_cdi/pom.xml | 9 +-
.../main/release/samples/jax_rs/sse_spring/pom.xml | 8 +-
.../release/samples/jax_rs/tracing_brave/pom.xml | 4 +-
.../samples/jax_rs/tracing_opentracing/pom.xml | 4 +-
.../main/release/samples/jax_rs/websocket/pom.xml | 9 +-
distribution/src/main/release/samples/pom.xml | 1 -
.../release/samples/ruby_spring_support/pom.xml | 4 +-
parent/pom.xml | 46 ++-
.../impl/tl/ThreadLocalHttpServletRequest.java | 15 +-
.../jaxrs/provider/RequestDispatcherProvider.java | 26 ++
.../java/org/apache/cxf/jaxrs/utils/HttpUtils.java | 5 +
.../src/test/resources/XMLHttpRequestTestBeans.xml | 10 +-
rt/rs/microprofile-client/pom.xml | 6 +-
.../oauth2/filters/OAuthRequestFilter.java | 10 +-
rt/transports/http-jetty/pom.xml | 14 +-
.../transport/http_jetty/JettyContextHandler.java | 62 ---
.../transport/http_jetty/JettyHTTPDestination.java | 28 +-
.../cxf/transport/http_jetty/JettyHTTPHandler.java | 38 +-
.../http_jetty/JettyHTTPServerEngine.java | 431 +++++++++++++++++----
.../http_jetty/JettyHTTPDestinationTest.java | 18 +-
.../http_jetty/JettyHTTPServerEngineTest.java | 107 ++---
.../transport/http_jetty/JettyHTTPTestHandler.java | 35 +-
.../netty/server/servlet/NettyHttpSession.java | 2 +-
.../transport/http/AbstractHTTPDestination.java | 24 +-
.../cxf/transport/servlet/AbstractHTTPServlet.java | 15 +-
rt/transports/websocket/pom.xml | 25 +-
.../websocket/WebSocketDestinationFactory.java | 2 +-
.../AtmosphereWebSocketJettyDestination.java | 10 +-
.../jetty/WebSocketVirtualServletRequest.java | 22 +-
.../jetty/WebSocketVirtualServletResponse.java | 15 +-
.../Jetty12WebSocketDestination.java} | 140 ++++---
.../JettyWebSocketHandler.java | 42 +-
.../undertow/WebSocketUndertowServletRequest.java | 19 +-
.../undertow/WebSocketUndertowServletResponse.java | 22 +-
.../jetty/JettyWebSocketDestinationTest.java | 17 +-
systests/cdi/base/pom.xml | 14 +-
.../cdi/base/jetty/AbstractJettyServer.java | 13 +-
systests/cdi/pom.xml | 11 -
systests/databinding/pom.xml | 4 +-
.../org/apache/cxf/systest/aegis/AegisServer.java | 22 +-
systests/jaxrs/pom.xml | 61 +--
.../cxf/systest/jaxrs/AbstractSpringServer.java | 22 +-
.../jaxrs/BookCxfContinuationServlet3Server.java | 10 +-
.../systest/jaxrs/form/FormWithFilterServer.java | 14 +-
.../nonspring/NonSpringJaxrsServletBookServer.java | 4 +-
.../NonSpringJaxrsServletBookServer2.java | 4 +-
.../systest/jaxrs/security/BookLoginModule.java | 4 +-
.../systest/jaxrs/security/BookLoginService.java | 2 +-
.../security/BookServerSecuritySpringClass.java | 39 +-
.../jaxrs/security/BookServerSimpleSecurity.java | 6 +-
...erverWebSocketSpringWebAppNoAtmosphereTest.java | 5 +-
...JAXRSClientServerWebSocketSpringWebAppTest.java | 5 +-
.../jaxrs/websocket/WebSocketTestClient.java | 6 +-
.../resources/jaxrs_dispatch/WEB-INF/beans.xml | 2 +-
systests/jaxws/pom.xml | 11 +-
systests/microprofile/client/async/pom.xml | 6 +-
systests/microprofile/client/nocdi/pom.xml | 2 +-
systests/microprofile/client/tracing/pom.xml | 43 --
systests/microprofile/client/weld/pom.xml | 20 +-
systests/rs-http-sci/pom.xml | 24 +-
.../jaxrs/servlet/jetty/AbstractJettyServer.java | 10 +-
.../servlet/jetty/JettyEmptyApplicationTest.java | 11 +-
.../jetty/JettyEmptyPathApplicationTest.java | 13 +-
.../servlet/jetty/JettyNoApplicationTest.java | 10 +-
.../JettySingleApplicationOnlyClassesTest.java | 8 +-
.../JettySingleApplicationOnlySingletonsTest.java | 8 +-
.../servlet/jetty/JettySingleApplicationTest.java | 8 +-
systests/rs-security/pom.xml | 4 +-
systests/rs-sse/rs-sse-jetty/pom.xml | 26 +-
.../jaxrs/sse/jetty/AbstractJettyServer.java | 15 +-
systests/tracing/pom.xml | 15 -
systests/transport-hc5/pom.xml | 6 +-
.../cxf/systest/hc5/http/auth/DigestServer.java | 13 +-
systests/transport-jms/pom.xml | 8 +-
systests/transports/pom.xml | 22 +-
.../http/auth/DigestAuthSupplierJettyTest.java | 22 +-
.../apache/cxf/systest/http/auth/DigestServer.java | 27 +-
.../cxf/systest/http2_jetty/Http2TestClient.java | 32 +-
.../systest/http_jetty/EngineLifecycleTest.java | 10 +-
.../cxf/systest/servlet/AbstractJettyServer.java | 15 +-
.../cxf/systest/servlet/NoSpringServletServer.java | 10 +-
.../cxf/systest/servlet/resolver/ResolverTest.java | 13 +-
.../apache/cxf/systest/http_jetty/jetty-engine.xml | 14 +-
.../systest/http_jetty/jettyBasicAuthServer.xml | 54 ++-
.../cxf/systest/http_jetty/jettyDigestServer.xml | 54 ++-
systests/ws-specs/pom.xml | 4 +-
.../cxf/systest/ws/AbstractSpringServer.java | 10 +-
.../ws/addr_feature/FaultToEndpointServer.java | 38 +-
.../addr_feature/WSAFaultToClientServerTest.java | 1 +
.../cxf/tools/wsdlto/jaxws/CodeGenBugTest.java | 2 +-
97 files changed, 1211 insertions(+), 907 deletions(-)
diff --git a/distribution/javadoc/pom.xml b/distribution/javadoc/pom.xml
index 3c4a8d0d91..79e328bb5e 100644
--- a/distribution/javadoc/pom.xml
+++ b/distribution/javadoc/pom.xml
@@ -427,12 +427,12 @@
<artifactId>jetty-server</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
@@ -454,13 +454,9 @@
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
</dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-plus</artifactId>
- </dependency>
<dependency>
<groupId>org.eclipse.jetty.http2</groupId>
- <artifactId>http2-server</artifactId>
+ <artifactId>jetty-http2-server</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
diff --git a/distribution/src/main/release/samples/groovy_spring_support/pom.xml b/distribution/src/main/release/samples/groovy_spring_support/pom.xml
index 4109c79b71..cb96240fa5 100644
--- a/distribution/src/main/release/samples/groovy_spring_support/pom.xml
+++ b/distribution/src/main/release/samples/groovy_spring_support/pom.xml
@@ -135,8 +135,8 @@
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
</dependency>
</dependencies>
</project>
diff --git a/distribution/src/main/release/samples/java_first_spring_support/pom.xml b/distribution/src/main/release/samples/java_first_spring_support/pom.xml
index 64ea245348..c4670ba145 100644
--- a/distribution/src/main/release/samples/java_first_spring_support/pom.xml
+++ b/distribution/src/main/release/samples/java_first_spring_support/pom.xml
@@ -124,8 +124,8 @@
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10.webapp</artifactId>
</dependency>
</dependencies>
</project>
diff --git a/distribution/src/main/release/samples/jax_rs/basic_http2_jetty/pom.xml b/distribution/src/main/release/samples/jax_rs/basic_http2_jetty/pom.xml
index 2cf0295b51..f36597d185 100644
--- a/distribution/src/main/release/samples/jax_rs/basic_http2_jetty/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/basic_http2_jetty/pom.xml
@@ -107,7 +107,7 @@
</dependency>
<dependency>
<groupId>org.eclipse.jetty.http2</groupId>
- <artifactId>http2-server</artifactId>
+ <artifactId>jetty-http2-server</artifactId>
<version>${cxf.jetty11.version}</version>
</dependency>
<dependency>
diff --git a/distribution/src/main/release/samples/jax_rs/description_openapi_v3/pom.xml b/distribution/src/main/release/samples/jax_rs/description_openapi_v3/pom.xml
index 92f1184a3c..f467d39af7 100644
--- a/distribution/src/main/release/samples/jax_rs/description_openapi_v3/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/description_openapi_v3/pom.xml
@@ -74,8 +74,8 @@
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
</dependency>
</dependencies>
</project>
diff --git a/distribution/src/main/release/samples/jax_rs/search/pom.xml b/distribution/src/main/release/samples/jax_rs/search/pom.xml
index 35068d9f5b..79af160231 100644
--- a/distribution/src/main/release/samples/jax_rs/search/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/search/pom.xml
@@ -153,8 +153,8 @@
<artifactId>jakarta.ws.rs-api</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
diff --git a/distribution/src/main/release/samples/jax_rs/spring_security/pom.xml b/distribution/src/main/release/samples/jax_rs/spring_security/pom.xml
index 174341a9cd..0aa65aed94 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_security/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/spring_security/pom.xml
@@ -152,8 +152,8 @@
<version>${cxf.aspectj.version}</version>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
diff --git a/distribution/src/main/release/samples/jax_rs/sse_cdi/pom.xml b/distribution/src/main/release/samples/jax_rs/sse_cdi/pom.xml
index cc7a710891..ab4f98c6d2 100644
--- a/distribution/src/main/release/samples/jax_rs/sse_cdi/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/sse_cdi/pom.xml
@@ -56,11 +56,6 @@
<artifactId>jetty-server</artifactId>
</dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-plus</artifactId>
- </dependency>
-
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jsp</artifactId>
@@ -68,8 +63,8 @@
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
</dependency>
<dependency>
diff --git a/distribution/src/main/release/samples/jax_rs/sse_spring/pom.xml b/distribution/src/main/release/samples/jax_rs/sse_spring/pom.xml
index 5b84cba782..af2c2f50ac 100644
--- a/distribution/src/main/release/samples/jax_rs/sse_spring/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/sse_spring/pom.xml
@@ -39,10 +39,6 @@
<artifactId>jetty-server</artifactId>
</dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-plus</artifactId>
- </dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
@@ -51,8 +47,8 @@
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
</dependency>
<dependency>
diff --git a/distribution/src/main/release/samples/jax_rs/tracing_brave/pom.xml b/distribution/src/main/release/samples/jax_rs/tracing_brave/pom.xml
index e1a46520d3..6d67420847 100644
--- a/distribution/src/main/release/samples/jax_rs/tracing_brave/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/tracing_brave/pom.xml
@@ -188,8 +188,8 @@
<artifactId>jakarta.ws.rs-api</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
diff --git a/distribution/src/main/release/samples/jax_rs/tracing_opentracing/pom.xml b/distribution/src/main/release/samples/jax_rs/tracing_opentracing/pom.xml
index 15b82f6076..44ceb95aac 100644
--- a/distribution/src/main/release/samples/jax_rs/tracing_opentracing/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/tracing_opentracing/pom.xml
@@ -124,8 +124,8 @@
<artifactId>jakarta.ws.rs-api</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
</dependency>
<dependency>
<groupId>io.jaegertracing</groupId>
diff --git a/distribution/src/main/release/samples/jax_rs/websocket/pom.xml b/distribution/src/main/release/samples/jax_rs/websocket/pom.xml
index 7c5129b7cc..d3d0471c39 100644
--- a/distribution/src/main/release/samples/jax_rs/websocket/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/websocket/pom.xml
@@ -124,13 +124,8 @@
<version>${cxf.jetty.version}</version>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-plus</artifactId>
- <version>${cxf.jetty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
<version>${cxf.jetty.version}</version>
</dependency>
<dependency>
diff --git a/distribution/src/main/release/samples/pom.xml b/distribution/src/main/release/samples/pom.xml
index f8ff6b019c..8a7d60639b 100644
--- a/distribution/src/main/release/samples/pom.xml
+++ b/distribution/src/main/release/samples/pom.xml
@@ -33,7 +33,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cxf.spring.boot.version>3.2.2</cxf.spring.boot.version>
<cxf.spring.cloud.eureka.version>4.1.0</cxf.spring.cloud.eureka.version>
- <cxf.jetty11.version>11.0.19</cxf.jetty11.version>
<cxf.netty.version>4.1.105.Final</cxf.netty.version>
<cxf.httpcomponents.client.version>4.5.14</cxf.httpcomponents.client.version>
<cxf.swagger.ui.version>5.10.3</cxf.swagger.ui.version>
diff --git a/distribution/src/main/release/samples/ruby_spring_support/pom.xml b/distribution/src/main/release/samples/ruby_spring_support/pom.xml
index 4722d53f17..18046e8e64 100644
--- a/distribution/src/main/release/samples/ruby_spring_support/pom.xml
+++ b/distribution/src/main/release/samples/ruby_spring_support/pom.xml
@@ -139,8 +139,8 @@
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
</dependency>
</dependencies>
</project>
diff --git a/parent/pom.xml b/parent/pom.xml
index e0f3393128..60d6b2b986 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -80,7 +80,7 @@
<cxf.osgi.saaj.version>[2,3)</cxf.osgi.saaj.version>
<cxf.opensaml.osgi.version>[4.2,5)</cxf.opensaml.osgi.version>
<cxf.ehcache.osgi.version>[3,4)</cxf.ehcache.osgi.version>
- <cxf.jetty.osgi.version>[11,12)</cxf.jetty.osgi.version>
+ <cxf.jetty.osgi.version>[12,13)</cxf.jetty.osgi.version>
<cxf.osgi.netty.version>[4.1,5)</cxf.osgi.netty.version>
<cxf.undertow.xnio.osgi.version>[3.8,4)</cxf.undertow.xnio.osgi.version>
<cxf.undertow.osgi.version>[2.2,3)</cxf.undertow.osgi.version>
@@ -162,8 +162,9 @@
<cxf.jcache.version>1.1.1</cxf.jcache.version>
<cxf.jdom.version>1.0</cxf.jdom.version>
<cxf.jettison.version>1.5.4</cxf.jettison.version>
- <cxf.jetty11.version>11.0.19</cxf.jetty11.version>
- <cxf.jetty.version>${cxf.jetty11.version}</cxf.jetty.version>
+ <cxf.jetty11.version>11.0.17</cxf.jetty11.version>
+ <cxf.jetty12.version>12.0.3</cxf.jetty12.version>
+ <cxf.jetty.version>${cxf.jetty12.version}</cxf.jetty.version>
<cxf.jexl.version>3.3</cxf.jexl.version>
<cxf.joda.time.version>2.10.10</cxf.joda.time.version>
<cxf.johnzon.version>1.2.21</cxf.johnzon.version>
@@ -224,9 +225,8 @@
<cxf.tika.version>2.7.0</cxf.tika.version>
<cxf.tomcat.version>10.1.18</cxf.tomcat.version>
<cxf.tomitribe.http.signature.version>1.8</cxf.tomitribe.http.signature.version>
- <cxf.undertow.version>2.3.5.Final</cxf.undertow.version>
+ <cxf.undertow.version>2.3.7.Final</cxf.undertow.version>
<cxf.yasson.version>3.0.3</cxf.yasson.version>
-
<!-- the Export-Package is the same as the Maven artifact
version (with the Final), but we don't want an import package with a version
with a qualifier. We do want a range. -->
@@ -1179,18 +1179,33 @@
<version>${cxf.jetty.version}</version>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
<version>${cxf.jetty.version}</version>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
+ <groupId>org.eclipse.jetty.websocket</groupId>
+ <artifactId>jetty-websocket-jetty-server</artifactId>
+ <version>${cxf.jetty.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty.ee10.websocket</groupId>
+ <artifactId>jetty-ee10-websocket-jetty-server</artifactId>
+ <version>${cxf.jetty.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-apache-jsp</artifactId>
+ <version>${cxf.jetty.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-servlet</artifactId>
<version>${cxf.jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlets</artifactId>
+ <artifactId>jetty-session</artifactId>
<version>${cxf.jetty.version}</version>
</dependency>
<dependency>
@@ -1219,14 +1234,9 @@
<artifactId>jetty-http</artifactId>
<version>${cxf.jetty.version}</version>
</dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-plus</artifactId>
- <version>${cxf.jetty.version}</version>
- </dependency>
<dependency>
<groupId>org.eclipse.jetty.http2</groupId>
- <artifactId>http2-server</artifactId>
+ <artifactId>jetty-http2-server</artifactId>
<version>${cxf.jetty.version}</version>
</dependency>
<dependency>
@@ -1240,8 +1250,8 @@
<version>${cxf.jetty.version}</version>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-annotations</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-annotations</artifactId>
<version>${cxf.jetty.version}</version>
</dependency>
<dependency>
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletRequest.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletRequest.java
index 27b7bdc79d..6859c3406a 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletRequest.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletRequest.java
@@ -28,6 +28,7 @@ import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
+
import jakarta.servlet.AsyncContext;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.RequestDispatcher;
@@ -317,19 +318,19 @@ public class ThreadLocalHttpServletRequest extends AbstractThreadLocalProxy<Http
ServletException {
return get().upgrade(handlerClass);
}
-
@Override
public String getRequestId() {
return get().getRequestId();
}
-
- @Override
- public String getProtocolRequestId() {
- return get().getProtocolRequestId();
- }
-
+
@Override
public ServletConnection getServletConnection() {
return get().getServletConnection();
}
+
+ @Override
+ public String getProtocolRequestId() {
+ return get().getProtocolRequestId();
+ }
+
}
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java
index 5f7bb6791f..800335cd6c 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java
@@ -22,7 +22,9 @@ import java.io.IOException;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
+import java.util.Enumeration;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
@@ -279,6 +281,30 @@ public class RequestDispatcherProvider extends AbstractResponseViewProvider {
public Map<String, String[]> getParameterMap() {
return params;
}
+
+ @Override
+ public Enumeration<String> getParameterNames() {
+
+ final Iterator<String> it = params.keySet().iterator();
+ return new Enumeration<String>() {
+
+ @Override
+ public boolean hasMoreElements() {
+ return it.hasNext();
+ }
+
+ @Override
+ public String nextElement() {
+ return it.next();
+ }
+
+ };
+ }
+
+ @Override
+ public String[] getParameterValues(String name) {
+ return params.get(name);
+ }
}
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
index e08e0b94e8..0d641950f3 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
@@ -79,6 +79,8 @@ public final class HttpUtils {
private static final String REQUEST_PATH_TO_MATCH_SLASH = "path_to_match_slash";
private static final String HTTP_SCHEME = "http";
+ private static final String WS_SCHEME = "ws";
+ private static final String WSS_SCHEME = "wss";
private static final String LOCAL_HOST_IP_ADDRESS = "127.0.0.1";
private static final String REPLACE_LOOPBACK_PROPERTY = "replace.loopback.address.with.localhost";
private static final String LOCAL_HOST_IP_ADDRESS_SCHEME = "://" + LOCAL_HOST_IP_ADDRESS;
@@ -482,6 +484,8 @@ public final class HttpUtils {
// RFC-3986: the scheme and host are case-insensitive and therefore should
// be normalized to lowercase.
if (scheme != null && !scheme.toLowerCase().startsWith(HttpUtils.HTTP_SCHEME)
+ && !scheme.toLowerCase().startsWith(HttpUtils.WS_SCHEME)
+ && !scheme.toLowerCase().startsWith(HttpUtils.WSS_SCHEME)
&& HttpUtils.isHttpRequest(m)) {
path = HttpUtils.toAbsoluteUri(path, m).getRawPath();
}
@@ -553,6 +557,7 @@ public final class HttpUtils {
if (ind == 0) {
path = path.substring(address.length());
}
+
if (addSlash && !path.startsWith("/")) {
path = "/" + path;
}
diff --git a/rt/javascript/javascript-tests/src/test/resources/XMLHttpRequestTestBeans.xml b/rt/javascript/javascript-tests/src/test/resources/XMLHttpRequestTestBeans.xml
index f0a77cd043..1a7b7e86a9 100644
--- a/rt/javascript/javascript-tests/src/test/resources/XMLHttpRequestTestBeans.xml
+++ b/rt/javascript/javascript-tests/src/test/resources/XMLHttpRequestTestBeans.xml
@@ -37,22 +37,14 @@
</property>
<property name="mimeTypes">
<bean class="org.eclipse.jetty.http.MimeTypes">
- <property name="mimeMap">
- <map>
- <entry key="html">
- <value>text/html; charset="utf-8"</value>
- </entry>
- </map>
- </property>
</bean>
</property>
</bean>
</property>
</bean>
- <bean class="org.eclipse.jetty.server.handler.DefaultHandler"/>
</httpj:handlers>
</httpj:engine>
</httpj:engine-factory>
<jaxws:endpoint id="greeter-service-endpoint" implementor="org.apache.hello_world_xml_http.wrapped.GreeterImpl" address="http://localhost:${testutil.ports.JsHttpRequestTest}/Greeter">
</jaxws:endpoint>
-</beans>
\ No newline at end of file
+</beans>
diff --git a/rt/rs/microprofile-client/pom.xml b/rt/rs/microprofile-client/pom.xml
index 2e8aed11b2..f4a5d8ed8e 100644
--- a/rt/rs/microprofile-client/pom.xml
+++ b/rt/rs/microprofile-client/pom.xml
@@ -182,7 +182,7 @@
</dependency>
<dependency>
<groupId>org.wiremock</groupId>
- <artifactId>wiremock</artifactId>
+ <artifactId>wiremock-standalone</artifactId>
<version>${cxf.wiremock.version}</version>
<scope>test</scope>
<exclusions>
@@ -190,6 +190,10 @@
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.eclipse.jetty.*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
</exclusions>
</dependency>
</dependencies>
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java
index 8549c46f5f..f9595cfc38 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java
@@ -202,7 +202,15 @@ public class OAuthRequestFilter extends AbstractAccessTokenValidator
if (uris.isEmpty()) {
return true;
}
- String servletPath = request.getPathInfo();
+ String servletPath = request.getServletPath();
+ String pathInfo = request.getPathInfo();
+ if (pathInfo == null) {
+ if (servletPath != null) {
+ servletPath += "";
+ }
+ } else {
+ servletPath += pathInfo;
+ }
if (servletPath == null) {
servletPath = (String)m.get(Message.PATH_INFO);
}
diff --git a/rt/transports/http-jetty/pom.xml b/rt/transports/http-jetty/pom.xml
index 77a61bd04d..dcc27d0ab1 100644
--- a/rt/transports/http-jetty/pom.xml
+++ b/rt/transports/http-jetty/pom.xml
@@ -69,6 +69,14 @@
<artifactId>spring-context</artifactId>
<optional>true</optional>
</dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-session</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-servlet</artifactId>
+ </dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
@@ -96,7 +104,7 @@
</dependency>
<dependency>
<groupId>org.eclipse.jetty.http2</groupId>
- <artifactId>http2-server</artifactId>
+ <artifactId>jetty-http2-server</artifactId>
<optional>true</optional>
</dependency>
<dependency>
@@ -114,6 +122,10 @@
<artifactId>slf4j-api</artifactId>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>${cxf.servlet-api.group}</groupId>
+ <artifactId>${cxf.servlet-api.artifact}</artifactId>
+ </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
diff --git a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyContextHandler.java b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyContextHandler.java
deleted file mode 100644
index 94e96bce85..0000000000
--- a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyContextHandler.java
+++ /dev/null
@@ -1,62 +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.transport.http_jetty;
-
-import org.eclipse.jetty.server.handler.ContextHandler;
-
-/**
- * The Jetty-specific ContextHandler
- */
-class JettyContextHandler extends ContextHandler {
- JettyContextHandler() {
- super(null, null, null);
- _scontext = new JettyContext();
- }
-
- class JettyContext extends Context {
- @Override
- public String getRequestCharacterEncoding() {
- return getDefaultRequestCharacterEncoding();
- }
-
- @Override
- public void setRequestCharacterEncoding(String encoding) {
- if (!isStarting()) {
- throw new IllegalStateException();
- }
-
- setDefaultRequestCharacterEncoding(encoding);
- }
-
- @Override
- public String getResponseCharacterEncoding() {
- return getDefaultResponseCharacterEncoding();
- }
-
- @Override
- public void setResponseCharacterEncoding(String encoding) {
- if (!isStarting()) {
- throw new IllegalStateException();
- }
-
- setDefaultResponseCharacterEncoding(encoding);
- }
- }
-}
diff --git a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
index f6a683d085..cd4a8ca9f6 100644
--- a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
+++ b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
@@ -47,10 +47,7 @@ import org.apache.cxf.transport.http.DestinationRegistry;
import org.apache.cxf.transport.https.CertConstraintsJaxBUtils;
import org.apache.cxf.transport.servlet.ServletDestination;
import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
-import org.eclipse.jetty.server.HttpChannel;
-import org.eclipse.jetty.server.HttpConnection;
-import org.eclipse.jetty.server.HttpOutput;
-import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.ee10.servlet.HttpOutput;
public class JettyHTTPDestination extends ServletDestination {
@@ -223,14 +220,11 @@ public class JettyHTTPDestination extends ServletDestination {
if (context == null) {
context = servletContext;
}
- Request baseRequest = (req instanceof Request)
- ? (Request)req : getCurrentRequest();
-
+
HTTPServerPolicy sp = getServer();
if (sp.isSetRedirectURL()) {
resp.sendRedirect(sp.getRedirectURL());
resp.flushBuffer();
- baseRequest.setHandled(true);
return;
}
@@ -257,11 +251,7 @@ public class JettyHTTPDestination extends ServletDestination {
final HttpServletResponse resp,
Message m) throws IOException {
resp.flushBuffer();
- Request baseRequest = (req instanceof Request)
- ? (Request)req : getCurrentRequest();
- if (baseRequest != null) {
- baseRequest.setHandled(true);
- }
+
super.invokeComplete(context, req, resp, m);
}
@@ -369,15 +359,5 @@ public class JettyHTTPDestination extends ServletDestination {
protected Message retrieveFromContinuation(HttpServletRequest req) {
return (Message)req.getAttribute(CXF_CONTINUATION_MESSAGE);
}
- private Request getCurrentRequest() {
- try {
- HttpConnection con = HttpConnection.getCurrentConnection();
-
- HttpChannel channel = con.getHttpChannel();
- return channel.getRequest();
- } catch (Throwable t) {
- //
- }
- return null;
- }
+
}
diff --git a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPHandler.java b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPHandler.java
index 2be0114cc1..ecd3c77de9 100644
--- a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPHandler.java
+++ b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPHandler.java
@@ -18,19 +18,22 @@
*/
package org.apache.cxf.transport.http_jetty;
+
import java.io.IOException;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.cxf.Bus;
import org.apache.cxf.transport.http.HttpUrlUtil;
-import org.eclipse.jetty.server.Request;
-import org.eclipse.jetty.server.handler.AbstractHandler;
-import org.eclipse.jetty.server.handler.ContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletContextRequest;
+
+
-public class JettyHTTPHandler extends AbstractHandler {
+public class JettyHTTPHandler extends HttpServlet {
private static final String METHOD_TRACE = "TRACE";
protected JettyHTTPDestination jettyHTTPDestination;
@@ -65,10 +68,24 @@ public class JettyHTTPHandler extends AbstractHandler {
return urlName;
}
- public void handle(String target, Request baseRequest, HttpServletRequest request,
- HttpServletResponse response) throws IOException, ServletException {
+
+ public ServletContextHandler createContextHandler() {
+ return new ServletContextHandler();
+ }
+
+ public Bus getBus() {
+ return jettyHTTPDestination != null ? jettyHTTPDestination.getBus() : bus;
+ }
+
+
+
+
+
+ @Override
+ protected void service(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ String target = ServletContextRequest.getServletContextRequest(request).getDecodedPathInContext();
if (request.getMethod().equals(METHOD_TRACE)) {
- baseRequest.setHandled(true);
response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
} else {
if (contextMatchExact) {
@@ -83,12 +100,5 @@ public class JettyHTTPHandler extends AbstractHandler {
}
}
-
- public ContextHandler createContextHandler() {
- return new JettyContextHandler();
- }
- public Bus getBus() {
- return jettyHTTPDestination != null ? jettyHTTPDestination.getBus() : bus;
- }
}
diff --git a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
index 1e4cb9fbd9..c34c1ec2ea 100644
--- a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
+++ b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
@@ -21,13 +21,19 @@ package org.apache.cxf.transport.http_jetty;
import java.io.Closeable;
import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
import java.io.UncheckedIOException;
-import java.io.Writer;
import java.lang.reflect.Method;
import java.net.URL;
+import java.nio.BufferOverflowException;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -37,10 +43,9 @@ import javax.net.ssl.SSLContext;
import jakarta.annotation.PostConstruct;
import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.Servlet;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
import org.apache.cxf.Bus;
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
@@ -56,13 +61,26 @@ import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.transport.HttpUriMapper;
import org.apache.cxf.transport.http.HttpServerEngineSupport;
import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHandler.Default404Servlet;
+import org.eclipse.jetty.ee10.servlet.ServletHandler.MappedServlet;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
+import org.eclipse.jetty.ee10.servlet.ServletMapping;
+import org.eclipse.jetty.ee10.servlet.SessionHandler;
import org.eclipse.jetty.http.BadMessageException;
import org.eclipse.jetty.http.HttpFields.Mutable;
import org.eclipse.jetty.http.HttpStatus;
+import org.eclipse.jetty.http.MimeTypes.Type;
+import org.eclipse.jetty.http.UriCompliance;
+import org.eclipse.jetty.http.pathmap.MatchedResource;
import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory;
import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory;
+import org.eclipse.jetty.io.ByteBufferOutputStream;
import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint;
+import org.eclipse.jetty.io.Retainable;
+import org.eclipse.jetty.io.RetainableByteBuffer;
import org.eclipse.jetty.security.SecurityHandler;
import org.eclipse.jetty.server.AbstractConnector;
import org.eclipse.jetty.server.ConnectionFactory;
@@ -76,12 +94,10 @@ import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
-import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.ErrorHandler;
-import org.eclipse.jetty.server.handler.HandlerCollection;
-import org.eclipse.jetty.server.session.SessionHandler;
+import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.component.Container;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
@@ -125,6 +141,7 @@ public class JettyHTTPServerEngine implements ServerEngine, HttpServerEngineSupp
private Server server;
private Connector connector;
private List<Handler> handlers;
+ private Map<String, ServletContextHandler> contextHandlerMap = new HashMap<String, ServletContextHandler>();
private ContextHandlerCollection contexts;
private Container.Listener mBeanContainer;
private SessionHandler sessionHandler;
@@ -361,36 +378,21 @@ public class JettyHTTPServerEngine implements ServerEngine, HttpServerEngineSupp
// need an error handler that won't leak information about the exception
// back to the client.
- ErrorHandler eh = new ErrorHandler() {
- public void handle(String target, Request baseRequest, HttpServletRequest request,
- HttpServletResponse response) throws IOException, ServletException {
- String msg = (String)request.getAttribute(RequestDispatcher.ERROR_MESSAGE);
- if (StringUtils.isEmpty(msg) || msg.contains("org.apache.cxf.interceptor.Fault")) {
- msg = HttpStatus.getMessage(response.getStatus());
- request.setAttribute(RequestDispatcher.ERROR_MESSAGE, msg);
- }
- if (response instanceof Response) {
- ((Response)response).setStatusWithReason(response.getStatus(), msg);
- }
- super.handle(target, baseRequest, request, response);
- }
-
- protected void writeErrorPage(HttpServletRequest request, Writer writer, int code, String message,
- boolean showStacks) throws IOException {
- super.writeErrorPage(request, writer, code, message, false);
- }
- };
- s.addBean(eh);
+ ErrorHandler eh = new CxfJettyErrorHandler();
+ s.setErrorHandler(eh);
return s;
}
+
/**
* Register a servant.
*
* @param url the URL associated with the servant
* @param handler notified on incoming HTTP requests
*/
+ //CHECKSTYLE:OFF
public synchronized void addServant(URL url, JettyHTTPHandler handler) {
+ //CHECKSTYLE:ON
if (shouldCheckUrl(handler.getBus())) {
checkRegistedContext(url);
}
@@ -422,16 +424,16 @@ public class JettyHTTPServerEngine implements ServerEngine, HttpServerEngineSupp
}
Handler existingHandler = server.getHandler();
- HandlerCollection handlerCollection = null;
- boolean existingHandlerCollection = existingHandler instanceof HandlerCollection;
+ Handler.Collection handlerCollection = null;
+ boolean existingHandlerCollection = existingHandler instanceof Handler.Collection;
if (existingHandlerCollection) {
- handlerCollection = (HandlerCollection) existingHandler;
+ handlerCollection = (Handler.Collection) existingHandler;
}
if (!existingHandlerCollection
&&
(existingHandler != null || numberOfHandlers > 1)) {
- handlerCollection = new HandlerCollection();
+ handlerCollection = new Handler.Sequence(new ArrayList<Handler>());
if (existingHandler != null) {
handlerCollection.addHandler(existingHandler);
}
@@ -456,10 +458,22 @@ public class JettyHTTPServerEngine implements ServerEngine, HttpServerEngineSupp
//then it need be on top of JettyHTTPHandler
//set JettyHTTPHandler as inner handler if
//inner handler is null
- ((SecurityHandler)h).setHandler(handler);
securityHandler = (SecurityHandler)h;
} else {
- handlerCollection.addHandler(h);
+ if (!(h instanceof JettyHTTPHandler)) {
+ //JettyHTTPHandler is a ServletHandler
+ //and must be added with ServletContext Handler later
+ handlerCollection.addHandler(h);
+ } else {
+ String contextName = HttpUriMapper.getContextName(url.getPath());
+
+ ServletContextHandler context = null;
+ context = ((JettyHTTPHandler)h).createContextHandler();
+ context.setContextPath(contextName);
+ context.setHandler(h);
+ contexts.addHandler(context);
+
+ }
}
}
}
@@ -469,7 +483,6 @@ public class JettyHTTPServerEngine implements ServerEngine, HttpServerEngineSupp
* Which in turn implies that there can't be a 'defaultHander' to deal with.
*/
if (handlerCollection != null) {
- handlerCollection.addHandler(contexts);
if (defaultHandler != null) {
handlerCollection.addHandler(defaultHandler);
}
@@ -494,40 +507,113 @@ public class JettyHTTPServerEngine implements ServerEngine, HttpServerEngineSupp
}
String contextName = HttpUriMapper.getContextName(url.getPath());
- if (contextName.isEmpty()) {
- contextName = "/";
+ if (contextName.length() == 0) {
+ contextName = "/"; //ensure it is mapped as root context,
+ }
+ String path = HttpUriMapper.getResourceBase(url.getPath());
+ if (!path.equals("/")) {
+ //add /* to enable wild match
+ path = path + "/*";
+ }
+ if (contextName.endsWith("/*")) {
+ //This is how Jetty ServletContextHandler handle the contextName
+ //without suffix "/", the "*" suffix will be removed
+ contextName = contextName + "/";
}
- ContextHandler context = handler.createContextHandler();
- context.setContextPath(contextName);
- // bind the jetty http handler with the context handler
- if (isSessionSupport) {
- SessionHandler sh = configureSession();
-
- if (securityHandler != null) {
- //use the securityHander which already wrap the jetty http handler
- sh.setHandler(securityHandler);
+ ServletContextHandler context = null;
+
+ if (this.contextHandlerMap.containsKey(contextName)
+ && this.contextHandlerMap.get(contextName).getServletHandler().getMatchedServlet(path) != null) {
+ context = this.contextHandlerMap.get(contextName);
+ ServletHandler servletHandler = context.getServletHandler();
+ MatchedResource<MappedServlet> mappedServlet = servletHandler.getMatchedServlet(path);
+ ServletHolder servletHolder = mappedServlet.getResource().getServletHolder();
+ Servlet servlet = null;
+ try {
+ servlet = servletHolder.getServlet();
+ } catch (ServletException ex) {
+ LOG.log(Level.WARNING, "ADD_HANDLER_FAILED_MSG", new Object[] {
+ ex.getMessage()
+ });
+ }
+ if (servlet != null && servlet instanceof JettyHTTPHandler && servletHolder.isStarted()) {
+ try {
+
+ // the servlet exist with the same path
+ // just update the servlet
+ context.stop();
+
+ servletHolder.setServlet(handler);
+ servletHolder.stop();
+ servletHolder.start();
+ servletHolder.initialize();
+ context.start();
+
+ } catch (Exception ex) {
+
+ LOG.log(Level.WARNING, "ADD_HANDLER_FAILED_MSG", new Object[] {
+ ex.getMessage()
+ });
+ }
+
} else {
- sh.setHandler(handler);
+ try {
+
+ context.addServlet(handler, path);
+ } catch (Exception ex) {
+ LOG.log(Level.WARNING, "ADD_HANDLER_FAILED_MSG", new Object[] {
+ ex.getMessage()
+
+ });
+ }
}
- context.setHandler(sh);
+
} else {
- // otherwise, just the one.
- if (securityHandler != null) {
- //use the securityHander which already wrap the jetty http handler
- context.setHandler(securityHandler);
+ context = handler.createContextHandler();
+ context.setContextPath(contextName);
+ context.addServlet(handler, path);
+ contexts.addHandler(context);
+ this.contextHandlerMap.put(contextName, context);
+ // bind the jetty http handler with the context handler
+ if (isSessionSupport) {
+ SessionHandler sh = configureSession();
+
+ if (securityHandler != null) {
+ //use the securityHander which already wrap the jetty http handler
+ sh.setHandler(securityHandler);
+ }
+ context.setSessionHandler(sh);
} else {
- context.setHandler(handler);
+ // otherwise, just the one.
+ if (securityHandler != null) {
+ //use the securityHander which already wrap the jetty http handler
+ context.setSecurityHandler(securityHandler);
+ }
+ }
+
+ }
+
+
+ if (server.getHandler() != contexts) {
+ for (Handler h : contexts.getHandlers()) {
+ ((Handler.Collection)server.getHandler()).addHandler(h);
+ try {
+ h.start();
+ } catch (Exception ex) {
+ LOG.log(Level.WARNING, "ADD_HANDLER_FAILED_MSG", new Object[] {ex.getMessage()});
+ }
}
}
- contexts.addHandler(context);
ServletContext sc = context.getServletContext();
handler.setServletContext(sc);
- final String smap = getHandlerName(url, context);
+ String smap = getHandlerName(url, context);
+
handler.setName(smap);
+
- if (contexts.isStarted()) {
+ if (contexts.isStarted() && context != null && !context.isStarted()) {
try {
context.start();
} catch (Exception ex) {
@@ -539,6 +625,7 @@ public class JettyHTTPServerEngine implements ServerEngine, HttpServerEngineSupp
++servantCount;
}
+
private SessionHandler configureSession() {
// If we have sessions, we need two handlers.
SessionHandler sh = null;
@@ -578,7 +665,7 @@ public class JettyHTTPServerEngine implements ServerEngine, HttpServerEngineSupp
return sh;
}
- private String getHandlerName(URL url, ContextHandler context) {
+ private String getHandlerName(URL url, ServletContextHandler context) {
String contextPath = context.getContextPath();
String path = url.getPath();
if (path.startsWith(contextPath)) {
@@ -665,6 +752,7 @@ public class JettyHTTPServerEngine implements ServerEngine, HttpServerEngineSupp
result.setHost(hosto);
}
result.setReuseAddress(isReuseAddress());
+
} catch (RuntimeException rex) {
throw rex;
} catch (Exception ex) {
@@ -679,6 +767,14 @@ public class JettyHTTPServerEngine implements ServerEngine, HttpServerEngineSupp
final AbstractConnector result;
try {
HttpConfiguration httpConfig = new HttpConfiguration();
+ /**
+ * LEGACY compliance mode that models Jetty-9.4 behavior
+ * by allowing {@link Violation#AMBIGUOUS_PATH_SEGMENT},
+ * {@link Violation#AMBIGUOUS_EMPTY_SEGMENT}, {@link Violation#AMBIGUOUS_PATH_SEPARATOR},
+ * {@link Violation#AMBIGUOUS_PATH_ENCODING}
+ * and {@link Violation#UTF16_ENCODINGS}.
+ */
+ httpConfig.setUriCompliance(UriCompliance.LEGACY);
httpConfig.setSendServerVersion(getSendServerVersion());
HttpConnectionFactory httpFactory = new HttpConnectionFactory(httpConfig);
@@ -731,7 +827,7 @@ public class JettyHTTPServerEngine implements ServerEngine, HttpServerEngineSupp
Mutable response101)
throws BadMessageException {
if (request.getContentLength() > 0
- || request.getFields().contains("Transfer-Encoding")) {
+ || request.getHttpFields().contains("Transfer-Encoding")) {
// if there is a body, we cannot upgrade
return null;
}
@@ -937,25 +1033,76 @@ public class JettyHTTPServerEngine implements ServerEngine, HttpServerEngineSupp
*/
public synchronized void removeServant(URL url) {
- final String contextName = HttpUriMapper.getContextName(url.getPath());
- final String smap = HttpUriMapper.getResourceBase(url.getPath());
+ String contextName = HttpUriMapper.getContextName(url.getPath());
+ if (contextName.length() == 0) {
+ contextName = "/"; //ensure it is mapped as root context,
+ }
+ String smap = HttpUriMapper.getResourceBase(url.getPath());
+ if (!smap.equals("/")) {
+ //add /* to enable wild match
+ smap = smap + "/*";
+ }
+
+ if (contextName.endsWith("/*")) {
+ //This is how Jetty ServletContextHandler handle the contextName
+ //without suffix "/", the "*" suffix will be removed
+ contextName = contextName + "/";
+ }
boolean found = false;
if (server != null && server.isRunning()) {
- for (Handler handler : contexts.getChildHandlersByClass(ContextHandler.class)) {
- if (handler instanceof ContextHandler) {
- ContextHandler contextHandler = (ContextHandler) handler;
- Handler jh = contextHandler.getHandler();
- if (jh instanceof JettyHTTPHandler
+ for (Handler handler : contexts.getHandlers()) {
+ if (handler instanceof ServletContextHandler) {
+ ServletContextHandler contextHandler = (ServletContextHandler) handler;
+ ServletHandler servletHandler = contextHandler.getServletHandler();
+
+ MatchedResource<MappedServlet> mappedServlet = servletHandler.getMatchedServlet(smap);
+ if (mappedServlet == null) {
+ continue;
+ }
+ ServletHolder servletHolder = mappedServlet.getResource().getServletHolder();
+ Servlet servlet = null;
+
+ try {
+ servlet = servletHolder.getServlet();
+ } catch (ServletException ex) {
+ LOG.log(Level.WARNING, "REMOVE_HANDLER_FAILED_MSG", new Object[] {
+ ex.getMessage()
+ });
+ continue;
+ }
+ if (servlet != null && servlet instanceof JettyHTTPHandler
&& (contextName.equals(contextHandler.getContextPath())
|| (StringUtils.isEmpty(contextName)
&& "/".equals(contextHandler.getContextPath())))
- && ((JettyHTTPHandler)jh).getName().equals(smap)) {
+ && smap.startsWith(((JettyHTTPHandler)servlet).getName())) {
try {
- contexts.removeHandler(handler);
- handler.stop();
- handler.destroy();
+ servletHolder.stop();
+ contextHandler.getContext().destroy(servlet);
+ //need to remove path from ServletHandler._servletMappings
+ //and has to access the private field.
+ List<?> servletMappings
+ = ReflectionUtil.accessDeclaredField("_servletMappings",
+ ServletHandler.class,
+ servletHandler,
+ List.class);
+ ServletMapping servletMapping = servletHandler.getServletMapping(smap);
+ servletMappings.remove(servletMapping);
+ boolean hasActiveServlet = false;
+ for (ServletHolder myHolder : servletHandler.getServlets()) {
+ if (myHolder.getServlet() != null
+ && !(myHolder.getServlet() instanceof Default404Servlet)) {
+ hasActiveServlet = true;
+ break;
+ }
+ }
+ if (!hasActiveServlet) {
+ contexts.removeHandler(handler);
+ handler.stop();
+ handler.destroy();
+ this.contextHandlerMap.remove(contextName);
+ }
} catch (Exception ex) {
LOG.log(Level.WARNING, "REMOVE_HANDLER_FAILED_MSG",
new Object[] {ex.getMessage()});
@@ -988,10 +1135,11 @@ public class JettyHTTPServerEngine implements ServerEngine, HttpServerEngineSupp
Handler ret = null;
// After a stop(), the server is null, and therefore this
// operation should return null.
+
if (server != null) {
- for (Handler handler : server.getChildHandlersByClass(ContextHandler.class)) {
- if (handler instanceof ContextHandler) {
- ContextHandler contextHandler = (ContextHandler) handler;
+ for (Handler handler : server.getDescendants(ServletContextHandler.class)) {
+ if (handler instanceof ServletContextHandler) {
+ ServletContextHandler contextHandler = (ServletContextHandler) handler;
if (contextName.equals(contextHandler.getContextPath())) {
ret = contextHandler.getHandler();
break;
@@ -1008,15 +1156,15 @@ public class JettyHTTPServerEngine implements ServerEngine, HttpServerEngineSupp
* @param url the associated URL
* @return the HttpHandler if registered
*/
- public synchronized ContextHandler getContextHandler(URL url) {
+ public synchronized ServletContextHandler getContextHandler(URL url) {
String contextName = HttpUriMapper.getContextName(url.getPath());
- ContextHandler ret = null;
+ ServletContextHandler ret = null;
// After a stop(), the server is null, and therefore this
// operation should return null.
if (server != null) {
- for (Handler handler : server.getChildHandlersByClass(ContextHandler.class)) {
- if (handler instanceof ContextHandler) {
- ContextHandler contextHandler = (ContextHandler) handler;
+ for (Handler handler : server.getDescendants(ServletContextHandler.class)) {
+ if (handler instanceof ServletContextHandler) {
+ ServletContextHandler contextHandler = (ServletContextHandler) handler;
if (contextName.equals(contextHandler.getContextPath())) {
ret = contextHandler;
break;
@@ -1025,6 +1173,7 @@ public class JettyHTTPServerEngine implements ServerEngine, HttpServerEngineSupp
}
}
return ret;
+
}
private boolean isSsl() {
@@ -1180,5 +1329,137 @@ public class JettyHTTPServerEngine implements ServerEngine, HttpServerEngineSupp
public void setSessionTimeout(int sessionTimeout) {
this.sessionTimeout = sessionTimeout;
}
+
+ private final class CxfJettyErrorHandler extends ErrorHandler {
+
+ public boolean handle(Request request, Response response, Callback callback) {
+ String msg = (String)request.getAttribute(RequestDispatcher.ERROR_MESSAGE);
+ if (StringUtils.isEmpty(msg) || msg.contains("org.apache.cxf.interceptor.Fault")) {
+ msg = HttpStatus.getMessage(response.getStatus());
+ request.setAttribute(RequestDispatcher.ERROR_MESSAGE, msg);
+ }
+ if (response instanceof Response) {
+ ((Response)response).setStatus(response.getStatus());
+ }
+ return super.handle(request, response, callback);
+ }
+
+ //CHECKSTYLE:OFF
+ protected boolean generateAcceptableResponse(Request request, Response response,
+ Callback callback, String contentType,
+ List<Charset> charsets, int code, String message,
+ Throwable cause)
+ //CHECKSTYLE:ON
+ throws IOException {
+ Type type;
+ Charset charset;
+ switch (contentType) {
+ case "text/html":
+ case "text/*":
+ case "*/*":
+ type = Type.TEXT_HTML;
+ charset = charsets.stream().findFirst().orElse(StandardCharsets.ISO_8859_1);
+ break;
+
+ case "text/json":
+ case "application/json":
+ if (charsets.contains(StandardCharsets.UTF_8)) {
+ charset = StandardCharsets.UTF_8;
+ } else if (charsets.contains(StandardCharsets.ISO_8859_1)) {
+ charset = StandardCharsets.ISO_8859_1;
+ } else {
+ return false;
+ }
+ type = Type.TEXT_JSON.is(contentType) ? Type.TEXT_JSON : Type.APPLICATION_JSON;
+ break;
+
+ case "text/plain":
+ type = Type.TEXT_PLAIN;
+ charset = charsets.stream().findFirst().orElse(StandardCharsets.ISO_8859_1);
+ break;
+
+ default:
+ return false;
+ }
+
+ int bufferSize = request.getConnectionMetaData().getHttpConfiguration().getOutputBufferSize();
+ bufferSize = Math.min(8192, bufferSize); // TODO ?
+ RetainableByteBuffer buffer = request.getComponents().getByteBufferPool().acquire(bufferSize,
+ false);
+
+ try {
+ // write into the response aggregate buffer and flush it asynchronously.
+ // Looping to reduce size if buffer overflows
+ boolean showStacks = isShowStacks();
+ while (true) {
+ try {
+ buffer.clear();
+ ByteBufferOutputStream out = new ByteBufferOutputStream(buffer.getByteBuffer());
+ PrintWriter writer = new PrintWriter(new OutputStreamWriter(out, charset));
+
+ switch (type) {
+ case TEXT_HTML:
+ writeErrorHtml(request, writer, charset, code, message, cause, showStacks);
+ break;
+ case TEXT_JSON:
+
+ case APPLICATION_JSON:
+ writeErrorJson(request, writer, code, message, cause, showStacks);
+ break;
+ case TEXT_PLAIN:
+ writeErrorPlain(request, writer, code, message, cause, showStacks);
+ break;
+ default:
+ throw new IllegalStateException();
+ }
+
+ writer.flush();
+ break;
+ } catch (BufferOverflowException e) {
+ if (showStacks) {
+ if (LOG.isLoggable(Level.FINER)) {
+ LOG.log(Level.FINER, "Disable stacks for " + e.toString());
+ }
+ showStacks = false;
+ continue;
+ }
+
+ LOG.log(Level.WARNING,
+ "Error page too large:" + message);
+
+ break;
+ }
+ }
+
+ if (!buffer.hasRemaining()) {
+ buffer.release();
+ callback.succeeded();
+ return true;
+ }
+
+ response.getHeaders().put(type.getContentTypeField(charset));
+ response.write(true, buffer.getByteBuffer(), new WriteErrorCallback(callback, buffer));
+
+ return true;
+ } catch (Throwable x) {
+ buffer.release();
+ throw x;
+ }
+ }
+
+ class WriteErrorCallback extends Callback.Nested {
+ private final Retainable retainable;
+
+ WriteErrorCallback(Callback callback, Retainable retainable) {
+ super(callback);
+ this.retainable = retainable;
+ }
+
+ @Override
+ public void completed() {
+ this.retainable.release();
+ }
+ }
+ }
}
diff --git a/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java b/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
index df563367d6..4ee15f5e22 100644
--- a/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
+++ b/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
@@ -70,9 +70,10 @@ import org.apache.cxf.ws.addressing.AddressingProperties;
import org.apache.cxf.ws.addressing.EndpointReferenceType;
import org.apache.cxf.ws.addressing.EndpointReferenceUtils;
import org.apache.cxf.ws.addressing.JAXWSAConstants;
+import org.eclipse.jetty.ee10.servlet.ServletRequestHttpWrapper;
+import org.eclipse.jetty.ee10.servlet.ServletResponseHttpWrapper;
import org.eclipse.jetty.http.HttpFields;
-import org.eclipse.jetty.server.Request;
-import org.eclipse.jetty.server.Response;
+
import org.junit.After;
import org.junit.Test;
@@ -110,8 +111,8 @@ public class JettyHTTPDestinationTest {
private JettyHTTPServerEngine engine;
private HTTPServerPolicy policy;
private JettyHTTPDestination destination;
- private Request request;
- private Response response;
+ private ServletRequestHttpWrapper request;
+ private ServletResponseHttpWrapper response;
private Message inMessage;
private Message outMessage;
private MessageObserver observer;
@@ -620,8 +621,8 @@ public class JettyHTTPDestinationTest {
is = mock(ServletInputStream.class);
os = mock(ServletOutputStream.class);
- request = mock(Request.class);
- response = mock(Response.class);
+ request = mock(ServletRequestHttpWrapper.class);
+ response = mock(ServletResponseHttpWrapper.class);
when(request.getMethod()).thenReturn(method);
//request.getConnection();
//whenLastCall().thenReturn(null).anyTimes();
@@ -631,7 +632,6 @@ public class JettyHTTPDestinationTest {
policy.setRedirectURL(NOWHERE + "foo/bar");
doNothing().when(response).sendRedirect(eq(NOWHERE + "foo/bar"));
doNothing().when(response).flushBuffer();
- doNothing().when(request).setHandled(true);
} else {
//getQueryString for if statement
when(request.getQueryString()).thenReturn(query);
@@ -670,7 +670,6 @@ public class JettyHTTPDestinationTest {
httpFields.getValues(JettyHTTPDestinationTest.AUTH_HEADER));
when(request.getInputStream()).thenReturn(is);
- doNothing().when(request).setHandled(true);
doNothing().when(response).flushBuffer();
if (sendResponse) {
doNothing().when(response).setStatus(status);
@@ -729,7 +728,6 @@ public class JettyHTTPDestinationTest {
when(request.getQueryString()).thenReturn("wsdl");
doNothing().when(response).setContentType("text/xml");
doNothing().when(response).getOutputStream();
- request.setHandled(true);
}
private void verifyDoService() throws Exception {
@@ -871,4 +869,4 @@ public class JettyHTTPDestinationTest {
}
-}
\ No newline at end of file
+}
diff --git a/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java b/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
index 509dc3342c..0d394abfe4 100644
--- a/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
+++ b/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
@@ -28,7 +28,6 @@ import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -43,13 +42,12 @@ import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.management.InstrumentationManager;
import org.apache.cxf.testutil.common.TestUtil;
-import org.eclipse.jetty.server.ConnectionFactory;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHandler.MappedServlet;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
+import org.eclipse.jetty.http.pathmap.MatchedResource;
import org.eclipse.jetty.server.Connector;
-import org.eclipse.jetty.server.Handler;
-import org.eclipse.jetty.server.HttpConfiguration;
-import org.eclipse.jetty.server.HttpConnectionFactory;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.util.thread.ThreadPool;
@@ -72,9 +70,7 @@ public class JettyHTTPServerEngineTest {
= Integer.valueOf(TestUtil.getPortNumber(JettyHTTPServerEngineTest.class, 2));
private static final int PORT3
= Integer.valueOf(TestUtil.getPortNumber(JettyHTTPServerEngineTest.class, 3));
- private static final int PORT4
- = Integer.valueOf(TestUtil.getPortNumber(JettyHTTPServerEngineTest.class, 4));
-
+
private Bus bus;
private JettyHTTPServerEngineFactory factory;
@@ -317,41 +313,21 @@ public class JettyHTTPServerEngineTest {
JettyHTTPServerEngineFactory.destroyForPort(PORT2);
}
- @Test
- public void testSetHandlers() throws Exception {
- URL url = new URL("http://localhost:" + PORT2 + "/hello/test");
- JettyHTTPTestHandler handler1 = new JettyHTTPTestHandler("string1", true);
- JettyHTTPTestHandler handler2 = new JettyHTTPTestHandler("string2", true);
-
- JettyHTTPServerEngine engine = new JettyHTTPServerEngine();
- engine.setPort(PORT2);
-
- List<Handler> handlers = new ArrayList<>();
- handlers.add(handler1);
- engine.setHandlers(handlers);
- engine.finalizeConfig();
-
- engine.addServant(url, handler2);
-
- String response = getResponse(url.toString());
- assertEquals("the jetty http handler1 did not take effect", response, "string1string2");
-
- engine.stop();
- JettyHTTPServerEngineFactory.destroyForPort(PORT2);
- }
+
@Test
public void testGetContextHandler() throws Exception {
String urlStr = "http://localhost:" + PORT1 + "/hello/test";
JettyHTTPServerEngine engine =
factory.createJettyHTTPServerEngine(PORT1, "http");
- ContextHandler contextHandler = engine.getContextHandler(new URL(urlStr));
+ ServletContextHandler contextHandler = engine.getContextHandler(new URL(urlStr));
// can't find the context handler here
assertNull(contextHandler);
JettyHTTPTestHandler handler1 = new JettyHTTPTestHandler("string1", true);
JettyHTTPTestHandler handler2 = new JettyHTTPTestHandler("string2", true);
engine.addServant(new URL(urlStr), handler1);
-
+ String response = getResponse(urlStr);
+ assertEquals("the jetty http handler1 did not take effect", response, "string1");
// Note: There appears to be an internal issue in Jetty that does not
// unregister the MBean for handler1 during this setHandler operation.
// This scenario may create a warning message in the logs
@@ -359,12 +335,23 @@ public class JettyHTTPServerEngineTest {
// transport.http_jetty:type=jettyhttptesthandler,id=0)
// when running subsequent tests.
contextHandler = engine.getContextHandler(new URL(urlStr));
- contextHandler.stop();
- contextHandler.setHandler(handler2);
- contextHandler.start();
+ //contextHandler.stop();
+ ServletHandler servletHandler = contextHandler.getServletHandler();
+ MatchedResource<MappedServlet> mappedServlet = servletHandler.getMatchedServlet("/test");
+ if (mappedServlet != null) {
+ ServletHolder servletHolder = mappedServlet.getResource().getServletHolder();
+ if (servletHolder != null) {
+ // the servlet exist with the same path
+ // just update the servlet
+ servletHolder.doStop();
+ servletHolder.setServlet(handler2);
+ servletHolder.initialize();
+ }
+ }
+
- String response = getResponse(urlStr);
- assertEquals("the jetty http handler did not take effect", response, "string2");
+ response = getResponse(urlStr);
+ assertEquals("the jetty http handler2 did not take effect", response, "string2");
JettyHTTPServerEngineFactory.destroyForPort(PORT1);
}
@@ -381,7 +368,7 @@ public class JettyHTTPServerEngineTest {
JettyHTTPHandler handler1 = new JettyHTTPTestHandler("test", false);
JettyHTTPHandler handler2 = new JettyHTTPTestHandler("test2", false);
engine.addServant(new URL(urlStr1), handler1);
-
+
contextHandler = engine.getContextHandler(new URL(urlStr1));
assertNotNull(contextHandler);
@@ -389,46 +376,16 @@ public class JettyHTTPServerEngineTest {
contextHandler = engine.getContextHandler(new URL(urlStr2));
assertNotNull(contextHandler);
- String response = getResponse(urlStr1 + "/test");
- assertEquals("the jetty http handler did not take effect", response, "test");
+ String response = getResponse(urlStr1);
+ assertEquals("the jetty http handler1 did not take effect", response, "test");
- response = getResponse(urlStr2 + "/test");
- assertEquals("the jetty http handler did not take effect", response, "test2");
+ response = getResponse(urlStr2);
+ assertEquals("the jetty http handler2 did not take effect", response, "test2");
JettyHTTPServerEngineFactory.destroyForPort(PORT3);
}
- @Test
- public void testSetConnector() throws Exception {
- URL url = new URL("http://localhost:" + PORT4 + "/hello/test");
- JettyHTTPTestHandler handler1 = new JettyHTTPTestHandler("string1", true);
- JettyHTTPTestHandler handler2 = new JettyHTTPTestHandler("string2", true);
-
- JettyHTTPServerEngine engine = new JettyHTTPServerEngine();
- engine.setPort(PORT4);
- Server server = new Server();
- ServerConnector connector = new ServerConnector(server);
- connector.setPort(PORT4);
- HttpConfiguration httpConfig = new HttpConfiguration();
- httpConfig.addCustomizer(new org.eclipse.jetty.server.ForwardedRequestCustomizer());
- HttpConnectionFactory httpFactory = new HttpConnectionFactory(httpConfig);
- Collection<ConnectionFactory> connectionFactories = new ArrayList<>();
- connectionFactories.add(httpFactory);
- connector.setConnectionFactories(connectionFactories);
- engine.setConnector(connector);
- List<Handler> handlers = new ArrayList<>();
- handlers.add(handler1);
- engine.setHandlers(handlers);
- engine.finalizeConfig();
-
- engine.addServant(url, handler2);
-
- String response = getResponse(url.toString());
- assertEquals("the jetty http handler1 did not take effect", response, "string1string2");
-
- engine.stop();
- JettyHTTPServerEngineFactory.destroyForPort(PORT4);
- }
+
private static String getResponse(String target) throws Exception {
URL url = new URL(target);
diff --git a/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPTestHandler.java b/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPTestHandler.java
index 269ec31c1e..7bf9bcd225 100644
--- a/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPTestHandler.java
+++ b/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPTestHandler.java
@@ -25,19 +25,20 @@ import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.cxf.transport.http.HttpUrlUtil;
+import org.eclipse.jetty.ee10.servlet.ServletContextRequest;
import org.eclipse.jetty.server.Request;
public class JettyHTTPTestHandler extends JettyHTTPHandler {
private boolean contextMatchExact;
- private String response;
-
+ private String ret;
+
public JettyHTTPTestHandler(String s, boolean cmExact) {
super(null, cmExact);
contextMatchExact = cmExact;
- response = s;
+ ret = s;
}
-
- @Override
+
+
public void handle(String target,
Request baseRequest,
HttpServletRequest request,
@@ -45,17 +46,37 @@ public class JettyHTTPTestHandler extends JettyHTTPHandler {
if (contextMatchExact) {
// just return the response for testing
- resp.getOutputStream().write(response.getBytes());
+ resp.getOutputStream().write(this.ret.getBytes());
resp.flushBuffer();
} else {
if (target.equals(getName()) || HttpUrlUtil.checkContextPath(getName(), target)) {
- resp.getOutputStream().write(response.getBytes());
+ resp.getOutputStream().write(this.ret.getBytes());
resp.flushBuffer();
}
}
}
+
+
+
+
+ @Override
+ protected void service(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+ String target = ServletContextRequest.getServletContextRequest(req).getDecodedPathInContext();
+ if (contextMatchExact) {
+ // just return the response for testing
+ resp.getOutputStream().write(ret.getBytes());
+ resp.flushBuffer();
+ } else {
+ if (target.equals(getName()) || HttpUrlUtil.checkContextPath(getName(), target)) {
+ resp.getOutputStream().write(ret.getBytes());
+ resp.flushBuffer();
+ }
+ }
+
+ }
}
diff --git a/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyHttpSession.java b/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyHttpSession.java
index 5b5b79821d..02f81aee6c 100644
--- a/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyHttpSession.java
+++ b/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyHttpSession.java
@@ -135,4 +135,4 @@ public class NettyHttpSession implements HttpSession {
public boolean isNew() {
throw new IllegalStateException("Method 'isNew' not yet implemented!");
}
-}
\ No newline at end of file
+}
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
index 376131af49..c0771430de 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
@@ -350,12 +350,26 @@ public abstract class AbstractHTTPDestination
if (contextPath == null) {
contextPath = "";
}
- String servletPath = req.getServletPath();
+ String servletPath = null;
+ try {
+ servletPath = req.getServletPath();
+ } catch (Exception ex) {
+ //could be AmbiguousURI per RFC
+ //and Jetty 12 can't handle it right now
+ servletPath = requestURI;
+ }
+
if (servletPath == null) {
servletPath = "";
}
String contextServletPath = contextPath + servletPath;
- String pathInfo = req.getPathInfo();
+ String pathInfo = null;
+ try {
+ pathInfo = req.getPathInfo();
+ } catch (Exception ex) {
+ //could be AmbiguousURI per RFC
+ //and Jetty 12 can't handle it right now
+ }
if (pathInfo != null) {
inMessage.put(Message.PATH_INFO, contextServletPath + pathInfo);
} else {
@@ -394,7 +408,11 @@ public abstract class AbstractHTTPDestination
SecurityContext httpSecurityContext = new SecurityContext() {
public Principal getUserPrincipal() {
- return req.getUserPrincipal();
+ try {
+ return req.getUserPrincipal();
+ } catch (Exception ex) {
+ return null;
+ }
}
public boolean isUserInRole(String role) {
return req.isUserInRole(role);
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
index 50bc968cb8..8f59fe7d73 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
@@ -42,6 +42,7 @@ import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletRequestWrapper;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
@@ -287,7 +288,15 @@ public abstract class AbstractHTTPServlet extends HttpServlet implements Filter
&& (redirectList != null && matchPath(redirectQueryCheck, redirectList, request)
|| redirectList == null)) {
// if no redirectList is provided then this servlet is redirecting only
- redirect(request, response, request.getPathInfo());
+ String path = request.getPathInfo();
+ if (path == null
+ && request instanceof ServletRequestWrapper) {
+ path = ((HttpServletRequest)((ServletRequestWrapper)request).getRequest()).getPathInfo();
+ }
+ if (path == null) {
+ path = "/";
+ }
+ redirect(request, response, path);
return;
}
boolean staticResourcesMatch = staticResourcesList != null
@@ -330,6 +339,10 @@ public abstract class AbstractHTTPServlet extends HttpServlet implements Filter
private static boolean matchPath(boolean checkRedirect, List<Pattern> values, HttpServletRequest request) {
String path = request.getPathInfo();
+ if (path == null
+ && request instanceof ServletRequestWrapper) {
+ path = ((HttpServletRequest)((ServletRequestWrapper)request).getRequest()).getPathInfo();
+ }
if (path == null) {
path = "/";
}
diff --git a/rt/transports/websocket/pom.xml b/rt/transports/websocket/pom.xml
index 8730e097ed..1906d8032e 100644
--- a/rt/transports/websocket/pom.xml
+++ b/rt/transports/websocket/pom.xml
@@ -114,16 +114,6 @@
<artifactId>jetty-security</artifactId>
<optional>true</optional>
</dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
- <optional>true</optional>
- </dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId>
@@ -146,26 +136,19 @@
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
- <artifactId>websocket-jetty-server</artifactId>
- <version>${cxf.jetty11.version}</version>
+ <artifactId>jetty-websocket-jetty-server</artifactId>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-jakarta-servlet-api</artifactId>
</exclusion>
</exclusions>
+ <optional>true</optional>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty.websocket</groupId>
- <artifactId>websocket-jakarta-server</artifactId>
- <version>${cxf.jetty11.version}</version>
+ <groupId>org.eclipse.jetty.ee10.websocket</groupId>
+ <artifactId>jetty-ee10-websocket-jetty-server</artifactId>
<optional>true</optional>
- <exclusions>
- <exclusion>
- <groupId>jakarta.servlet</groupId>
- <artifactId>jakarta.servlet-api</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.atmosphere</groupId>
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java
index 4126f0d4ad..0c089f9232 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java
@@ -44,7 +44,7 @@ public class WebSocketDestinationFactory implements HttpDestinationFactory {
private static final boolean UNDERTOW_AVAILABLE =
probeClass("org.apache.cxf.transport.http_undertow.UndertowHTTPServerEngineFactory");
private static final Constructor<?> JETTY11_WEBSOCKET_DESTINATION_CTR =
- probeConstructor("org.apache.cxf.transport.websocket.jetty11.Jetty11WebSocketDestination");
+ probeConstructor("org.apache.cxf.transport.websocket.jetty12.Jetty12WebSocketDestination");
private static final Constructor<?> UNDERTOW_WEBSOCKET_DESTINATION_CTR =
probeUndertowConstructor("org.apache.cxf.transport.websocket.undertow.UndertowWebSocketDestination");
private static final Constructor<?> ATMOSPHERE_WEBSOCKET_JETTY_DESTINATION_CTR =
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketJettyDestination.java b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketJettyDestination.java
index 6c6f0922b9..b9537522da 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketJettyDestination.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketJettyDestination.java
@@ -50,7 +50,6 @@ import org.atmosphere.cpr.AtmosphereResource;
import org.atmosphere.cpr.AtmosphereResponseImpl;
import org.atmosphere.handler.AbstractReflectorAtmosphereHandler;
import org.atmosphere.util.VoidServletConfig;
-import org.eclipse.jetty.server.Request;
import org.springframework.util.ClassUtils;
@@ -165,20 +164,21 @@ public class AtmosphereWebSocketJettyDestination extends JettyHTTPDestination im
super(jhd, cmExact);
}
+
@Override
- public void handle(String target, Request baseRequest, HttpServletRequest request,
- HttpServletResponse response) throws IOException, ServletException {
+ protected void service(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
if (AtmosphereUtils.useAtmosphere(request)) {
try {
framework.doCometSupport(AtmosphereRequestImpl.wrap(request),
AtmosphereResponseImpl.wrap(response));
- baseRequest.setHandled(true);
+
} catch (ServletException e) {
throw new IOException(e);
}
return;
}
- super.handle(target, baseRequest, request, response);
+ super.service(request, response);
}
}
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty/WebSocketVirtualServletRequest.java b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty/WebSocketVirtualServletRequest.java
index c85205c5ac..38bf7a3939 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty/WebSocketVirtualServletRequest.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty/WebSocketVirtualServletRequest.java
@@ -40,6 +40,7 @@ import jakarta.servlet.AsyncContext;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.ReadListener;
import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.ServletConnection;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletInputStream;
@@ -191,7 +192,6 @@ public class WebSocketVirtualServletRequest implements HttpServletRequest {
return webSocketHolder.getLocale();
}
- @Override
public Enumeration<Locale> getLocales() {
LOG.log(Level.FINE, "getLocales()");
return webSocketHolder.getLocales();
@@ -284,7 +284,6 @@ public class WebSocketVirtualServletRequest implements HttpServletRequest {
return webSocketHolder.getServletContext();
}
- @Override
public boolean isAsyncStarted() {
LOG.log(Level.FINE, "isAsyncStarted");
return false;
@@ -296,7 +295,6 @@ public class WebSocketVirtualServletRequest implements HttpServletRequest {
return false;
}
- @Override
public boolean isSecure() {
LOG.log(Level.FINE, "isSecure");
return webSocketHolder.isSecure();
@@ -545,14 +543,28 @@ public class WebSocketVirtualServletRequest implements HttpServletRequest {
throw new UnsupportedOperationException();
}
- @Override
+
public String getRealPath(String path) {
return path;
}
- @Override
+
public boolean isRequestedSessionIdFromUrl() {
LOG.log(Level.FINE, "isRequestedSessionIdFromUrl");
return false;
}
+
+ public String getRequestId() {
+ return null;
+ }
+
+ @Override
+ public String getProtocolRequestId() {
+ return null;
+ }
+
+ @Override
+ public ServletConnection getServletConnection() {
+ return null;
+ }
}
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty/WebSocketVirtualServletResponse.java b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty/WebSocketVirtualServletResponse.java
index 000047e478..6346c7550f 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty/WebSocketVirtualServletResponse.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty/WebSocketVirtualServletResponse.java
@@ -186,13 +186,6 @@ public class WebSocketVirtualServletResponse implements HttpServletResponse {
return responseHeaders.containsKey(name);
}
- @Override
- public String encodeRedirectURL(String url) {
- if (LOG.isLoggable(Level.FINE)) {
- LOG.log(Level.FINE, "encodeRedirectURL({0})", url);
- }
- return null;
- }
@Override
public String encodeURL(String url) {
@@ -363,21 +356,23 @@ public class WebSocketVirtualServletResponse implements HttpServletResponse {
}
- @Override
+
public String encodeUrl(String url) {
return URLEncoder.encode(url, StandardCharsets.UTF_8);
}
@Override
- public String encodeRedirectUrl(String url) {
+ public String encodeRedirectURL(String url) {
return URLEncoder.encode(url, StandardCharsets.UTF_8);
}
- @Override
+
public void setStatus(int sc, String sm) {
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "setStatus({0})", sc);
}
responseHeaders.put(WebSocketUtils.SC_KEY, Integer.toString(sc));
}
+
+
}
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty11/Jetty11WebSocketDestination.java b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty12/Jetty12WebSocketDestination.java
similarity index 75%
rename from rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty11/Jetty11WebSocketDestination.java
rename to rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty12/Jetty12WebSocketDestination.java
index c9aa1fa06d..f413357f44 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty11/Jetty11WebSocketDestination.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty12/Jetty12WebSocketDestination.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.cxf.transport.websocket.jetty11;
+package org.apache.cxf.transport.websocket.jetty12;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -53,23 +53,21 @@ import org.apache.cxf.transport.websocket.jetty.WebSocketServletHolder;
import org.apache.cxf.transport.websocket.jetty.WebSocketVirtualServletRequest;
import org.apache.cxf.transport.websocket.jetty.WebSocketVirtualServletResponse;
import org.apache.cxf.workqueue.WorkQueueManager;
-import org.eclipse.jetty.server.Request;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.handler.ContextHandler;
+import org.eclipse.jetty.ee10.websocket.server.JettyServerUpgradeRequest;
+import org.eclipse.jetty.ee10.websocket.server.JettyServerUpgradeResponse;
+import org.eclipse.jetty.ee10.websocket.server.JettyWebSocketCreator;
+import org.eclipse.jetty.ee10.websocket.server.JettyWebSocketServerContainer;
+import org.eclipse.jetty.websocket.api.Callback;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.UpgradeRequest;
-import org.eclipse.jetty.websocket.api.WebSocketAdapter;
-import org.eclipse.jetty.websocket.server.JettyServerUpgradeRequest;
-import org.eclipse.jetty.websocket.server.JettyServerUpgradeResponse;
-import org.eclipse.jetty.websocket.server.JettyWebSocketCreator;
-import org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer;
+
/**
*
*/
-public class Jetty11WebSocketDestination extends JettyHTTPDestination implements
+public class Jetty12WebSocketDestination extends JettyHTTPDestination implements
WebSocketDestinationService {
- private static final Logger LOG = LogUtils.getL7dLogger(Jetty11WebSocketDestination.class);
+ private static final Logger LOG = LogUtils.getL7dLogger(Jetty12WebSocketDestination.class);
//REVISIT make these keys configurable
private static final String REQUEST_ID_KEY = WebSocketConstants.DEFAULT_REQUEST_ID_KEY;
@@ -77,8 +75,9 @@ public class Jetty11WebSocketDestination extends JettyHTTPDestination implements
private final Executor executor;
private JettyWebSocketServerContainer webSocketServerContainer;
+ private Object address;
- public Jetty11WebSocketDestination(Bus bus, DestinationRegistry registry, EndpointInfo ei,
+ public Jetty12WebSocketDestination(Bus bus, DestinationRegistry registry, EndpointInfo ei,
JettyHTTPServerEngineFactory serverEngineFactory) throws IOException {
super(bus, registry, ei,
serverEngineFactory == null ? null : new URL(getNonWSAddress(ei)),
@@ -98,10 +97,16 @@ public class Jetty11WebSocketDestination extends JettyHTTPDestination implements
JettyWebSocketServerContainer wssc = getWebSocketContainer(context);
JettyWebSocketCreator creator = getCreator();
-
- if (wssc.upgrade(creator, request, response)) {
- ((Request)request).setHandled(true);
- return;
+ address = request.getAttribute("org.apache.cxf.transport.endpoint.address");
+ try {
+ if (wssc.upgrade(creator, request, response)) {
+ return;
+ }
+ } catch (Exception ex) {
+ //do nothing
+ }
+ if (address != null) {
+ request.setAttribute("org.apache.cxf.transport.endpoint.address", address);
}
super.invoke(config, context, request, response);
}
@@ -118,11 +123,7 @@ public class Jetty11WebSocketDestination extends JettyHTTPDestination implements
return getNonWSAddress(endpointInfo);
}
- Server getServer(ServletConfig config, ServletContext context) {
- ContextHandler.Context c = (ContextHandler.Context)context;
- ContextHandler h = c.getContextHandler();
- return h.getServer();
- }
+
public JettyWebSocketCreator getCreator() {
return new Creator();
@@ -143,6 +144,25 @@ public class Jetty11WebSocketDestination extends JettyHTTPDestination implements
protected JettyHTTPHandler createJettyHTTPHandler(JettyHTTPDestination jhd, boolean cmExact) {
return new JettyWebSocketHandler(jhd, cmExact, this);
}
+
+ /**
+ * Activate receipt of incoming messages.
+ */
+ protected void activate() {
+ synchronized (this) {
+ if (registry != null) {
+ registry.addDestination(this);
+ }
+ }
+ LOG.log(Level.FINE, "Activating receipt of incoming messages");
+ // pick the handler supporting websocket if jetty-websocket is available otherwise pick the default handler.
+
+ if (engine != null) {
+ handler = createJettyHTTPHandler(this, contextMatchOnExact());
+ engine.addServant(nurl, handler);
+ ((JettyWebSocketHandler)handler).initHandler(engine.getServer());
+ }
+ }
@Override
public void shutdown() {
@@ -159,7 +179,7 @@ public class Jetty11WebSocketDestination extends JettyHTTPDestination implements
public void run() {
HttpServletResponse response = null;
try {
- WebSocketServletHolder holder = new Jetty11WebSocketHolder(session);
+ WebSocketServletHolder holder = new Jetty12WebSocketHolder(session);
response = createServletResponse(holder);
HttpServletRequest request = createServletRequest(data, offset, length, holder, session);
String reqid = request.getHeader(REQUEST_ID_KEY);
@@ -212,40 +232,19 @@ public class Jetty11WebSocketDestination extends JettyHTTPDestination implements
return new WebSocketVirtualServletResponse(holder);
}
- // hide this jetty9 interface here to avoid CNFE on WebSocketCreator
+
private final class Creator implements JettyWebSocketCreator {
@Override
public Object createWebSocket(JettyServerUpgradeRequest req, JettyServerUpgradeResponse resp) {
- return new WebSocketAdapter() {
- Session session;
- @Override
- public void onWebSocketConnect(Session session) {
- this.session = session;
- }
- @Override
- public void onWebSocketBinary(byte[] payload, int offset, int len) {
- invoke(payload, offset, len, session);
- }
- @Override
- public void onWebSocketText(String message) {
- //TODO may want use string directly instead of converting it to byte[]
- try {
- byte[] bdata = message.getBytes("utf-8");
- onWebSocketBinary(bdata, 0, bdata.length);
- } catch (UnsupportedEncodingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- };
+ return new Jetty12WebSocket();
}
}
- class Jetty11WebSocketHolder implements WebSocketServletHolder {
+ class Jetty12WebSocketHolder implements WebSocketServletHolder {
final Session session;
- Jetty11WebSocketHolder(Session s) {
+ Jetty12WebSocketHolder(Session s) {
session = s;
}
public String getAuthType() {
@@ -312,18 +311,26 @@ public class Jetty11WebSocketDestination extends JettyHTTPDestination implements
return null;
}
public int getServerPort() {
- return ((InetSocketAddress)session.getLocalAddress()).getPort();
+ return ((InetSocketAddress)session.getLocalSocketAddress()).getPort();
}
public Principal getUserPrincipal() {
return null;
}
public Object getAttribute(String name) {
- final UpgradeRequest upgradeRequest = session.getUpgradeRequest();
- return getHttpServletRequest(upgradeRequest).getAttribute(name);
+ try {
+ final UpgradeRequest upgradeRequest = session.getUpgradeRequest();
+ return getHttpServletRequest(upgradeRequest).getAttribute(name);
+ } catch (Exception ex) {
+ if (name.equals("org.apache.cxf.transport.endpoint.address")) {
+ return address;
+ } else {
+ return null;
+ }
+ }
}
@Override
public void write(byte[] data, int offset, int length) throws IOException {
- session.getRemote().sendBytes(ByteBuffer.wrap(data, offset, length));
+ session.sendBinary(ByteBuffer.wrap(data, offset, length), null);
}
private HttpServletRequest getHttpServletRequest(final UpgradeRequest upgradeRequest) {
@@ -335,5 +342,36 @@ public class Jetty11WebSocketDestination extends JettyHTTPDestination implements
}
}
+ @org.eclipse.jetty.websocket.api.annotations.WebSocket
+ public class Jetty12WebSocket {
+ volatile Session session;
+
+ @org.eclipse.jetty.websocket.api.annotations.OnWebSocketOpen
+ public void onOpen(Session sess) {
+ this.session = sess;
+ }
+
+ @org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage
+ public void onMessage(String message) {
+ try {
+ byte[] bdata = message.getBytes("utf-8");
+ onBinaryMessage(ByteBuffer.wrap(bdata), null);
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage
+ public void onBinaryMessage(ByteBuffer message, Callback callback) {
+ byte[] payload = new byte[message.remaining()];
+ message.get(payload);
+ invoke(payload, 0, payload.length, session);
+ }
+
+ @org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose
+ public void onClose(int code, String message) {
+ // members.remove(this);
+ }
+ }
}
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty11/JettyWebSocketHandler.java b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty12/JettyWebSocketHandler.java
similarity index 61%
rename from rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty11/JettyWebSocketHandler.java
rename to rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty12/JettyWebSocketHandler.java
index a2d6c9f4a2..941ce69e67 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty11/JettyWebSocketHandler.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty12/JettyWebSocketHandler.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.cxf.transport.websocket.jetty11;
+package org.apache.cxf.transport.websocket.jetty12;
import java.io.IOException;
@@ -25,49 +25,51 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.cxf.transport.http_jetty.JettyHTTPDestination;
import org.apache.cxf.transport.http_jetty.JettyHTTPHandler;
-import org.eclipse.jetty.server.Request;
-import org.eclipse.jetty.server.handler.ContextHandler;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer;
-import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.websocket.server.JettyWebSocketServerContainer;
+import org.eclipse.jetty.ee10.websocket.server.config.JettyWebSocketServletContainerInitializer;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.websocket.core.WebSocketComponents;
+import org.eclipse.jetty.websocket.core.server.WebSocketServerComponents;
/**
* The extended version of JettyHTTPHandler that can support websocket.
*/
class JettyWebSocketHandler extends JettyHTTPHandler {
- final Jetty11WebSocketDestination webSocketDestination;
+ final Jetty12WebSocketDestination webSocketDestination;
JettyWebSocketServerContainer webSocketContainer;
JettyWebSocketHandler(JettyHTTPDestination jhd, boolean cmExact,
- Jetty11WebSocketDestination wsd) {
+ Jetty12WebSocketDestination wsd) {
super(jhd, cmExact);
this.webSocketDestination = wsd;
+
}
- @Override
- public void doStart() throws Exception {
+
+ public void initHandler(Server server) {
+ ServletContextHandler servletContextHandler = createContextHandler();
+ servletContextHandler.setServer(server);
+ setServletContext(servletContextHandler.getServletContext());
webSocketContainer = webSocketDestination.getWebSocketContainer(getServletContext());
- super.doStart();
}
+
+
@Override
- public void handle(String target,
- Request baseRequest,
- HttpServletRequest request,
- HttpServletResponse response)
- throws IOException, ServletException {
-
+ protected void service(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
if (webSocketContainer.upgrade(webSocketDestination.getCreator(), request, response)) {
- baseRequest.setHandled(true);
return;
}
- super.handle(target, baseRequest, request, response);
+ super.service(request, response);
}
@Override
- public ContextHandler createContextHandler() {
+ public ServletContextHandler createContextHandler() {
final ServletContextHandler handler = new ServletContextHandler();
JettyWebSocketServletContainerInitializer.configure(handler, null);
+ handler.setAttribute(WebSocketServerComponents.WEBSOCKET_COMPONENTS_ATTRIBUTE, new WebSocketComponents());
return handler;
}
}
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/undertow/WebSocketUndertowServletRequest.java b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/undertow/WebSocketUndertowServletRequest.java
index 864ade3132..bd95b7762d 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/undertow/WebSocketUndertowServletRequest.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/undertow/WebSocketUndertowServletRequest.java
@@ -42,6 +42,7 @@ import jakarta.servlet.AsyncContext;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.ReadListener;
import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.ServletConnection;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletInputStream;
@@ -570,14 +571,28 @@ public class WebSocketUndertowServletRequest implements HttpServletRequest {
throw new UnsupportedOperationException();
}
- @Override
+
public String getRealPath(String path) {
return path;
}
- @Override
+
public boolean isRequestedSessionIdFromUrl() {
LOG.log(Level.FINE, "isRequestedSessionIdFromUrl");
return false;
}
+
+ public String getRequestId() {
+ return null;
+ }
+
+ @Override
+ public String getProtocolRequestId() {
+ return null;
+ }
+
+ @Override
+ public ServletConnection getServletConnection() {
+ return null;
+ }
}
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/undertow/WebSocketUndertowServletResponse.java b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/undertow/WebSocketUndertowServletResponse.java
index 1e64fbfc88..51beae4cc3 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/undertow/WebSocketUndertowServletResponse.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/undertow/WebSocketUndertowServletResponse.java
@@ -190,21 +190,7 @@ public class WebSocketUndertowServletResponse implements HttpServletResponse {
return responseHeaders.containsKey(name);
}
- @Override
- public String encodeRedirectURL(String url) {
- if (LOG.isLoggable(Level.FINE)) {
- LOG.log(Level.FINE, "encodeRedirectURL({0})", url);
- }
- return null;
- }
-
- @Override
- public String encodeURL(String url) {
- if (LOG.isLoggable(Level.FINE)) {
- LOG.log(Level.FINE, "encodeURL({0})", url);
- }
- return null;
- }
+
@Override
public String getHeader(String name) {
@@ -368,16 +354,16 @@ public class WebSocketUndertowServletResponse implements HttpServletResponse {
}
@Override
- public String encodeUrl(String url) {
+ public String encodeURL(String url) {
return URLEncoder.encode(url, StandardCharsets.UTF_8);
}
@Override
- public String encodeRedirectUrl(String url) {
+ public String encodeRedirectURL(String url) {
return URLEncoder.encode(url, StandardCharsets.UTF_8);
}
- @Override
+
public void setStatus(int sc, String sm) {
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "setStatus({0})", sc);
diff --git a/rt/transports/websocket/src/test/java/org/apache/cxf/transport/websocket/jetty/JettyWebSocketDestinationTest.java b/rt/transports/websocket/src/test/java/org/apache/cxf/transport/websocket/jetty/JettyWebSocketDestinationTest.java
index fb1326dab3..3bf5da0310 100644
--- a/rt/transports/websocket/src/test/java/org/apache/cxf/transport/websocket/jetty/JettyWebSocketDestinationTest.java
+++ b/rt/transports/websocket/src/test/java/org/apache/cxf/transport/websocket/jetty/JettyWebSocketDestinationTest.java
@@ -30,7 +30,8 @@ import org.apache.cxf.transport.http.DestinationRegistry;
import org.apache.cxf.transport.http.HTTPTransportFactory;
import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine;
import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngineFactory;
-import org.apache.cxf.transport.websocket.jetty11.Jetty11WebSocketDestination;
+import org.apache.cxf.transport.websocket.jetty12.Jetty12WebSocketDestination;
+import org.eclipse.jetty.server.Server;
import org.junit.Test;
@@ -52,7 +53,7 @@ public class JettyWebSocketDestinationTest {
endpoint.setAddress(ENDPOINT_ADDRESS);
endpoint.setName(ENDPOINT_NAME);
JettyHTTPServerEngine engine = mock(JettyHTTPServerEngine.class);
-
+ engine.setServer(new Server());
TestJettyWebSocketDestination dest = new TestJettyWebSocketDestination(bus, registry, endpoint, null, engine);
dest.activate();
@@ -64,7 +65,7 @@ public class JettyWebSocketDestinationTest {
assertNull(registry.getDestinationForPath(ENDPOINT_ADDRESS));
}
- private static class TestJettyWebSocketDestination extends Jetty11WebSocketDestination {
+ private static class TestJettyWebSocketDestination extends Jetty12WebSocketDestination {
TestJettyWebSocketDestination(Bus bus, DestinationRegistry registry, EndpointInfo ei,
JettyHTTPServerEngineFactory serverEngineFactory,
JettyHTTPServerEngine engine) throws IOException {
@@ -74,12 +75,16 @@ public class JettyWebSocketDestinationTest {
@Override
public void activate() {
- super.activate();
+ synchronized (this) {
+ if (registry != null) {
+ registry.addDestination(this);
+ }
+ }
}
@Override
public void deactivate() {
- super.deactivate();
+ super.deactivate();
}
}
-}
\ No newline at end of file
+}
diff --git a/systests/cdi/base/pom.xml b/systests/cdi/base/pom.xml
index 8e0d189513..57b681007c 100644
--- a/systests/cdi/base/pom.xml
+++ b/systests/cdi/base/pom.xml
@@ -39,18 +39,12 @@
<artifactId>jetty-server</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>apache-jsp</artifactId>
- <exclusions>
- <exclusion>
- <groupId>jakarta.annotation</groupId>
- <artifactId>jakarta.annotation-api</artifactId>
- </exclusion>
- </exclusions>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
diff --git a/systests/cdi/base/src/main/java/org/apache/cxf/systests/cdi/base/jetty/AbstractJettyServer.java b/systests/cdi/base/src/main/java/org/apache/cxf/systests/cdi/base/jetty/AbstractJettyServer.java
index d9a178ed4c..e8d1a813d3 100644
--- a/systests/cdi/base/src/main/java/org/apache/cxf/systests/cdi/base/jetty/AbstractJettyServer.java
+++ b/systests/cdi/base/src/main/java/org/apache/cxf/systests/cdi/base/jetty/AbstractJettyServer.java
@@ -22,14 +22,13 @@ import java.util.EventListener;
import org.apache.cxf.cdi.CXFCdiServlet;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.DefaultHandler;
-import org.eclipse.jetty.server.handler.HandlerCollection;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.webapp.WebAppContext;
+
import static org.junit.Assert.fail;
@@ -71,10 +70,10 @@ public abstract class AbstractJettyServer extends AbstractBusTestServerBase {
} else {
final WebAppContext context = new WebAppContext();
context.setContextPath(contextPath);
- context.setBaseResource(Resource.newClassPathResource(resourcePath));
+ context.setBaseResourceAsString(this.getClass().getResource(resourcePath).toString());
WebAppContext.addServerClasses(server, "org.eclipse.jetty.servlet.ServletContextHandler.Decorator");
- HandlerCollection handlers = new HandlerCollection();
+ Handler.Collection handlers = new Handler.Sequence();
handlers.setHandlers(new Handler[] {context, new DefaultHandler()});
server.setHandler(handlers);
}
diff --git a/systests/cdi/pom.xml b/systests/cdi/pom.xml
index 9b88e585c4..c2aaeeed6f 100644
--- a/systests/cdi/pom.xml
+++ b/systests/cdi/pom.xml
@@ -48,17 +48,6 @@
<artifactId>jakarta.el</artifactId>
<version>${cxf.glassfish.el.version}</version>
</dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>apache-jsp</artifactId>
- <version>${cxf.jetty.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.mortbay.jasper</groupId>
- <artifactId>apache-jsp</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
diff --git a/systests/databinding/pom.xml b/systests/databinding/pom.xml
index 059b48e18d..487162d3f0 100644
--- a/systests/databinding/pom.xml
+++ b/systests/databinding/pom.xml
@@ -192,8 +192,8 @@
<artifactId>jetty-server</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
diff --git a/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisServer.java b/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisServer.java
index b36920d419..e607e151a2 100644
--- a/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisServer.java
+++ b/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisServer.java
@@ -19,11 +19,11 @@
package org.apache.cxf.systest.aegis;
+
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
+import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.handler.DefaultHandler;
-import org.eclipse.jetty.server.handler.HandlerCollection;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.webapp.WebAppContext;
public class AegisServer extends AbstractBusTestServerBase {
@@ -34,15 +34,17 @@ public class AegisServer extends AbstractBusTestServerBase {
protected void run() {
//System.out.println("Starting Server");
- server = new org.eclipse.jetty.server.Server(Integer.parseInt(PORT));
-
- WebAppContext webappcontext = new WebAppContext();
- webappcontext.setContextPath("/");
- webappcontext.setBaseResource(Resource.newClassPathResource("/webapp"));
-
- server.setHandler(new HandlerCollection(webappcontext, new DefaultHandler()));
+
try {
+ server = new org.eclipse.jetty.server.Server(Integer.parseInt(PORT));
+
+ WebAppContext webappcontext = new WebAppContext();
+ webappcontext.setContextPath("/");
+ webappcontext.setBaseResourceAsString(this.getClass().getResource("/webapp").toString());
+
+ server.setHandler(new Handler.Sequence(webappcontext, new DefaultHandler()));
server.start();
+
} catch (Exception e) {
throw new RuntimeException(e);
}
diff --git a/systests/jaxrs/pom.xml b/systests/jaxrs/pom.xml
index c6e71491aa..fdfdb789c4 100644
--- a/systests/jaxrs/pom.xml
+++ b/systests/jaxrs/pom.xml
@@ -47,6 +47,10 @@
<artifactId>hibernate-validator</artifactId>
<version>${cxf.hibernate.validator.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-apache-jsp</artifactId>
+ </dependency>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
@@ -120,33 +124,6 @@
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-security</artifactId>
</dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-plus</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>apache-jsp</artifactId>
- <version>${cxf.jetty.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.glassfish</groupId>
- <artifactId>jakarta.el</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-commons</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jakarta.annotation</groupId>
- <artifactId>jakarta.annotation-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
@@ -203,6 +180,11 @@
<artifactId>cxf-rt-transports-websocket</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty.ee10.websocket</groupId>
+ <artifactId>jetty-ee10-websocket-jetty-server</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-features-clustering</artifactId>
@@ -618,30 +600,5 @@
</dependency>
</dependencies>
</profile>
- <profile>
- <id>jetty11</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.eclipse.jetty.websocket</groupId>
- <artifactId>websocket-jakarta-server</artifactId>
- <version>${cxf.jetty11.version}</version>
- <exclusions>
- <exclusion>
- <groupId>jakarta.servlet</groupId>
- <artifactId>jakarta.servlet-api</artifactId>
- </exclusion>
- </exclusions>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-jaas</artifactId>
- <version>${cxf.jetty11.version}</version>
- </dependency>
- </dependencies>
- </profile>
</profiles>
</project>
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractSpringServer.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractSpringServer.java
index ef329cc7bf..b470fc1581 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractSpringServer.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractSpringServer.java
@@ -20,17 +20,17 @@
package org.apache.cxf.systest.jaxrs;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
+import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.handler.DefaultHandler;
-import org.eclipse.jetty.server.handler.HandlerCollection;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.jetty.util.resource.ResourceFactory;
public abstract class AbstractSpringServer extends AbstractBusTestServerBase {
- private org.eclipse.jetty.server.Server server;
- private String resourcePath;
- private String contextPath;
- private int port;
+ protected org.eclipse.jetty.server.Server server;
+ protected String resourcePath;
+ protected String contextPath;
+ protected int port;
protected AbstractSpringServer(String path, int portNumber) {
this(path, "/", portNumber);
@@ -47,9 +47,9 @@ public abstract class AbstractSpringServer extends AbstractBusTestServerBase {
WebAppContext webappcontext = new WebAppContext();
webappcontext.setContextPath(contextPath);
- webappcontext.setBaseResource(Resource.newClassPathResource(resourcePath));
-
- server.setHandler(new HandlerCollection(webappcontext, new DefaultHandler()));
+ webappcontext.setBaseResource(ResourceFactory.of(webappcontext).newClassPathResource(resourcePath));
+ webappcontext.setThrowUnavailableOnStartupException(true);
+ server.setHandler(new Handler.Sequence(webappcontext, new DefaultHandler()));
try {
configureServer(server);
@@ -71,4 +71,6 @@ public abstract class AbstractSpringServer extends AbstractBusTestServerBase {
server = null;
}
}
+
+
}
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookCxfContinuationServlet3Server.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookCxfContinuationServlet3Server.java
index 06ae8a5652..c2db32f688 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookCxfContinuationServlet3Server.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookCxfContinuationServlet3Server.java
@@ -25,9 +25,10 @@ import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
public class BookCxfContinuationServlet3Server extends AbstractBusTestServerBase {
public static final String PORT = allocatePort(BookCxfContinuationServlet3Server.class);
@@ -52,8 +53,11 @@ public class BookCxfContinuationServlet3Server extends AbstractBusTestServerBase
private Server httpServer(CXFNonSpringServlet cxf) {
Server server = new Server(Integer.parseInt(PORT));
+ ServletContextHandler servletContextHandler = new ServletContextHandler();
+
ServletHandler handler = new ServletHandler();
- server.setHandler(handler);
+ servletContextHandler.setHandler(handler);
+ server.setHandler(servletContextHandler);
handler.addServletWithMapping(new ServletHolder(cxf), "/*");
return server;
}
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/form/FormWithFilterServer.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/form/FormWithFilterServer.java
index 8f1615586b..5f99cb4b95 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/form/FormWithFilterServer.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/form/FormWithFilterServer.java
@@ -25,11 +25,12 @@ import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
+import org.eclipse.jetty.ee10.servlet.FilterHolder;
+import org.eclipse.jetty.ee10.servlet.FilterMapping;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlet.FilterMapping;
-import org.eclipse.jetty.servlet.ServletHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
public class FormWithFilterServer extends AbstractBusTestServerBase {
public static final String PORT = allocatePort(FormWithFilterServer.class);
@@ -53,9 +54,12 @@ public class FormWithFilterServer extends AbstractBusTestServerBase {
}
private Server httpServer(CXFNonSpringServlet cxf) {
+ ServletContextHandler servletContextHandler = new ServletContextHandler();
Server server = new Server(Integer.parseInt(PORT));
ServletHandler handler = new ServletHandler();
- server.setHandler(handler);
+ servletContextHandler.setHandler(handler);
+ server.setHandler(servletContextHandler);
+
handler.addServletWithMapping(new ServletHolder(cxf), "/*");
handler.addFilterWithMapping(new FilterHolder(new FormReaderFilter()), "/*", FilterMapping.ALL);
return server;
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/nonspring/NonSpringJaxrsServletBookServer.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/nonspring/NonSpringJaxrsServletBookServer.java
index fbb500be1e..658ebe25cb 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/nonspring/NonSpringJaxrsServletBookServer.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/nonspring/NonSpringJaxrsServletBookServer.java
@@ -23,8 +23,8 @@ import org.apache.cxf.ext.logging.LoggingInInterceptor;
import org.apache.cxf.ext.logging.LoggingOutInterceptor;
import org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
public class NonSpringJaxrsServletBookServer extends AbstractBusTestServerBase {
public static final String PORT = allocatePort(NonSpringJaxrsServletBookServer.class);
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/nonspring/NonSpringJaxrsServletBookServer2.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/nonspring/NonSpringJaxrsServletBookServer2.java
index d4df6e9191..4f4b558b15 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/nonspring/NonSpringJaxrsServletBookServer2.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/nonspring/NonSpringJaxrsServletBookServer2.java
@@ -22,8 +22,8 @@ package org.apache.cxf.systest.jaxrs.nonspring;
import org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet;
import org.apache.cxf.systest.jaxrs.BookApplicationNonSpring;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
public class NonSpringJaxrsServletBookServer2 extends AbstractBusTestServerBase {
public static final String PORT = allocatePort(NonSpringJaxrsServletBookServer2.class);
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginModule.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginModule.java
index 0cf46b3af9..97053215e9 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginModule.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginModule.java
@@ -47,8 +47,8 @@ public class BookLoginModule implements LoginModule {
private static Class<LoginModule> getLoginModuleClass() {
Class<?> clz = null;
try {
- // try the jetty9 version
- clz = Class.forName("org.eclipse.jetty.jaas.spi.PropertyFileLoginModule",
+ // try the jetty12 version
+ clz = Class.forName("org.eclipse.jetty.security.jaas.spi.PropertyFileLoginModule",
true, BookLoginModule.class.getClassLoader());
} catch (Throwable t) {
if (clz == null) {
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginService.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginService.java
index cfbcce4565..d39eabf81a 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginService.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginService.java
@@ -21,7 +21,7 @@ package org.apache.cxf.systest.jaxrs.security;
import java.lang.reflect.Field;
-import org.eclipse.jetty.jaas.JAASLoginService;
+import org.eclipse.jetty.security.jaas.JAASLoginService;
/**
* Since BookLoginModule delegates to PropertyFileLoginModule, the access to JAASLoginService.INSTANCE
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringClass.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringClass.java
index b6493680ca..0250efb9c6 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringClass.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringClass.java
@@ -20,10 +20,11 @@
package org.apache.cxf.systest.jaxrs.security;
import org.apache.cxf.systest.jaxrs.AbstractSpringServer;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.handler.HandlerCollection;
-import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.jetty.server.handler.DefaultHandler;
+import org.eclipse.jetty.util.resource.ResourceFactory;
@@ -34,13 +35,36 @@ public class BookServerSecuritySpringClass extends AbstractSpringServer {
super("/jaxrs_security_cglib", PORT);
}
+ @Override
+ protected void run() {
+ server = new org.eclipse.jetty.server.Server(port);
+
+ WebAppContext webappcontext = new TestWebAppContext();
+ webappcontext.setContextPath(contextPath);
+ webappcontext.setBaseResource(ResourceFactory.of(webappcontext).newClassPathResource(resourcePath));
+ webappcontext.setThrowUnavailableOnStartupException(true);
+ server.setHandler(new Handler.Sequence(webappcontext, new DefaultHandler()));
+
+ try {
+ configureServer(server);
+ server.start();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
@Override
protected void configureServer(Server server) throws Exception {
- final HandlerCollection collection = (HandlerCollection) server.getHandler();
+ final Handler.Collection collection = (Handler.Collection) server.getHandler();
for (Handler handler: collection.getHandlers()) {
if (handler instanceof WebAppContext) {
- final WebAppContext webappcontext = (WebAppContext) handler;
+ final WebAppContext webappcontext = (WebAppContext) handler;
+ //this is important however this classloader isn't used by
+ //jetty12 by default as it's wrappped in WebAppClassLoader
+ //as parent. That's why we need TestWebAppContext to override
+ //the behaviour
webappcontext.setClassLoader(getClass().getClassLoader());
+
}
}
}
@@ -57,4 +81,11 @@ public class BookServerSecuritySpringClass extends AbstractSpringServer {
}
}
+ class TestWebAppContext extends WebAppContext {
+ @Override
+ protected ClassLoader configureClassLoader(ClassLoader loader) {
+ return loader;
+ }
+
+ }
}
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSimpleSecurity.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSimpleSecurity.java
index 35fbd2b4ff..302f5556db 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSimpleSecurity.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSimpleSecurity.java
@@ -24,7 +24,8 @@ import java.net.URL;
import org.apache.cxf.systest.jaxrs.AbstractSpringServer;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.security.LoginService;
-
+import org.eclipse.jetty.server.handler.ContextHandler;
+import org.eclipse.jetty.util.resource.ResourceFactory;
public class BookServerSimpleSecurity extends AbstractSpringServer {
@@ -39,7 +40,8 @@ public class BookServerSimpleSecurity extends AbstractSpringServer {
URL resource = getClass()
.getResource("/org/apache/cxf/systest/jaxrs/security/jetty-realm.properties");
LoginService realm =
- new HashLoginService("BookStoreRealm", resource.toString());
+ new HashLoginService("BookStoreRealm",
+ ResourceFactory.of(new ContextHandler()).newResource(resource.toString()));
server.addBean(realm);
}
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/JAXRSClientServerWebSocketSpringWebAppNoAtmosphereTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/JAXRSClientServerWebSocketSpringWebAppNoAtmosphereTest.java
index 9b96291aeb..6fd1c50f1b 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/JAXRSClientServerWebSocketSpringWebAppNoAtmosphereTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/JAXRSClientServerWebSocketSpringWebAppNoAtmosphereTest.java
@@ -22,10 +22,9 @@ package org.apache.cxf.systest.jaxrs.websocket;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
import org.apache.cxf.systest.jaxrs.Book;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.handler.DefaultHandler;
-import org.eclipse.jetty.server.handler.HandlerCollection;
-import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -57,7 +56,7 @@ public class JAXRSClientServerWebSocketSpringWebAppNoAtmosphereTest extends Abst
webappcontext.setContextPath("/webapp");
webappcontext.setWar(contextPath);
- HandlerCollection handlers = new HandlerCollection();
+ Handler.Collection handlers = new Handler.Sequence();
handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
server.setHandler(handlers);
server.start();
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/JAXRSClientServerWebSocketSpringWebAppTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/JAXRSClientServerWebSocketSpringWebAppTest.java
index 2a0c8c3993..02f2bd200b 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/JAXRSClientServerWebSocketSpringWebAppTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/JAXRSClientServerWebSocketSpringWebAppTest.java
@@ -22,10 +22,9 @@ package org.apache.cxf.systest.jaxrs.websocket;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
import org.apache.cxf.systest.jaxrs.Book;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.handler.DefaultHandler;
-import org.eclipse.jetty.server.handler.HandlerCollection;
-import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -56,7 +55,7 @@ public class JAXRSClientServerWebSocketSpringWebAppTest extends AbstractJAXRSCli
webappcontext.setContextPath("/webapp");
webappcontext.setWar(contextPath);
- HandlerCollection handlers = new HandlerCollection();
+ Handler.Collection handlers = new Handler.Sequence();
handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
server.setHandler(handlers);
server.start();
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/WebSocketTestClient.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/WebSocketTestClient.java
index 91bb53f65b..66f2e94798 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/WebSocketTestClient.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/WebSocketTestClient.java
@@ -29,6 +29,7 @@ import java.util.Objects;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import java.util.logging.Logger;
import org.apache.cxf.common.logging.LogUtils;
@@ -54,9 +55,10 @@ class WebSocketTestClient implements Closeable {
private final AsyncHttpClient client = new DefaultAsyncHttpClient();
private final WebSocket websocket;
- WebSocketTestClient(String url) throws InterruptedException, ExecutionException {
+ WebSocketTestClient(String url) throws InterruptedException, ExecutionException, TimeoutException {
websocket = Objects.requireNonNull(client.prepareGet(url).execute(
- new WebSocketUpgradeHandler.Builder().addWebSocketListener(new WsSocketListener()).build()).get());
+ new WebSocketUpgradeHandler.Builder().addWebSocketListener(
+ new WsSocketListener()).build()).get(1000, TimeUnit.SECONDS));
reset(1);
}
diff --git a/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/beans.xml b/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/beans.xml
index a1e344d995..3933b9f544 100644
--- a/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/beans.xml
+++ b/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/beans.xml
@@ -45,7 +45,7 @@
</bean>
<bean id="dispatchProvider4" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider">
<property name="resourcePath" value="/book.html"/>
- <property name="dispatcherName" value="default"/>
+ <property name="dispatcherName" value="DefaultCXFServlet"/>
</bean>
<bean id="dispatchProvider5" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider">
<property name="resourcePath" value="/book_include.html"/>
diff --git a/systests/jaxws/pom.xml b/systests/jaxws/pom.xml
index 7b3f7e0438..ee27e2f816 100644
--- a/systests/jaxws/pom.xml
+++ b/systests/jaxws/pom.xml
@@ -172,8 +172,7 @@
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
- <artifactId>websocket-jakarta-server</artifactId>
- <version>${cxf.jetty11.version}</version>
+ <artifactId>jetty-websocket-jetty-server</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
@@ -182,9 +181,15 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty.ee10.websocket</groupId>
+ <artifactId>jetty-ee10-websocket-jetty-server</artifactId>
+ <scope>test</scope>
+ </dependency>
+
<dependency>
<groupId>org.eclipse.jetty.http2</groupId>
- <artifactId>http2-server</artifactId>
+ <artifactId>jetty-http2-server</artifactId>
<optional>true</optional>
</dependency>
<dependency>
diff --git a/systests/microprofile/client/async/pom.xml b/systests/microprofile/client/async/pom.xml
index 30d46959d6..a4e1ccba41 100644
--- a/systests/microprofile/client/async/pom.xml
+++ b/systests/microprofile/client/async/pom.xml
@@ -144,7 +144,7 @@
</dependency>
<dependency>
<groupId>org.wiremock</groupId>
- <artifactId>wiremock</artifactId>
+ <artifactId>wiremock-standalone</artifactId>
<version>${cxf.wiremock.version}</version>
<scope>test</scope>
<exclusions>
@@ -152,6 +152,10 @@
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.eclipse.jetty.*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
diff --git a/systests/microprofile/client/nocdi/pom.xml b/systests/microprofile/client/nocdi/pom.xml
index 4048f2520d..5941249f03 100644
--- a/systests/microprofile/client/nocdi/pom.xml
+++ b/systests/microprofile/client/nocdi/pom.xml
@@ -140,7 +140,7 @@
</dependency>
<dependency>
<groupId>org.wiremock</groupId>
- <artifactId>wiremock</artifactId>
+ <artifactId>wiremock-standalone</artifactId>
<version>${cxf.wiremock.version}</version>
<scope>test</scope>
<exclusions>
diff --git a/systests/microprofile/client/tracing/pom.xml b/systests/microprofile/client/tracing/pom.xml
index 2c6bceb9d2..a2152cf1f1 100644
--- a/systests/microprofile/client/tracing/pom.xml
+++ b/systests/microprofile/client/tracing/pom.xml
@@ -56,49 +56,6 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-io</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-security</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-plus</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>apache-jsp</artifactId>
- <version>${cxf.jetty.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.glassfish</groupId>
- <artifactId>jakarta.el</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-commons</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jakarta.annotation</groupId>
- <artifactId>jakarta.annotation-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-core</artifactId>
diff --git a/systests/microprofile/client/weld/pom.xml b/systests/microprofile/client/weld/pom.xml
index 56d0d7f690..50f7e9bae6 100644
--- a/systests/microprofile/client/weld/pom.xml
+++ b/systests/microprofile/client/weld/pom.xml
@@ -124,8 +124,18 @@
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
</exclusions>
</dependency>
+
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>jakarta.json.bind</groupId>
@@ -171,14 +181,10 @@
</execution>
</executions>
<dependencies>
- <!--
- The end goal is to use wiremock 3.0.0 but sadly microprofile-rest-client-tck
- still depends on javax.servlet (MyEventSourceServlet.java).
- -->
<dependency>
- <groupId>com.github.tomakehurst</groupId>
- <artifactId>wiremock-jre8-standalone</artifactId>
- <version>2.35.1</version>
+ <groupId>org.wiremock</groupId>
+ <artifactId>wiremock-standalone</artifactId>
+ <version>${cxf.wiremock.version}</version>
</dependency>
</dependencies>
</plugin>
diff --git a/systests/rs-http-sci/pom.xml b/systests/rs-http-sci/pom.xml
index 7d0686871c..44f0e4ac53 100644
--- a/systests/rs-http-sci/pom.xml
+++ b/systests/rs-http-sci/pom.xml
@@ -35,28 +35,12 @@
</properties>
<dependencies>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-annotations</artifactId>
- <version>${cxf.jetty.version}</version>
- <exclusions>
- <exclusion>
- <groupId>jakarta.annotation</groupId>
- <artifactId>jakarta.annotation-api</artifactId>
- </exclusion>
- </exclusions>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-plus</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>apache-jsp</artifactId>
- <version>${cxf.jetty.version}</version>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
diff --git a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/AbstractJettyServer.java b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/AbstractJettyServer.java
index 0b50353f13..716c75bbb3 100644
--- a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/AbstractJettyServer.java
+++ b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/AbstractJettyServer.java
@@ -20,13 +20,13 @@
package org.apache.cxf.jaxrs.servlet.jetty;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
-import org.eclipse.jetty.annotations.AnnotationConfiguration;
+import org.eclipse.jetty.ee10.annotations.AnnotationConfiguration;
+import org.eclipse.jetty.ee10.webapp.Configuration;
+import org.eclipse.jetty.ee10.webapp.WebAppConfiguration;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
+import org.eclipse.jetty.ee10.webapp.WebXmlConfiguration;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.webapp.Configuration;
-import org.eclipse.jetty.webapp.WebAppConfiguration;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.eclipse.jetty.webapp.WebXmlConfiguration;
import static org.junit.Assert.fail;
diff --git a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyEmptyApplicationTest.java b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyEmptyApplicationTest.java
index c0abe76e46..e910816c22 100644
--- a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyEmptyApplicationTest.java
+++ b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyEmptyApplicationTest.java
@@ -23,7 +23,9 @@ import com.fasterxml.jackson.jakarta.rs.json.JacksonJsonProvider;
import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
import org.apache.cxf.jaxrs.servlet.AbstractSciTest;
+import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.resource.Resource;
+import org.eclipse.jetty.util.resource.ResourceFactory;
import org.junit.BeforeClass;
import org.junit.Ignore;
@@ -39,11 +41,14 @@ public class JettyEmptyApplicationTest extends AbstractSciTest {
super("/",
new Resource[] {
// Limit the classpath scanning to org.apache.demo.resources package
- Resource.newClassPathResource("/org/apache/demo/resources"),
+ ResourceFactory.of(new ContextHandler()).
+ newClassPathResource("/org/apache/demo/resources"),
// Include JAX-RS application from org.apache.applications.empty package
- Resource.newClassPathResource("/org/apache/demo/applications/empty"),
+ ResourceFactory.of(new ContextHandler()).
+ newClassPathResource("/org/apache/demo/applications/empty"),
// Include Jackson @Providers into classpath scanning
- Resource.newResource(JacksonJsonProvider.class.getProtectionDomain().getCodeSource().getLocation())
+ ResourceFactory.of(new ContextHandler()).
+ newResource(JacksonJsonProvider.class.getProtectionDomain().getCodeSource().getLocation())
}, PORT);
}
}
diff --git a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyEmptyPathApplicationTest.java b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyEmptyPathApplicationTest.java
index b1b08ce324..f00ad7435a 100644
--- a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyEmptyPathApplicationTest.java
+++ b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyEmptyPathApplicationTest.java
@@ -23,8 +23,10 @@ import com.fasterxml.jackson.jakarta.rs.json.JacksonJsonProvider;
import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
import org.apache.cxf.jaxrs.servlet.AbstractSciTest;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
+import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.jetty.util.resource.ResourceFactory;
import org.junit.BeforeClass;
import org.junit.Ignore;
@@ -40,11 +42,14 @@ public class JettyEmptyPathApplicationTest extends AbstractSciTest {
super("/",
new Resource[] {
// Limit the classpath scanning to org.apache.demo.resources package
- Resource.newClassPathResource("/org/apache/demo/resources"),
+ ResourceFactory.of(new ContextHandler()).
+ newClassPathResource("/org/apache/demo/resources"),
// Include JAX-RS application from org.apache.applications.empty package
- Resource.newClassPathResource("/org/apache/demo/applications/emptypath"),
+ ResourceFactory.of(new ContextHandler()).
+ newClassPathResource("/org/apache/demo/applications/emptypath"),
// Include Jackson @Providers into classpath scanning
- Resource.newResource(JacksonJsonProvider.class.getProtectionDomain().getCodeSource().getLocation())
+ ResourceFactory.of(new ContextHandler()).
+ newResource(JacksonJsonProvider.class.getProtectionDomain().getCodeSource().getLocation())
}, PORT);
}
diff --git a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyNoApplicationTest.java b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyNoApplicationTest.java
index cc34e6fc02..f20ba9c321 100644
--- a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyNoApplicationTest.java
+++ b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyNoApplicationTest.java
@@ -23,8 +23,10 @@ import com.fasterxml.jackson.jakarta.rs.json.JacksonJsonProvider;
import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
import org.apache.cxf.jaxrs.servlet.AbstractSciTest;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
+import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.jetty.util.resource.ResourceFactory;
import org.junit.BeforeClass;
import org.junit.Ignore;
@@ -40,9 +42,11 @@ public class JettyNoApplicationTest extends AbstractSciTest {
super("/",
new Resource[] {
// Limit the classpath scanning to org.apache.demo.resources package
- Resource.newClassPathResource("/org/apache/demo/resources"),
+ ResourceFactory.of(new ContextHandler()).
+ newClassPathResource("/org/apache/demo/resources"),
// Include Jackson @Providers into classpath scanning
- Resource.newResource(JacksonJsonProvider.class.getProtectionDomain().getCodeSource().getLocation())
+ ResourceFactory.of(new ContextHandler()).
+ newResource(JacksonJsonProvider.class.getProtectionDomain().getCodeSource().getLocation())
}, PORT);
}
diff --git a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationOnlyClassesTest.java b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationOnlyClassesTest.java
index 26508bc922..b2702433be 100644
--- a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationOnlyClassesTest.java
+++ b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationOnlyClassesTest.java
@@ -21,7 +21,9 @@ package org.apache.cxf.jaxrs.servlet.jetty;
import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
import org.apache.cxf.jaxrs.servlet.AbstractSciTest;
+import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.resource.Resource;
+import org.eclipse.jetty.util.resource.ResourceFactory;
import org.junit.BeforeClass;
import org.junit.Ignore;
@@ -37,9 +39,11 @@ public class JettySingleApplicationOnlyClassesTest extends AbstractSciTest {
super("/",
new Resource[] {
// Limit the classpath scanning to org.apache.demo.resources package
- Resource.newClassPathResource("/org/apache/demo/resources"),
+ ResourceFactory.of(new ContextHandler()).
+ newClassPathResource("/org/apache/demo/resources"),
// Include JAX-RS application from org.apache.applications.classes package
- Resource.newClassPathResource("/org/apache/demo/applications/classes")
+ ResourceFactory.of(new ContextHandler()).
+ newClassPathResource("/org/apache/demo/applications/classes")
}, PORT);
}
}
diff --git a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationOnlySingletonsTest.java b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationOnlySingletonsTest.java
index 6431ef0240..0d0ee2fbef 100644
--- a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationOnlySingletonsTest.java
+++ b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationOnlySingletonsTest.java
@@ -21,7 +21,9 @@ package org.apache.cxf.jaxrs.servlet.jetty;
import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
import org.apache.cxf.jaxrs.servlet.AbstractSciTest;
+import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.resource.Resource;
+import org.eclipse.jetty.util.resource.ResourceFactory;
import org.junit.BeforeClass;
import org.junit.Ignore;
@@ -37,9 +39,11 @@ public class JettySingleApplicationOnlySingletonsTest extends AbstractSciTest {
super("/",
new Resource[] {
// Limit the classpath scanning to org.apache.demo.resources package
- Resource.newClassPathResource("/org/apache/demo/resources"),
+ ResourceFactory.of(new ContextHandler()).
+ newClassPathResource("/org/apache/demo/resources"),
// Include JAX-RS application from org.apache.applications.singletons package
- Resource.newClassPathResource("/org/apache/demo/applications/singletons")
+ ResourceFactory.of(new ContextHandler()).
+ newClassPathResource("/org/apache/demo/applications/singletons")
}, PORT);
}
}
diff --git a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationTest.java b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationTest.java
index cc6e414153..039abe31d3 100644
--- a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationTest.java
+++ b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettySingleApplicationTest.java
@@ -21,7 +21,9 @@ package org.apache.cxf.jaxrs.servlet.jetty;
import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
import org.apache.cxf.jaxrs.servlet.AbstractSciTest;
+import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.resource.Resource;
+import org.eclipse.jetty.util.resource.ResourceFactory;
import org.junit.BeforeClass;
import org.junit.Ignore;
@@ -37,9 +39,11 @@ public class JettySingleApplicationTest extends AbstractSciTest {
super("/",
new Resource[] {
// Limit the classpath scanning to org.apache.demo.resources package
- Resource.newClassPathResource("/org/apache/demo/resources"),
+ ResourceFactory.of(new ContextHandler()).
+ newClassPathResource("/org/apache/demo/resources"),
// Limit the classpath scanning to org.apache.demo.complete package
- Resource.newClassPathResource("/org/apache/demo/applications/complete")
+ ResourceFactory.of(new ContextHandler()).
+ newClassPathResource("/org/apache/demo/applications/complete")
}, PORT);
}
}
diff --git a/systests/rs-security/pom.xml b/systests/rs-security/pom.xml
index 150bdd6123..c04ffaf9fc 100644
--- a/systests/rs-security/pom.xml
+++ b/systests/rs-security/pom.xml
@@ -35,8 +35,8 @@
</properties>
<dependencies>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
diff --git a/systests/rs-sse/rs-sse-jetty/pom.xml b/systests/rs-sse/rs-sse-jetty/pom.xml
index d6a54916c6..657f0d1047 100644
--- a/systests/rs-sse/rs-sse-jetty/pom.xml
+++ b/systests/rs-sse/rs-sse-jetty/pom.xml
@@ -33,37 +33,19 @@
<cxf.module.name>org.apache.cxf.systests.rs.sse.jetty</cxf.module.name>
</properties>
<dependencies>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-annotations</artifactId>
- <version>${cxf.jetty.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>jakarta.annotation</groupId>
- <artifactId>jakarta.annotation-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-plus</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty.websocket</groupId>
- <artifactId>websocket-jakarta-server</artifactId>
- <version>${cxf.jetty.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-servlet</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/systests/rs-sse/rs-sse-jetty/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/AbstractJettyServer.java b/systests/rs-sse/rs-sse-jetty/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/AbstractJettyServer.java
index 8721b74a7d..7b96aff16a 100644
--- a/systests/rs-sse/rs-sse-jetty/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/AbstractJettyServer.java
+++ b/systests/rs-sse/rs-sse-jetty/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/AbstractJettyServer.java
@@ -25,14 +25,14 @@ import org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet;
import org.apache.cxf.systest.jaxrs.sse.BookStore;
import org.apache.cxf.systest.jaxrs.sse.BookStoreResponseFilter;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.DefaultHandler;
-import org.eclipse.jetty.server.handler.HandlerCollection;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.jetty.util.resource.ResourceFactory;
+
import static org.junit.Assert.fail;
@@ -73,9 +73,8 @@ public abstract class AbstractJettyServer extends AbstractBusTestServerBase {
} else {
final WebAppContext context = new WebAppContext();
context.setContextPath(contextPath);
- context.setBaseResource(Resource.newClassPathResource(resourcePath));
-
- HandlerCollection handlers = new HandlerCollection();
+ context.setBaseResource(ResourceFactory.of(context).newClassPathResource(resourcePath));
+ Handler.Collection handlers = new Handler.Sequence();
handlers.setHandlers(new Handler[] {context, new DefaultHandler()});
server.setHandler(handlers);
}
diff --git a/systests/tracing/pom.xml b/systests/tracing/pom.xml
index f2df2b9089..88a4c07ea5 100644
--- a/systests/tracing/pom.xml
+++ b/systests/tracing/pom.xml
@@ -40,21 +40,6 @@
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-plus</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>apache-jsp</artifactId>
- <version>${cxf.jetty.version}</version>
- <exclusions>
- <exclusion>
- <groupId>jakarta.annotation</groupId>
- <artifactId>jakarta.annotation-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
diff --git a/systests/transport-hc5/pom.xml b/systests/transport-hc5/pom.xml
index 0f71199bc6..5d7dd1b243 100644
--- a/systests/transport-hc5/pom.xml
+++ b/systests/transport-hc5/pom.xml
@@ -99,7 +99,7 @@
</dependency>
<dependency>
<groupId>org.eclipse.jetty.http2</groupId>
- <artifactId>http2-server</artifactId>
+ <artifactId>jetty-http2-server</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -108,8 +108,8 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/http/auth/DigestServer.java b/systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/http/auth/DigestServer.java
index dd0c5cef9c..11b005c38e 100644
--- a/systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/http/auth/DigestServer.java
+++ b/systests/transport-hc5/src/test/java/org/apache/cxf/systest/hc5/http/auth/DigestServer.java
@@ -21,13 +21,13 @@ package org.apache.cxf.systest.hc5.http.auth;
import java.net.URL;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.security.LoginService;
import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.DefaultHandler;
-import org.eclipse.jetty.server.handler.HandlerCollection;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.jetty.util.resource.ResourceFactory;
public class DigestServer extends AbstractBusTestServerBase {
public static final String PORT = allocatePort(DigestServer.class);
@@ -38,7 +38,8 @@ public class DigestServer extends AbstractBusTestServerBase {
URL resource = getClass().getResource("jetty-realm.properties");
LoginService realm =
- new HashLoginService("BookStoreRealm", resource.toString());
+ new HashLoginService("BookStoreRealm",
+ ResourceFactory.of(new ContextHandler()).newResource(resource.toString()));
server.addBean(realm);
}
@@ -47,9 +48,9 @@ public class DigestServer extends AbstractBusTestServerBase {
WebAppContext webappcontext = new WebAppContext();
webappcontext.setContextPath("/digestauth");
- webappcontext.setBaseResource(Resource.newClassPathResource("/digestauth"));
+ webappcontext.setBaseResourceAsString(this.getClass().getResource("/digestauth").toString());
- HandlerCollection handlers = new HandlerCollection();
+ Handler.Collection handlers = new Handler.Sequence();
handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
server.setHandler(handlers);
diff --git a/systests/transport-jms/pom.xml b/systests/transport-jms/pom.xml
index cd3e8f33e6..a92c0572bb 100644
--- a/systests/transport-jms/pom.xml
+++ b/systests/transport-jms/pom.xml
@@ -140,12 +140,12 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-servlet</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
diff --git a/systests/transports/pom.xml b/systests/transports/pom.xml
index 11c9a0e40e..d7d4b265e5 100644
--- a/systests/transports/pom.xml
+++ b/systests/transports/pom.xml
@@ -147,12 +147,12 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-servlet</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
@@ -346,7 +346,7 @@
</dependency>
<dependency>
<groupId>org.eclipse.jetty.http2</groupId>
- <artifactId>http2-server</artifactId>
+ <artifactId>jetty-http2-server</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -356,22 +356,26 @@
</dependency>
<dependency>
<groupId>org.eclipse.jetty.http2</groupId>
- <artifactId>http2-client</artifactId>
- <version>${cxf.jetty11.version}</version>
+ <artifactId>jetty-http2-client</artifactId>
+ <version>${cxf.jetty.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-alpn-java-server</artifactId>
- <version>${cxf.jetty11.version}</version>
+ <version>${cxf.jetty.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-alpn-java-client</artifactId>
- <version>${cxf.jetty11.version}</version>
+ <version>${cxf.jetty.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-security</artifactId>
+ </dependency>
</dependencies>
<profiles>
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestAuthSupplierJettyTest.java b/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestAuthSupplierJettyTest.java
index 10dcecb878..725318db4a 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestAuthSupplierJettyTest.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestAuthSupplierJettyTest.java
@@ -30,15 +30,15 @@ import org.apache.cxf.testutil.common.AbstractClientServerTestBase;
import org.apache.cxf.testutil.common.AbstractTestServerBase;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transport.http.auth.DigestAuthSupplier;
-import org.eclipse.jetty.security.ConstraintMapping;
-import org.eclipse.jetty.security.ConstraintSecurityHandler;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
+import org.eclipse.jetty.ee10.servlet.security.ConstraintMapping;
+import org.eclipse.jetty.ee10.servlet.security.ConstraintSecurityHandler;
+import org.eclipse.jetty.security.Constraint;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.security.UserStore;
import org.eclipse.jetty.security.authentication.DigestAuthenticator;
import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.util.security.Constraint;
import org.eclipse.jetty.util.security.Credential;
import org.junit.BeforeClass;
@@ -87,13 +87,13 @@ public class DigestAuthSupplierJettyTest extends AbstractClientServerTestBase {
userStore.addUser(USER, Credential.getCredential(PWD), roles);
loginService.setUserStore(userStore);
- Constraint constraint = new Constraint();
- constraint.setName(Constraint.__DIGEST_AUTH);
- constraint.setRoles(roles);
- constraint.setAuthenticate(true);
-
+ Constraint.Builder constraint = new Constraint.Builder();
+ constraint.name("DIGEST_AUTH");
+ constraint.roles(roles);
+
+
ConstraintMapping cm = new ConstraintMapping();
- cm.setConstraint(constraint);
+ cm.setConstraint(constraint.build());
cm.setPathSpec("/*");
ConstraintSecurityHandler csh = new ConstraintSecurityHandler();
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestServer.java b/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestServer.java
index 20877997a1..3646a38e4e 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestServer.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestServer.java
@@ -18,27 +18,30 @@
*/
package org.apache.cxf.systest.http.auth;
-import java.net.URL;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.security.LoginService;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.handler.DefaultHandler;
-import org.eclipse.jetty.server.handler.HandlerCollection;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.jetty.util.resource.ResourceFactory;
+
+
+
public class DigestServer extends AbstractBusTestServerBase {
public static final String PORT = allocatePort(DigestServer.class);
private org.eclipse.jetty.server.Server server;
- private void configureServer() throws Exception {
- URL resource = getClass().getResource("jetty-realm.properties");
+ private void configureServer(WebAppContext webappcontext) throws Exception {
+
LoginService realm =
- new HashLoginService("BookStoreRealm", resource.toString());
+ new HashLoginService("BookStoreRealm", ResourceFactory.
+ of(webappcontext).
+ newClassPathResource("/org/apache/cxf/systest/http/auth/jetty-realm.properties"));
server.addBean(realm);
}
@@ -47,15 +50,11 @@ public class DigestServer extends AbstractBusTestServerBase {
WebAppContext webappcontext = new WebAppContext();
webappcontext.setContextPath("/digestauth");
- webappcontext.setBaseResource(Resource.newClassPathResource("/digestauth"));
-
- HandlerCollection handlers = new HandlerCollection();
- handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
-
- server.setHandler(handlers);
+ webappcontext.setBaseResource(ResourceFactory.of(webappcontext).newClassPathResource("/digestauth"));
+ server.setHandler(new Handler.Sequence(webappcontext, new DefaultHandler()));
try {
- configureServer();
+ configureServer(webappcontext);
server.start();
} catch (Exception e) {
throw new RuntimeException(e);
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/http2_jetty/Http2TestClient.java b/systests/transports/src/test/java/org/apache/cxf/systest/http2_jetty/Http2TestClient.java
index 9482c5dc0b..6981f7a075 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/http2_jetty/Http2TestClient.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/http2_jetty/Http2TestClient.java
@@ -135,7 +135,7 @@ public class Http2TestClient implements AutoCloseable {
final FuturePromise<Session> sessionPromise = new FuturePromise<>();
client.connect(sslContextFactory, new InetSocketAddress(uri.getHost(), uri.getPort()),
- new ServerSessionListener.Adapter(), sessionPromise);
+ new ServerSessionListener() { }, sessionPromise);
final Session session = sessionPromise.get();
final HttpFields.Mutable requestFields = HttpFields.build();
@@ -158,7 +158,7 @@ public class Http2TestClient implements AutoCloseable {
client.stop();
}
- private final class ResponseListener extends Stream.Listener.Adapter {
+ private final class ResponseListener implements Stream.Listener {
private final ClientResponse response = new ClientResponse();
private final CompletableFuture<ClientResponse> future;
@@ -166,7 +166,7 @@ public class Http2TestClient implements AutoCloseable {
this.future = f;
}
- @Override
+
public void onHeaders(Stream stream, HeadersFrame frame) {
final MetaData metaData = frame.getMetaData();
response.setProtocol(metaData.getHttpVersion());
@@ -178,28 +178,36 @@ public class Http2TestClient implements AutoCloseable {
future.complete(response);
}
}
- super.onHeaders(stream, frame);
+ stream.demand();
}
- @Override
public void onData(Stream stream, DataFrame frame, Callback callback) {
- byte[] bytes = new byte[frame.getData().remaining()];
- frame.getData().get(bytes);
+ byte[] bytes = new byte[frame.getByteBuffer().remaining()];
+ frame.getByteBuffer().get(bytes);
+ response.setBody(new String(bytes));
+ future.complete(response);
+ callback.succeeded();
+ }
+
+ public void onDataAvailable(Stream stream) {
+ Stream.Data data = stream.readData();
+ DataFrame frame = data.frame();
+ byte[] bytes = new byte[frame.getByteBuffer().remaining()];
+ frame.getByteBuffer().get(bytes);
response.setBody(new String(bytes));
future.complete(response);
- super.onData(stream, frame, callback);
+
}
- @Override
public boolean onIdleTimeout(Stream stream, Throwable x) {
future.completeExceptionally(x);
- return super.onIdleTimeout(stream, x);
+ return true;
}
- @Override
+
public void onFailure(Stream stream, int error, String reason, Throwable failure, Callback callback) {
future.completeExceptionally(new ClientErrorException(reason, error));
- super.onFailure(stream, error, reason, failure, callback);
+ callback.succeeded();
}
}
}
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java b/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
index 4c8355565e..442a8933fa 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
@@ -33,8 +33,8 @@ import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.testutil.common.TestUtil;
import org.apache.cxf.transport.http_jetty.JettyHTTPDestination;
import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
import org.eclipse.jetty.server.Handler;
-import org.eclipse.jetty.webapp.WebAppContext;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.ClassPathResource;
@@ -66,10 +66,10 @@ public class EngineLifecycleTest {
JettyHTTPServerEngine e = (JettyHTTPServerEngine) jhd.getEngine();
org.eclipse.jetty.server.Server jettyServer = e.getServer();
- for (Handler h : jettyServer.getChildHandlersByClass(WebAppContext.class)) {
+ for (Handler h : jettyServer.getDescendants(WebAppContext.class)) {
WebAppContext wac = (WebAppContext) h;
if ("/jsunit".equals(wac.getContextPath())) {
- wac.addServlet("org.eclipse.jetty.servlet.DefaultServlet", "/bloop");
+ wac.addServlet("org.eclipse.jetty.ee10.servlet.DefaultServlet", "/bloop");
break;
}
}
@@ -102,7 +102,9 @@ public class EngineLifecycleTest {
applicationContext = new GenericApplicationContext();
- System.setProperty("jetty.staticResourceURL", getClass().getPackage().getName().replace('.', '/'));
+ System.setProperty("jetty.staticResourceURL",
+ "src/test/resources/"
+ + getClass().getPackage().getName().replace('.', '/'));
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(applicationContext);
reader.loadBeanDefinitions(
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/servlet/AbstractJettyServer.java b/systests/transports/src/test/java/org/apache/cxf/systest/servlet/AbstractJettyServer.java
index 2d72777d71..1564327b85 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/servlet/AbstractJettyServer.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/servlet/AbstractJettyServer.java
@@ -20,12 +20,13 @@
package org.apache.cxf.systest.servlet;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.DefaultHandler;
-import org.eclipse.jetty.server.handler.HandlerCollection;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.jetty.util.resource.ResourceFactory;
+
import static org.junit.Assert.fail;
@@ -50,10 +51,12 @@ public abstract class AbstractJettyServer extends AbstractBusTestServerBase {
try {
final WebAppContext context = new WebAppContext();
context.setContextPath(contextPath);
- context.setBaseResource(Resource.newClassPathResource(resourcePath));
- context.setDescriptor(Resource.newClassPathResource(descriptor).getURI().toString());
+ context.setBaseResource(ResourceFactory.of(new ContextHandler()).
+ newClassPathResource(resourcePath));
+ context.setDescriptor(ResourceFactory.of(new ContextHandler()).
+ newClassPathResource(descriptor).getURI().toString());
- HandlerCollection handlers = new HandlerCollection();
+ Handler.Collection handlers = new Handler.Sequence();
handlers.setHandlers(new Handler[] {context, new DefaultHandler()});
server.setHandler(handlers);
server.start();
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java b/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java
index 043dc5a4b7..38819882aa 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java
@@ -25,10 +25,11 @@ import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.apache.hello_world_soap_http.GreeterImpl;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
+
public class NoSpringServletServer extends AbstractBusTestServerBase {
public static final String PORT = allocatePort(NoSpringServletServer.class);
@@ -44,8 +45,7 @@ public class NoSpringServletServer extends AbstractBusTestServerBase {
ContextHandlerCollection contexts = new ContextHandlerCollection();
httpServer.setHandler(contexts);
- ServletContextHandler root = new ServletContextHandler(contexts, "/",
- ServletContextHandler.SESSIONS);
+ ServletContextHandler root = new ServletContextHandler("/");
bus = BusFactory.getDefaultBus(true);
CXFServlet cxf = new CXFServlet();
cxf.setBus(bus);
@@ -53,7 +53,7 @@ public class NoSpringServletServer extends AbstractBusTestServerBase {
servlet.setName("soap");
servlet.setForcedPath("soap");
root.addServlet(servlet, "/soap/*");
-
+ contexts.addHandler(root);
httpServer.start();
setBus(bus);
BusFactory.setDefaultBus(bus);
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/servlet/resolver/ResolverTest.java b/systests/transports/src/test/java/org/apache/cxf/systest/servlet/resolver/ResolverTest.java
index 61fd428f29..4d3b756952 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/servlet/resolver/ResolverTest.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/servlet/resolver/ResolverTest.java
@@ -21,12 +21,12 @@ package org.apache.cxf.systest.servlet.resolver;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.DefaultHandler;
-import org.eclipse.jetty.server.handler.HandlerCollection;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.jetty.util.resource.ResourceFactory;
+
import org.junit.Test;
@@ -40,11 +40,8 @@ public class ResolverTest extends AbstractBusClientServerTestBase {
WebAppContext webappcontext = new WebAppContext();
webappcontext.setContextPath("/resolver");
- webappcontext.setBaseResource(Resource.newClassPathResource("/resolver"));
-
- HandlerCollection handlers = new HandlerCollection();
- handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
- server.setHandler(handlers);
+ webappcontext.setBaseResource(ResourceFactory.of(webappcontext).newClassPathResource("/resolver"));
+ server.setHandler(new Handler.Sequence(webappcontext, new DefaultHandler()));
server.start();
Throwable e = webappcontext.getUnavailableException();
if (e != null) {
diff --git a/systests/transports/src/test/resources/org/apache/cxf/systest/http_jetty/jetty-engine.xml b/systests/transports/src/test/resources/org/apache/cxf/systest/http_jetty/jetty-engine.xml
index aba913f62b..79cd32f35a 100644
--- a/systests/transports/src/test/resources/org/apache/cxf/systest/http_jetty/jetty-engine.xml
+++ b/systests/transports/src/test/resources/org/apache/cxf/systest/http_jetty/jetty-engine.xml
@@ -29,24 +29,18 @@
<httpj:engine-factory bus="cxf">
<httpj:engine port="${testutil.ports.EngineLifecycleTest.2}">
<httpj:handlers>
- <bean class="org.eclipse.jetty.webapp.WebAppContext">
+ <bean class="org.eclipse.jetty.ee10.webapp.WebAppContext">
<constructor-arg value="."/>
<constructor-arg value="/jsunit"/>
</bean>
<bean class="org.eclipse.jetty.server.handler.ContextHandler">
<property name="contextPath" value="/"/>
+ <property name="baseResourceAsString" value="${jetty.staticResourceURL}"/>
<property name="handler">
- <bean class="org.eclipse.jetty.server.handler.ResourceHandler">
- <property name="baseResource">
- <bean class="org.eclipse.jetty.util.resource.Resource" factory-method="newClassPathResource">
- <constructor-arg value="${jetty.staticResourceURL}"/>
- </bean>
- </property>
- </bean>
+ <bean class="org.eclipse.jetty.server.handler.ResourceHandler"/>
</property>
</bean>
- <bean class="org.eclipse.jetty.server.handler.DefaultHandler"/>
</httpj:handlers>
</httpj:engine>
</httpj:engine-factory>
-</beans>
\ No newline at end of file
+</beans>
diff --git a/systests/transports/src/test/resources/org/apache/cxf/systest/http_jetty/jettyBasicAuthServer.xml b/systests/transports/src/test/resources/org/apache/cxf/systest/http_jetty/jettyBasicAuthServer.xml
index 5ca3e391fd..cf372c12b1 100644
--- a/systests/transports/src/test/resources/org/apache/cxf/systest/http_jetty/jettyBasicAuthServer.xml
+++ b/systests/transports/src/test/resources/org/apache/cxf/systest/http_jetty/jettyBasicAuthServer.xml
@@ -25,8 +25,8 @@
<httpj:engine-factory bus="cxf">
<httpj:engine port="${testutil.ports.JettyBasicAuthServer}">
<httpj:handlers>
- <bean class="org.eclipse.jetty.security.ConstraintSecurityHandler">
- <property name="authMethod" value="BASIC"/>
+ <bean class="org.eclipse.jetty.ee10.servlet.security.ConstraintSecurityHandler">
+ <property name="authenticationType" value="BASIC"/>
<property name="loginService" ref="securityLoginService"/>
<property name="constraintMappings">
<list>
@@ -37,17 +37,53 @@
</httpj:handlers>
</httpj:engine>
</httpj:engine-factory>
+
+ <bean id="resourceFactory" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+ <property name="targetClass" value="org.eclipse.jetty.util.resource.ResourceFactory" />
+ <property name="targetMethod" value="root" />
+ </bean>
+
+ <bean id="config" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+ <property name="targetObject" ref="resourceFactory" />
+ <property name="targetMethod" value="newClassPathResource"/>
+ <property name="arguments">
+ <list>
+ <value>/org/apache/cxf/systest/http_jetty/jetty-realm.properties</value>
+ </list>
+ </property>
+ </bean>
+
<bean id="securityLoginService" class="org.eclipse.jetty.security.HashLoginService">
<property name="name" value="WSRealm"/>
- <property name="config" value="src/test/resources/org/apache/cxf/systest/http_jetty/jetty-realm.properties"/>
+ <property name="config" ref="config"/>
+ </bean>
+ <bean id="securityConstraint.builder" class="org.eclipse.jetty.security.Constraint.Builder"/>
+ <bean id="securityConstraint.builder2" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+ <property name="targetObject" ref="securityConstraint.builder" />
+ <property name="targetMethod" value="name"/>
+ <property name="arguments">
+ <list>
+ <value>BASIC</value>
+ </list>
+ </property>
+ </bean>
+ <bean id="securityConstraint.builder3" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+ <property name="targetObject" ref="securityConstraint.builder2" />
+ <property name="targetMethod" value="roles"/>
+ <property name="arguments">
+ <list>
+ <value>admin</value>
+ </list>
+ </property>
</bean>
- <bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint">
- <property name="name" value="BASIC"/>
- <property name="roles" value="admin"/>
- <property name="authenticate" value="true"/>
+
+
+ <bean id="securityConstraint" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+ <property name="targetObject" ref="securityConstraint.builder3" />
+ <property name="targetMethod" value="build"/>
</bean>
- <bean id="securityConstraintMapping" class="org.eclipse.jetty.security.ConstraintMapping">
+ <bean id="securityConstraintMapping" class="org.eclipse.jetty.ee10.servlet.security.ConstraintMapping">
<property name="constraint" ref="securityConstraint"/>
<property name="pathSpec" value="/*"/>
</bean>
-</beans>
\ No newline at end of file
+</beans>
diff --git a/systests/transports/src/test/resources/org/apache/cxf/systest/http_jetty/jettyDigestServer.xml b/systests/transports/src/test/resources/org/apache/cxf/systest/http_jetty/jettyDigestServer.xml
index 573d8ac0c2..3063044596 100644
--- a/systests/transports/src/test/resources/org/apache/cxf/systest/http_jetty/jettyDigestServer.xml
+++ b/systests/transports/src/test/resources/org/apache/cxf/systest/http_jetty/jettyDigestServer.xml
@@ -25,9 +25,9 @@
<httpj:engine-factory bus="cxf">
<httpj:engine port="${testutil.ports.JettyDigestAuthTest}">
<httpj:handlers>
- <bean class="org.eclipse.jetty.security.ConstraintSecurityHandler">
+ <bean class="org.eclipse.jetty.ee10.servlet.security.ConstraintSecurityHandler">
+ <property name="authenticationType" value="DIGEST"/>
<property name="loginService" ref="securityLoginService"/>
- <property name="authMethod" value="DIGEST"/>
<property name="constraintMappings">
<list>
<ref bean="securityConstraintMapping"/>
@@ -37,17 +37,53 @@
</httpj:handlers>
</httpj:engine>
</httpj:engine-factory>
+ <bean id="resourceFactory" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+ <property name="targetClass" value="org.eclipse.jetty.util.resource.ResourceFactory" />
+ <property name="targetMethod" value="root" />
+ </bean>
+
+ <bean id="config" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+ <property name="targetObject" ref="resourceFactory" />
+ <property name="targetMethod" value="newClassPathResource"/>
+ <property name="arguments">
+ <list>
+ <value>/org/apache/cxf/systest/http_jetty/jetty-realm.properties</value>
+ </list>
+ </property>
+ </bean>
+
<bean id="securityLoginService" class="org.eclipse.jetty.security.HashLoginService">
<property name="name" value="WSRealm"/>
- <property name="config" value="src/test/resources/org/apache/cxf/systest/http_jetty/jetty-realm.properties"/>
+ <property name="config" ref="config"/>
+ </bean>
+ <bean id="securityConstraint.builder" class="org.eclipse.jetty.security.Constraint.Builder"/>
+ <bean id="securityConstraint.builder2" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+ <property name="targetObject" ref="securityConstraint.builder" />
+ <property name="targetMethod" value="name"/>
+ <property name="arguments">
+ <list>
+ <value>DIGEST</value>
+ </list>
+ </property>
+ </bean>
+ <bean id="securityConstraint.builder3" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+ <property name="targetObject" ref="securityConstraint.builder2" />
+ <property name="targetMethod" value="roles"/>
+ <property name="arguments">
+ <list>
+ <value>admin</value>
+ </list>
+ </property>
</bean>
- <bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint">
- <property name="name" value="DIGEST"/>
- <property name="roles" value="admin"/>
- <property name="authenticate" value="true"/>
+
+
+ <bean id="securityConstraint" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+ <property name="targetObject" ref="securityConstraint.builder3" />
+ <property name="targetMethod" value="build"/>
</bean>
- <bean id="securityConstraintMapping" class="org.eclipse.jetty.security.ConstraintMapping">
+ <bean id="securityConstraintMapping" class="org.eclipse.jetty.ee10.servlet.security.ConstraintMapping">
<property name="constraint" ref="securityConstraint"/>
<property name="pathSpec" value="/*"/>
</bean>
-</beans>
\ No newline at end of file
+
+</beans>
diff --git a/systests/ws-specs/pom.xml b/systests/ws-specs/pom.xml
index c63349112f..2bfe34470c 100644
--- a/systests/ws-specs/pom.xml
+++ b/systests/ws-specs/pom.xml
@@ -200,8 +200,8 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <groupId>org.eclipse.jetty.ee10</groupId>
+ <artifactId>jetty-ee10-webapp</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/AbstractSpringServer.java b/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/AbstractSpringServer.java
index 6b276c3554..3d75775a6f 100644
--- a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/AbstractSpringServer.java
+++ b/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/AbstractSpringServer.java
@@ -20,10 +20,10 @@
package org.apache.cxf.systest.ws;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
+import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.handler.DefaultHandler;
-import org.eclipse.jetty.server.handler.HandlerCollection;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.jetty.util.resource.ResourceFactory;
public abstract class AbstractSpringServer extends AbstractBusTestServerBase {
@@ -47,9 +47,9 @@ public abstract class AbstractSpringServer extends AbstractBusTestServerBase {
WebAppContext webappcontext = new WebAppContext();
webappcontext.setContextPath(contextPath);
- webappcontext.setBaseResource(Resource.newClassPathResource(resourcePath));
+ webappcontext.setBaseResource(ResourceFactory.of(webappcontext).newClassPathResource(resourcePath));
- server.setHandler(new HandlerCollection(webappcontext, new DefaultHandler()));
+ server.setHandler(new Handler.Sequence(webappcontext, new DefaultHandler()));
try {
configureServer(server);
diff --git a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/FaultToEndpointServer.java b/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/FaultToEndpointServer.java
index efebc690bc..b010ecd944 100644
--- a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/FaultToEndpointServer.java
+++ b/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/FaultToEndpointServer.java
@@ -19,13 +19,11 @@
package org.apache.cxf.systest.ws.addr_feature;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
+import java.nio.ByteBuffer;
import java.util.concurrent.Future;
import jakarta.jws.WebService;
import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.xml.ws.AsyncHandler;
import jakarta.xml.ws.Endpoint;
@@ -46,8 +44,9 @@ import org.apache.hello_world_soap_http.types.GreetMeSometimeResponse;
import org.apache.hello_world_soap_http.types.SayHiResponse;
import org.apache.hello_world_soap_http.types.TestDocLitFaultResponse;
import org.apache.hello_world_soap_http.types.TestNillableResponse;
-import org.eclipse.jetty.server.Request;
-import org.eclipse.jetty.server.handler.AbstractHandler;
+import org.eclipse.jetty.http.HttpHeader;
+import org.eclipse.jetty.server.Handler;
+
public class FaultToEndpointServer extends AbstractBusTestServerBase {
static final String FAULT_PORT = allocatePort(FaultToEndpointServer.class);
@@ -58,7 +57,7 @@ public class FaultToEndpointServer extends AbstractBusTestServerBase {
private org.eclipse.jetty.server.Server faultToserver;
protected void run() {
faultToserver = new org.eclipse.jetty.server.Server(Integer.parseInt(FAULT_PORT));
- faultToserver.setHandler(new HelloHandler());
+ faultToserver.setDefaultHandler(new HelloHandler());
try {
faultToserver.start();
} catch (Exception e) {
@@ -109,31 +108,32 @@ public class FaultToEndpointServer extends AbstractBusTestServerBase {
- public static class HelloHandler extends AbstractHandler {
+ public static class HelloHandler extends Handler.Abstract {
private static String faultRequestPath;
- public void handle(String target, Request baseRequest, HttpServletRequest request,
- HttpServletResponse response) throws IOException, ServletException {
- response.setContentType("text/html;charset=utf-8");
+ public boolean handle(org.eclipse.jetty.server.Request req,
+ org.eclipse.jetty.server.Response resp,
+ org.eclipse.jetty.util.Callback callback) throws IOException, ServletException {
+
+ resp.getHeaders().put(HttpHeader.CONTENT_TYPE, "text/html;charset=utf-8");
//System.out.println("In handler: " + request.getContentLength());
byte[] bytes = new byte[1024];
- InputStream in = request.getInputStream();
- while (in.read(bytes) > -1) {
+
+ while (!req.consumeAvailable()) {
//nothing
}
- faultRequestPath = request.getPathInfo();
+ faultRequestPath = req.getContext().getPathInContext(req.getHttpURI().getCanonicalPath());
if ("/faultTo".equals(faultRequestPath)) {
- response.setStatus(HttpServletResponse.SC_ACCEPTED);
+ resp.setStatus(HttpServletResponse.SC_ACCEPTED);
} else {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
- PrintWriter writer = response.getWriter();
- writer.println("Received");
- writer.close();
- baseRequest.setHandled(true);
+ ByteBuffer buffer = ByteBuffer.wrap("Received".getBytes());
+ resp.write(true, buffer, callback);
+ return true;
}
public static String getFaultRequestPath() {
diff --git a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAFaultToClientServerTest.java b/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAFaultToClientServerTest.java
index b937092ca2..cb373c4a0d 100644
--- a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAFaultToClientServerTest.java
+++ b/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAFaultToClientServerTest.java
@@ -58,6 +58,7 @@ public class WSAFaultToClientServerTest extends AbstractWSATestBase {
assertTrue("FaultTo server did not launch correctly", launchServer(FaultToEndpointServer.class, true));
}
+
@Test
public void testOneWayFaultTo() throws Exception {
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
diff --git a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
index 8d66c4ae46..9e968bbc5c 100644
--- a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
+++ b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
@@ -532,7 +532,7 @@ public class CodeGenBugTest extends AbstractCodeGenTest {
Server server = new Server(0);
try {
ResourceHandler reshandler = new ResourceHandler();
- reshandler.setResourceBase(getLocation("/wsdl2java_wsdl/"));
+ reshandler.setBaseResourceAsString(getLocation("/wsdl2java_wsdl/"));
// this is the only handler we're supposed to need, so we don't need to
// 'add' it.
server.setHandler(reshandler);