diff --git a/VERSION.txt b/VERSION.txt index 4aba2b75352..6e5594947fd 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,4 +1,13 @@ -jetty-9.4.34-SNAPSHOT +jetty-9.4.35-SNAPSHOT + +jetty-9.4.34.v20201102 - 02 November 2020 + + 5320 Using WebSocketClient with jetty-websocket-httpclient.xml in a Jetty + web application causes ClassCastException + + 5488 jetty-dir.css not found when using JPMS + + 5498 ServletHolder lifecycle correctness + + 5521 ResourceCollection NPE in list() + + 5535 Support regex in SslContextFactory include/exclude of protocols + + 5555 NPE for servlet with no mapping jetty-9.4.33.v20201020 - 20 October 2020 + 5022 Cleanup ServletHandler, specifically with respect to making filter @@ -15,7 +24,7 @@ jetty-9.4.33.v20201020 - 20 October 2020 + 5451 Improve Working Directory creation + 5454 Request error context is not reset + 5475 Update to spifly 1.3.2 and asm 9 - + 5480 NPE from WebInfConfiguration.deconfigure during WebAppContext shutdown + + 5480 NPE from WebInfConfiguration.deconfigure during WebAppContext shutdown jetty-9.4.32.v20200930 - 30 September 2020 + 2796 HTTP/2 max local stream count exceeded when request fails diff --git a/aggregates/jetty-all-compact3/pom.xml b/aggregates/jetty-all-compact3/pom.xml index a8bb9cc1025..8f7a3e9d725 100644 --- a/aggregates/jetty-all-compact3/pom.xml +++ b/aggregates/jetty-all-compact3/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/aggregates/jetty-all/pom.xml b/aggregates/jetty-all/pom.xml index c43ae8961a3..dc1c09c011b 100644 --- a/aggregates/jetty-all/pom.xml +++ b/aggregates/jetty-all/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/apache-jsp/pom.xml b/apache-jsp/pom.xml index 7267eabffc7..b96ca00c47c 100644 --- a/apache-jsp/pom.xml +++ b/apache-jsp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 apache-jsp diff --git a/apache-jstl/pom.xml b/apache-jstl/pom.xml index dcaaa3e2456..8aea2af5252 100644 --- a/apache-jstl/pom.xml +++ b/apache-jstl/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 apache-jstl diff --git a/build-resources/pom.xml b/build-resources/pom.xml index a029c7b7d24..c310358282b 100644 --- a/build-resources/pom.xml +++ b/build-resources/pom.xml @@ -2,7 +2,7 @@ 4.0.0 org.eclipse.jetty build-resources - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT jar Jetty :: Build Resources diff --git a/examples/async-rest/async-rest-jar/pom.xml b/examples/async-rest/async-rest-jar/pom.xml index ed8d7115d62..bf36e23152d 100644 --- a/examples/async-rest/async-rest-jar/pom.xml +++ b/examples/async-rest/async-rest-jar/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty example-async-rest - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/examples/async-rest/async-rest-webapp/pom.xml b/examples/async-rest/async-rest-webapp/pom.xml index 66aaef0c0c9..d23c5ec61a5 100644 --- a/examples/async-rest/async-rest-webapp/pom.xml +++ b/examples/async-rest/async-rest-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty example-async-rest - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/examples/async-rest/pom.xml b/examples/async-rest/pom.xml index 6e493913177..f7851b7e1a3 100644 --- a/examples/async-rest/pom.xml +++ b/examples/async-rest/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.examples examples-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/examples/embedded/pom.xml b/examples/embedded/pom.xml index 73c32602035..f0040539f81 100644 --- a/examples/embedded/pom.xml +++ b/examples/embedded/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.examples examples-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT ../pom.xml 4.0.0 diff --git a/examples/pom.xml b/examples/pom.xml index 70fb91b7f62..20b01606aea 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-alpn/jetty-alpn-client/pom.xml b/jetty-alpn/jetty-alpn-client/pom.xml index 49c5de24037..fe779ebee0a 100644 --- a/jetty-alpn/jetty-alpn-client/pom.xml +++ b/jetty-alpn/jetty-alpn-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-alpn-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-alpn-client diff --git a/jetty-alpn/jetty-alpn-conscrypt-client/pom.xml b/jetty-alpn/jetty-alpn-conscrypt-client/pom.xml index 11709632c58..86edf9a28a8 100644 --- a/jetty-alpn/jetty-alpn-conscrypt-client/pom.xml +++ b/jetty-alpn/jetty-alpn-conscrypt-client/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-alpn-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-alpn/jetty-alpn-conscrypt-server/pom.xml b/jetty-alpn/jetty-alpn-conscrypt-server/pom.xml index d3db84f311e..40b0ba47688 100644 --- a/jetty-alpn/jetty-alpn-conscrypt-server/pom.xml +++ b/jetty-alpn/jetty-alpn-conscrypt-server/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-alpn-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-alpn/jetty-alpn-java-client/pom.xml b/jetty-alpn/jetty-alpn-java-client/pom.xml index d58eb8c1a4d..4af11b0c1d7 100644 --- a/jetty-alpn/jetty-alpn-java-client/pom.xml +++ b/jetty-alpn/jetty-alpn-java-client/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-alpn-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-alpn/jetty-alpn-java-server/pom.xml b/jetty-alpn/jetty-alpn-java-server/pom.xml index c65fba0db72..c588a705e9d 100644 --- a/jetty-alpn/jetty-alpn-java-server/pom.xml +++ b/jetty-alpn/jetty-alpn-java-server/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-alpn-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-alpn/jetty-alpn-openjdk8-client/pom.xml b/jetty-alpn/jetty-alpn-openjdk8-client/pom.xml index 03a0d465d52..36e5fc83061 100644 --- a/jetty-alpn/jetty-alpn-openjdk8-client/pom.xml +++ b/jetty-alpn/jetty-alpn-openjdk8-client/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-alpn-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-alpn/jetty-alpn-openjdk8-server/pom.xml b/jetty-alpn/jetty-alpn-openjdk8-server/pom.xml index b3970e41928..e19fcd35f96 100644 --- a/jetty-alpn/jetty-alpn-openjdk8-server/pom.xml +++ b/jetty-alpn/jetty-alpn-openjdk8-server/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-alpn-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-alpn/jetty-alpn-server/pom.xml b/jetty-alpn/jetty-alpn-server/pom.xml index 124ad095a56..ea6d3cc3126 100644 --- a/jetty-alpn/jetty-alpn-server/pom.xml +++ b/jetty-alpn/jetty-alpn-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-alpn-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-alpn-server diff --git a/jetty-alpn/pom.xml b/jetty-alpn/pom.xml index 1b60f1edd6d..45eaef69070 100644 --- a/jetty-alpn/pom.xml +++ b/jetty-alpn/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-alpn-parent diff --git a/jetty-annotations/pom.xml b/jetty-annotations/pom.xml index 74bcfa9051c..d0d335f9fc5 100644 --- a/jetty-annotations/pom.xml +++ b/jetty-annotations/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-annotations diff --git a/jetty-ant/pom.xml b/jetty-ant/pom.xml index 3231c89d015..210099d1ef1 100644 --- a/jetty-ant/pom.xml +++ b/jetty-ant/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-ant diff --git a/jetty-bom/pom.xml b/jetty-bom/pom.xml index dd79bb0eeed..1715e8f3fd2 100644 --- a/jetty-bom/pom.xml +++ b/jetty-bom/pom.xml @@ -9,7 +9,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT @@ -53,336 +53,336 @@ org.eclipse.jetty apache-jsp - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty apache-jstl - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-alpn-client - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-alpn-java-client - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-alpn-java-server - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-alpn-openjdk8-client - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-alpn-openjdk8-server - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-alpn-conscrypt-client - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-alpn-conscrypt-server - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-alpn-server - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-annotations - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-ant - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-client - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-continuation - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-deploy - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-distribution - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT zip org.eclipse.jetty jetty-distribution - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT tar.gz org.eclipse.jetty.fcgi fcgi-client - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.fcgi fcgi-server - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.gcloud jetty-gcloud-session-manager - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-home - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT zip org.eclipse.jetty jetty-home - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT tar.gz org.eclipse.jetty jetty-http - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.http2 http2-client - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.http2 http2-common - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.http2 http2-hpack - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.http2 http2-http-client-transport - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.http2 http2-server - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-http-spi - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty infinispan-common - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty infinispan-remote-query - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty infinispan-embedded-query - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-hazelcast - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-io - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-jaas - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-jaspi - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-jmx - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-jndi - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.memcached jetty-memcached-sessions - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-nosql - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.osgi jetty-osgi-boot - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.osgi jetty-osgi-boot-jsp - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.osgi jetty-osgi-boot-warurl - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.osgi jetty-httpservice - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-plus - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-proxy - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-quickstart - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-rewrite - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-security - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-openid - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-server - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-servlet - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-servlets - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-spring - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-unixsocket - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-util - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-util-ajax - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-webapp - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.websocket javax-websocket-client-impl - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.websocket javax-websocket-server-impl - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.websocket websocket-api - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.websocket websocket-client - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.websocket websocket-common - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.websocket websocket-server - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty.websocket websocket-servlet - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT org.eclipse.jetty jetty-xml - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT diff --git a/jetty-cdi/pom.xml b/jetty-cdi/pom.xml index 35f2f4078ef..9cd215d9bda 100644 --- a/jetty-cdi/pom.xml +++ b/jetty-cdi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 org.eclipse.jetty diff --git a/jetty-client/pom.xml b/jetty-client/pom.xml index 6e190e8e79b..e11a6e2c6b2 100644 --- a/jetty-client/pom.xml +++ b/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-continuation/pom.xml b/jetty-continuation/pom.xml index 7e502b143b3..f004890a149 100644 --- a/jetty-continuation/pom.xml +++ b/jetty-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-continuation diff --git a/jetty-deploy/pom.xml b/jetty-deploy/pom.xml index 60a6d83462c..42defc19f98 100644 --- a/jetty-deploy/pom.xml +++ b/jetty-deploy/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-deploy diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index eedfcd7a258..ba7e84eeec4 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-distribution @@ -264,11 +264,11 @@ run - + - + @@ -278,9 +278,9 @@ run - + - + @@ -290,9 +290,9 @@ run - + - + diff --git a/jetty-documentation/pom.xml b/jetty-documentation/pom.xml index 6ef6042d217..69af45cad11 100644 --- a/jetty-documentation/pom.xml +++ b/jetty-documentation/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT jetty-documentation Jetty :: Documentation diff --git a/jetty-fcgi/fcgi-client/pom.xml b/jetty-fcgi/fcgi-client/pom.xml index 943dd6f8aaa..98e02b7284b 100644 --- a/jetty-fcgi/fcgi-client/pom.xml +++ b/jetty-fcgi/fcgi-client/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.fcgi fcgi-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-fcgi/fcgi-server/pom.xml b/jetty-fcgi/fcgi-server/pom.xml index ad845f991d4..ee9dfc22827 100644 --- a/jetty-fcgi/fcgi-server/pom.xml +++ b/jetty-fcgi/fcgi-server/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.fcgi fcgi-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-fcgi/pom.xml b/jetty-fcgi/pom.xml index a02eba73d9b..73b504ff749 100644 --- a/jetty-fcgi/pom.xml +++ b/jetty-fcgi/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-gcloud/jetty-gcloud-session-manager/pom.xml b/jetty-gcloud/jetty-gcloud-session-manager/pom.xml index 021225cd5b3..e1107fe8390 100644 --- a/jetty-gcloud/jetty-gcloud-session-manager/pom.xml +++ b/jetty-gcloud/jetty-gcloud-session-manager/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.gcloud gcloud-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 @@ -113,10 +113,10 @@ run - + - + @@ -126,12 +126,12 @@ run - + - + diff --git a/jetty-gcloud/pom.xml b/jetty-gcloud/pom.xml index 238eb8edca7..fb45d489a03 100644 --- a/jetty-gcloud/pom.xml +++ b/jetty-gcloud/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-hazelcast/pom.xml b/jetty-hazelcast/pom.xml index 44714c95c33..038e94f23d6 100644 --- a/jetty-hazelcast/pom.xml +++ b/jetty-hazelcast/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-home/pom.xml b/jetty-home/pom.xml index dc9b3940b63..50e4cc18380 100644 --- a/jetty-home/pom.xml +++ b/jetty-home/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-home @@ -488,9 +488,9 @@ run - + - + diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml index cedb5026ffe..abf2a2bf306 100644 --- a/jetty-http-spi/pom.xml +++ b/jetty-http-spi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-http-spi diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml index 7213a20b658..870ac2e6a38 100644 --- a/jetty-http/pom.xml +++ b/jetty-http/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-http diff --git a/jetty-http2/http2-alpn-tests/pom.xml b/jetty-http2/http2-alpn-tests/pom.xml index 3abef984e36..d56dae3c83f 100644 --- a/jetty-http2/http2-alpn-tests/pom.xml +++ b/jetty-http2/http2-alpn-tests/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.http2 http2-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-http2/http2-client/pom.xml b/jetty-http2/http2-client/pom.xml index f9a61861d3c..56d7ef0fe9d 100644 --- a/jetty-http2/http2-client/pom.xml +++ b/jetty-http2/http2-client/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.http2 http2-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-http2/http2-common/pom.xml b/jetty-http2/http2-common/pom.xml index bca19a00272..96e5cd39173 100644 --- a/jetty-http2/http2-common/pom.xml +++ b/jetty-http2/http2-common/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.http2 http2-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-http2/http2-hpack/pom.xml b/jetty-http2/http2-hpack/pom.xml index c9e535b5753..c53a31b8e8a 100644 --- a/jetty-http2/http2-hpack/pom.xml +++ b/jetty-http2/http2-hpack/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.http2 http2-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-http2/http2-http-client-transport/pom.xml b/jetty-http2/http2-http-client-transport/pom.xml index 7a115afa2e0..490cf39557a 100644 --- a/jetty-http2/http2-http-client-transport/pom.xml +++ b/jetty-http2/http2-http-client-transport/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.http2 http2-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-http2/http2-server/pom.xml b/jetty-http2/http2-server/pom.xml index 4dd62f2dcd0..3d5f9df12d1 100644 --- a/jetty-http2/http2-server/pom.xml +++ b/jetty-http2/http2-server/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.http2 http2-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-http2/pom.xml b/jetty-http2/pom.xml index bfd9743d5d3..f62f8b34043 100644 --- a/jetty-http2/pom.xml +++ b/jetty-http2/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-infinispan/infinispan-common/pom.xml b/jetty-infinispan/infinispan-common/pom.xml index 5abc71fead1..f214e7ba692 100644 --- a/jetty-infinispan/infinispan-common/pom.xml +++ b/jetty-infinispan/infinispan-common/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty infinispan-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 infinispan-common @@ -43,7 +43,7 @@ org.infinispan.protostream protostream - 4.2.2.Final + ${infinispan.protostream.version} true provided diff --git a/jetty-infinispan/infinispan-embedded-query/pom.xml b/jetty-infinispan/infinispan-embedded-query/pom.xml index 569b258e358..240b7c54466 100644 --- a/jetty-infinispan/infinispan-embedded-query/pom.xml +++ b/jetty-infinispan/infinispan-embedded-query/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty infinispan-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 infinispan-embedded-query @@ -45,10 +45,10 @@ run - + - + @@ -58,12 +58,12 @@ run - + - + diff --git a/jetty-infinispan/infinispan-embedded/pom.xml b/jetty-infinispan/infinispan-embedded/pom.xml index b33669b6d28..037624b4f5e 100644 --- a/jetty-infinispan/infinispan-embedded/pom.xml +++ b/jetty-infinispan/infinispan-embedded/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty infinispan-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 infinispan-embedded @@ -46,10 +46,10 @@ run - + - + @@ -59,12 +59,12 @@ run - + - + diff --git a/jetty-infinispan/infinispan-remote-query/pom.xml b/jetty-infinispan/infinispan-remote-query/pom.xml index 8c76d5cb9af..c8d44081e9f 100644 --- a/jetty-infinispan/infinispan-remote-query/pom.xml +++ b/jetty-infinispan/infinispan-remote-query/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty infinispan-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 infinispan-remote-query @@ -45,11 +45,11 @@ run - + - + @@ -59,12 +59,12 @@ run - + - + diff --git a/jetty-infinispan/infinispan-remote/pom.xml b/jetty-infinispan/infinispan-remote/pom.xml index 5f64be1d368..853d00bcb93 100644 --- a/jetty-infinispan/infinispan-remote/pom.xml +++ b/jetty-infinispan/infinispan-remote/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty infinispan-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 infinispan-remote @@ -46,11 +46,11 @@ run - + - + @@ -60,12 +60,12 @@ run - + - + @@ -111,7 +111,7 @@ org.infinispan.protostream protostream - 4.2.2.Final + ${infinispan.protostream.version} provided diff --git a/jetty-infinispan/pom.xml b/jetty-infinispan/pom.xml index d70f4798797..c9998fb72a0 100644 --- a/jetty-infinispan/pom.xml +++ b/jetty-infinispan/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml index 05c3b919b94..24fc208acf0 100644 --- a/jetty-io/pom.xml +++ b/jetty-io/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-io diff --git a/jetty-jaas/pom.xml b/jetty-jaas/pom.xml index bc47adbe2c3..d1e861398dd 100644 --- a/jetty-jaas/pom.xml +++ b/jetty-jaas/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-jaas diff --git a/jetty-jaspi/pom.xml b/jetty-jaspi/pom.xml index dee2fa03168..668945447b8 100644 --- a/jetty-jaspi/pom.xml +++ b/jetty-jaspi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-jmh/pom.xml b/jetty-jmh/pom.xml index 1d5eaf806b7..1daab5d6041 100644 --- a/jetty-jmh/pom.xml +++ b/jetty-jmh/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-jmx/pom.xml b/jetty-jmx/pom.xml index 15365c97c99..a2f891e0395 100644 --- a/jetty-jmx/pom.xml +++ b/jetty-jmx/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-jmx diff --git a/jetty-jndi/pom.xml b/jetty-jndi/pom.xml index 574730befaa..b47193e0a98 100644 --- a/jetty-jndi/pom.xml +++ b/jetty-jndi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-jndi diff --git a/jetty-jspc-maven-plugin/pom.xml b/jetty-jspc-maven-plugin/pom.xml index 40ece734ded..a4ae84d322e 100644 --- a/jetty-jspc-maven-plugin/pom.xml +++ b/jetty-jspc-maven-plugin/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-jspc-maven-plugin diff --git a/jetty-maven-plugin/pom.xml b/jetty-maven-plugin/pom.xml index 06f970daff6..3371ba1c7a2 100644 --- a/jetty-maven-plugin/pom.xml +++ b/jetty-maven-plugin/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-maven-plugin diff --git a/jetty-memcached/jetty-memcached-sessions/pom.xml b/jetty-memcached/jetty-memcached-sessions/pom.xml index 9faf06175b9..299fcac6335 100644 --- a/jetty-memcached/jetty-memcached-sessions/pom.xml +++ b/jetty-memcached/jetty-memcached-sessions/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.memcached memcached-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-memcached/pom.xml b/jetty-memcached/pom.xml index d230706bdbd..9f3245b33fa 100644 --- a/jetty-memcached/pom.xml +++ b/jetty-memcached/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-nosql/pom.xml b/jetty-nosql/pom.xml index 75a3f2a89d2..b58500377bc 100644 --- a/jetty-nosql/pom.xml +++ b/jetty-nosql/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-nosql diff --git a/jetty-openid/pom.xml b/jetty-openid/pom.xml index 763f663ebe1..b4cef4b2805 100644 --- a/jetty-openid/pom.xml +++ b/jetty-openid/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-osgi/jetty-osgi-alpn/pom.xml b/jetty-osgi/jetty-osgi-alpn/pom.xml index a3b92eb0df4..0c62b91eaf3 100644 --- a/jetty-osgi/jetty-osgi-alpn/pom.xml +++ b/jetty-osgi/jetty-osgi-alpn/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-osgi-alpn diff --git a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml index aaf775bc804..d4b9fb145c9 100644 --- a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-osgi-boot-jsp diff --git a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml index 50ecd9a2f5f..75fe90b3f38 100644 --- a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot/pom.xml b/jetty-osgi/jetty-osgi-boot/pom.xml index 02528818ace..615065f84fa 100644 --- a/jetty-osgi/jetty-osgi-boot/pom.xml +++ b/jetty-osgi/jetty-osgi-boot/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-osgi-boot @@ -46,14 +46,14 @@ process-resources - + - + run diff --git a/jetty-osgi/jetty-osgi-httpservice/pom.xml b/jetty-osgi/jetty-osgi-httpservice/pom.xml index 40f46b8a7ba..7bdfb9bd48e 100644 --- a/jetty-osgi/jetty-osgi-httpservice/pom.xml +++ b/jetty-osgi/jetty-osgi-httpservice/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-httpservice @@ -43,11 +43,11 @@ process-resources - + - + run diff --git a/jetty-osgi/pom.xml b/jetty-osgi/pom.xml index b394d03db51..6a6b7583f0c 100644 --- a/jetty-osgi/pom.xml +++ b/jetty-osgi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-osgi/test-jetty-osgi-context/pom.xml b/jetty-osgi/test-jetty-osgi-context/pom.xml index 43b99424d73..1b1d72e09c3 100644 --- a/jetty-osgi/test-jetty-osgi-context/pom.xml +++ b/jetty-osgi/test-jetty-osgi-context/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 test-jetty-osgi-context diff --git a/jetty-osgi/test-jetty-osgi-fragment/pom.xml b/jetty-osgi/test-jetty-osgi-fragment/pom.xml index e6fa5b55b81..d3a99d082ac 100644 --- a/jetty-osgi/test-jetty-osgi-fragment/pom.xml +++ b/jetty-osgi/test-jetty-osgi-fragment/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/test-jetty-osgi-server/pom.xml b/jetty-osgi/test-jetty-osgi-server/pom.xml index 7d0de44c235..3603adba1b8 100644 --- a/jetty-osgi/test-jetty-osgi-server/pom.xml +++ b/jetty-osgi/test-jetty-osgi-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 test-jetty-osgi-server diff --git a/jetty-osgi/test-jetty-osgi-webapp-resources/pom.xml b/jetty-osgi/test-jetty-osgi-webapp-resources/pom.xml index 732e51732ea..0b073ba82ab 100644 --- a/jetty-osgi/test-jetty-osgi-webapp-resources/pom.xml +++ b/jetty-osgi/test-jetty-osgi-webapp-resources/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 test-jetty-osgi-webapp-resources diff --git a/jetty-osgi/test-jetty-osgi-webapp/pom.xml b/jetty-osgi/test-jetty-osgi-webapp/pom.xml index 3a86c3f1a3c..ab5a76e7f6c 100644 --- a/jetty-osgi/test-jetty-osgi-webapp/pom.xml +++ b/jetty-osgi/test-jetty-osgi-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml index 362b280c4ff..73fcb338ba0 100644 --- a/jetty-osgi/test-jetty-osgi/pom.xml +++ b/jetty-osgi/test-jetty-osgi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT ../pom.xml 4.0.0 @@ -71,7 +71,7 @@ org.ops4j.pax.url pax-url-wrap - 2.5.2 + 2.6.1 test @@ -88,13 +88,13 @@ org.eclipse.platform org.eclipse.osgi - 3.13.100 + 3.16.0 test org.eclipse.platform org.eclipse.osgi.services - 3.7.100 + 3.9.0 test diff --git a/jetty-plus/pom.xml b/jetty-plus/pom.xml index 74d54f4bace..a3a8275f0e1 100644 --- a/jetty-plus/pom.xml +++ b/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-plus diff --git a/jetty-proxy/pom.xml b/jetty-proxy/pom.xml index 5b5996fdacf..790f4007780 100644 --- a/jetty-proxy/pom.xml +++ b/jetty-proxy/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-proxy diff --git a/jetty-quickstart/pom.xml b/jetty-quickstart/pom.xml index 1c2a49c39c7..fda76985e3a 100644 --- a/jetty-quickstart/pom.xml +++ b/jetty-quickstart/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 org.eclipse.jetty diff --git a/jetty-rewrite/pom.xml b/jetty-rewrite/pom.xml index 56997d1ad4f..1ddf64175cb 100644 --- a/jetty-rewrite/pom.xml +++ b/jetty-rewrite/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-rewrite diff --git a/jetty-runner/pom.xml b/jetty-runner/pom.xml index abc4fa523b2..a6ac806e5ae 100644 --- a/jetty-runner/pom.xml +++ b/jetty-runner/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-runner diff --git a/jetty-security/pom.xml b/jetty-security/pom.xml index a4a619982f7..ad174fedaca 100644 --- a/jetty-security/pom.xml +++ b/jetty-security/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-security diff --git a/jetty-server/pom.xml b/jetty-server/pom.xml index 4e58f516a95..f151fa1c9ff 100644 --- a/jetty-server/pom.xml +++ b/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-server diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java index ee300048872..49ae8e06a98 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java @@ -226,12 +226,17 @@ public class ResourceHandler extends HandlerWrapper implements ResourceFactory, { if (_defaultStylesheet == null) { - _defaultStylesheet = Resource.newResource(this.getClass().getResource("/jetty-dir.css")); + _defaultStylesheet = getDefaultStylesheet(); } return _defaultStylesheet; } } + public static Resource getDefaultStylesheet() + { + return Resource.newResource(ResourceHandler.class.getResource("/jetty-dir.css")); + } + public String[] getWelcomeFiles() { return _welcomes; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java index 255b4b88eaf..f11e73ea49d 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java @@ -46,6 +46,7 @@ import javax.servlet.http.HttpSessionListener; import org.eclipse.jetty.http.BadMessageException; import org.eclipse.jetty.http.HttpCookie; +import org.eclipse.jetty.http.Syntax; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.SessionIdManager; @@ -662,7 +663,7 @@ public class SessionHandler extends ScopedHandler HttpCookie cookie = null; cookie = new HttpCookie( - _cookieConfig.getName(), + getSessionCookieName(_cookieConfig), id, _cookieConfig.getDomain(), sessionPath, @@ -1378,6 +1379,13 @@ public class SessionHandler extends ScopedHandler Session getSession(); } + public static String getSessionCookieName(SessionCookieConfig config) + { + if (config == null || config.getName() == null) + return __DefaultSessionCookie; + return config.getName(); + } + /** * CookieConfig * @@ -1466,6 +1474,10 @@ public class SessionHandler extends ScopedHandler { if (_context != null && _context.getContextHandler().isAvailable()) throw new IllegalStateException("CookieConfig cannot be set after ServletContext is started"); + if ("".equals(name)) + throw new IllegalArgumentException("Blank cookie name"); + if (name != null) + Syntax.requireValidRFC2616Token(name, "Bad Session cookie name"); _sessionCookie = name; } @@ -1645,18 +1657,18 @@ public class SessionHandler extends ScopedHandler Cookie[] cookies = request.getCookies(); if (cookies != null && cookies.length > 0) { - final String sessionCookie = getSessionCookieConfig().getName(); - for (int i = 0; i < cookies.length; i++) + final String sessionCookie = getSessionCookieName(getSessionCookieConfig()); + for (Cookie cookie : cookies) { - if (sessionCookie.equalsIgnoreCase(cookies[i].getName())) + if (sessionCookie.equalsIgnoreCase(cookie.getName())) { - String id = cookies[i].getValue(); + String id = cookie.getValue(); requestedSessionIdFromCookie = true; if (LOG.isDebugEnabled()) LOG.debug("Got Session ID {} from cookie {}", id, sessionCookie); HttpSession s = getHttpSession(id); - + if (requestedSessionId == null) { //no previous id, always accept this one diff --git a/jetty-util/src/main/resources/jetty-dir.css b/jetty-server/src/main/resources/jetty-dir.css similarity index 100% rename from jetty-util/src/main/resources/jetty-dir.css rename to jetty-server/src/main/resources/jetty-dir.css diff --git a/jetty-servlet/pom.xml b/jetty-servlet/pom.xml index 4d6dd0df7df..00abe4bbbb0 100644 --- a/jetty-servlet/pom.xml +++ b/jetty-servlet/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-servlet diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java index f242949cf74..6e661378d62 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java @@ -41,6 +41,7 @@ import org.eclipse.jetty.server.ResourceContentFactory; import org.eclipse.jetty.server.ResourceService; import org.eclipse.jetty.server.ResourceService.WelcomeFactory; import org.eclipse.jetty.server.handler.ContextHandler; +import org.eclipse.jetty.server.handler.ResourceHandler; import org.eclipse.jetty.util.URIUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -149,7 +150,6 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory, Welc private boolean _useFileMappedBuffer = false; private String _relativeResourceBase; private ServletHandler _servletHandler; - private ServletHolder _defaultHolder; public DefaultServlet(ResourceService resourceService) { @@ -223,7 +223,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory, Welc } if (_stylesheet == null) { - _stylesheet = Resource.newResource(this.getClass().getResource("/jetty-dir.css")); + _stylesheet = ResourceHandler.getDefaultStylesheet(); } } catch (Exception e) @@ -303,11 +303,6 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory, Welc _resourceService.setGzipEquivalentFileExtensions(gzipEquivalentFileExtensions); _servletHandler = _contextHandler.getChildHandlerByClass(ServletHandler.class); - for (ServletHolder h : _servletHandler.getServlets()) - { - if (h.getServletInstance() == this) - _defaultHolder = h; - } if (LOG.isDebugEnabled()) LOG.debug("resource base = " + _resourceBase); @@ -504,9 +499,9 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory, Welc return null; String welcomeServlet = null; - for (int i = 0; i < _welcomes.length; i++) + for (String s : _welcomes) { - String welcomeInContext = URIUtil.addPaths(pathInContext, _welcomes[i]); + String welcomeInContext = URIUtil.addPaths(pathInContext, s); Resource welcome = getResource(welcomeInContext); if (welcome != null && welcome.exists()) return welcomeInContext; @@ -514,9 +509,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory, Welc if ((_welcomeServlets || _welcomeExactServlets) && welcomeServlet == null) { MappedResource entry = _servletHandler.getMappedServlet(welcomeInContext); - @SuppressWarnings("ReferenceEquality") - boolean isDefaultHolder = (entry.getResource() != _defaultHolder); - if (entry != null && isDefaultHolder && + if (entry != null && entry.getResource().getServletInstance() != this && (_welcomeServlets || (_welcomeExactServlets && entry.getPathSpec().getDeclaration().equals(welcomeInContext)))) welcomeServlet = welcomeInContext; } diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/FilterHolder.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/FilterHolder.java index 6f4af7368b7..320d93eb8e6 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/FilterHolder.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/FilterHolder.java @@ -222,7 +222,8 @@ public class FilterHolder extends Holder @Override public String toString() { - return String.format("%s@%x==%s,inst=%b,async=%b", getName(), hashCode(), getClassName(), _filter != null, isAsyncSupported()); + return String.format("%s==%s@%x{inst=%b,async=%b,src=%s}", + getName(), getClassName(), hashCode(), _filter != null, isAsyncSupported(), getSource()); } public FilterRegistration.Dynamic getRegistration() diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Invoker.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Invoker.java index 09cb5ee81f3..1fe1ef1f7b4 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Invoker.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Invoker.java @@ -231,6 +231,7 @@ public class Invoker extends HttpServlet if (holder != null) { final Request baseRequest = Request.getBaseRequest(request); + holder.prepare(baseRequest, request, response); holder.handle(baseRequest, new InvokedRequest(request, included, servlet, servletPath, pathInfo), response); diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ListenerHolder.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ListenerHolder.java index 42d4c0549a8..2b1cb62c7a0 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ListenerHolder.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ListenerHolder.java @@ -126,7 +126,7 @@ public class ListenerHolder extends BaseHolder @Override public String toString() { - return super.toString() + ": " + getClassName(); + return String.format("%s@%x{src=%s}", getClassName(), hashCode(), getSource()); } /** diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java index ba41caf3285..4f29e4e76d8 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java @@ -521,21 +521,8 @@ public class ServletHandler extends ScopedHandler FilterChain chain = null; // find the servlet - if (target.startsWith("/")) - { - if (servletHolder != null && _filterMappings != null && _filterMappings.length > 0) - chain = getFilterChain(baseRequest, target, servletHolder); - } - else - { - if (servletHolder != null) - { - if (_filterMappings != null && _filterMappings.length > 0) - { - chain = getFilterChain(baseRequest, null, servletHolder); - } - } - } + if (servletHolder != null && _filterMappings != null && _filterMappings.length > 0) + chain = getFilterChain(baseRequest, target.startsWith("/") ? target : null, servletHolder); if (LOG.isDebugEnabled()) LOG.debug("chain={}", chain); @@ -593,6 +580,7 @@ public class ServletHandler extends ScopedHandler protected FilterChain getFilterChain(Request baseRequest, String pathInContext, ServletHolder servletHolder) { + Objects.requireNonNull(servletHolder); String key = pathInContext == null ? servletHolder.getName() : pathInContext; int dispatch = FilterMapping.dispatch(baseRequest.getDispatcherType()); @@ -608,16 +596,20 @@ public class ServletHandler extends ScopedHandler // The mappings lists have been reversed to make this simple and fast. FilterChain chain = null; - if (servletHolder != null && _filterNameMappings != null && !_filterNameMappings.isEmpty()) + if (_filterNameMappings != null && !_filterNameMappings.isEmpty()) { if (_wildFilterNameMappings != null) for (FilterMapping mapping : _wildFilterNameMappings) chain = newFilterChain(mapping.getFilterHolder(), chain == null ? new ChainEnd(servletHolder) : chain); - for (FilterMapping mapping : _filterNameMappings.get(servletHolder.getName())) + List nameMappings = _filterNameMappings.get(servletHolder.getName()); + if (nameMappings != null) { - if (mapping.appliesTo(dispatch)) - chain = newFilterChain(mapping.getFilterHolder(), chain == null ? new ChainEnd(servletHolder) : chain); + for (FilterMapping mapping : nameMappings) + { + if (mapping.appliesTo(dispatch)) + chain = newFilterChain(mapping.getFilterHolder(), chain == null ? new ChainEnd(servletHolder) : chain); + } } } @@ -1622,6 +1614,7 @@ public class ServletHandler extends ScopedHandler ChainEnd(ServletHolder holder) { + Objects.requireNonNull(holder); _servletHolder = holder; } diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java index 4929c16f930..f84d21c4a46 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java @@ -34,6 +34,7 @@ import java.util.Objects; import java.util.Set; import java.util.Stack; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicLong; import javax.servlet.GenericServlet; import javax.servlet.MultipartConfigElement; import javax.servlet.Servlet; @@ -80,8 +81,6 @@ public class ServletHolder extends Holder implements UserIdentity.Scope private Map _roleMap; private String _forcedPath; private String _runAsRole; - private RunAsToken _runAsToken; - private IdentityService _identityService; private ServletRegistration.Dynamic _registration; private JspContainer _jspContainer; @@ -394,12 +393,6 @@ public class ServletHolder extends Holder implements UserIdentity.Scope checkInitOnStartup(); _config = new Config(); - - synchronized (this) - { - if (getHeldClass() != null && javax.servlet.SingleThreadModel.class.isAssignableFrom(getHeldClass())) - _servlet = new SingleThreadedWrapper(); - } } @Override @@ -447,13 +440,22 @@ public class ServletHolder extends Holder implements UserIdentity.Scope Servlet servlet = (Servlet)o; - // need to use the unwrapped servlet because lifecycle callbacks such as + // call any predestroy callbacks + predestroyServlet(servlet); + + // Call the servlet destroy + servlet.destroy(); + } + + private void predestroyServlet(Servlet servlet) + { + // TODO We should only predestroy instnaces that we created + // TODO But this breaks tests in jetty-9, so review behaviour in jetty-10 + + // Need to use the unwrapped servlet because lifecycle callbacks such as // postconstruct and predestroy are based off the classname and the wrapper // classes are unknown outside the ServletHolder getServletHandler().destroyServlet(unwrap(servlet)); - - // destroy the wrapped servlet, in case there is special behaviour - servlet.destroy(); } /** @@ -465,16 +467,20 @@ public class ServletHolder extends Holder implements UserIdentity.Scope public Servlet getServlet() throws ServletException { - synchronized (this) + Servlet servlet = _servlet; + if (servlet == null) { - if (_servlet == null && isRunning()) + synchronized (this) { - if (getHeldClass() != null) - initServlet(); + if (_servlet == null && isRunning()) + { + if (getHeldClass() != null) + initServlet(); + } + servlet = _servlet; } } - - return _servlet; + return servlet; } /** @@ -528,7 +534,16 @@ public class ServletHolder extends Holder implements UserIdentity.Scope { synchronized (this) { - _servlet = new UnavailableServlet(e, _servlet); + if (_servlet instanceof UnavailableServlet) + { + Throwable cause = ((UnavailableServlet)_servlet).getUnavailableException(); + if (cause != e) + cause.addSuppressed(e); + } + else + { + _servlet = new UnavailableServlet(e, _servlet); + } return _servlet; } } @@ -554,36 +569,41 @@ public class ServletHolder extends Holder implements UserIdentity.Scope } } - private synchronized void initServlet() + private void initServlet() throws ServletException { + // must be called with lock held and _servlet==null + if (_servlet != null) + throw new IllegalStateException("Servlet already initialised: " + _servlet); + + Servlet servlet = null; try { - if (_servlet == null) - _servlet = getInstance(); - if (_servlet == null) - _servlet = newInstance(); + servlet = getInstance(); + if (servlet == null) + servlet = newInstance(); + if (servlet instanceof javax.servlet.SingleThreadModel) + { + predestroyServlet(servlet); + servlet = new SingleThreadedWrapper(); + } + if (_config == null) _config = new Config(); //check run-as rolename and convert to token from IdentityService - if (_runAsRole == null) + if (_runAsRole != null) { - _identityService = null; - _runAsToken = null; - } - else - { - _identityService = getServletHandler().getIdentityService(); - if (_identityService != null) + IdentityService identityService = getServletHandler().getIdentityService(); + if (identityService != null) { - _runAsToken = _identityService.newRunAsToken(_runAsRole); - _servlet = new RunAs(_servlet, _identityService, _runAsToken); + RunAsToken runAsToken = identityService.newRunAsToken(_runAsRole); + servlet = new RunAs(servlet, identityService, runAsToken); } } if (!isAsyncSupported()) - _servlet = new NotAsync(_servlet); + servlet = new NotAsync(servlet); // Handle configuring servlets that implement org.apache.jasper.servlet.JspServlet if (isJspServlet()) @@ -595,28 +615,30 @@ public class ServletHolder extends Holder implements UserIdentity.Scope detectJspContainer(); initMultiPart(); - _servlet = wrap(_servlet, WrapFunction.class, WrapFunction::wrapServlet); + servlet = wrap(servlet, WrapFunction.class, WrapFunction::wrapServlet); if (LOG.isDebugEnabled()) LOG.debug("Servlet.init {} for {}", _servlet, getName()); - _servlet.init(_config); - } - catch (UnavailableException e) - { - makeUnavailable(e); - if (getServletHandler().isStartWithUnavailable()) - LOG.warn(e); - else - throw e; + try + { + servlet.init(_config); + _servlet = servlet; + } + catch (UnavailableException e) + { + _servlet = new UnavailableServlet(e, servlet); + } } catch (ServletException e) { makeUnavailable(e.getCause() == null ? e : e.getCause()); + predestroyServlet(servlet); throw e; } catch (Exception e) { makeUnavailable(e); + predestroyServlet(servlet); throw new ServletException(this.toString(), e); } } @@ -651,8 +673,8 @@ public class ServletHolder extends Holder implements UserIdentity.Scope } scratch = new File(getInitParameter("scratchdir")); - if (!scratch.exists()) - scratch.mkdir(); + if (!scratch.exists() && !scratch.mkdir()) + throw new IllegalStateException("Could not create JSP scratch directory"); } /** @@ -725,10 +747,16 @@ public class ServletHolder extends Holder implements UserIdentity.Scope protected void prepare(Request baseRequest, ServletRequest request, ServletResponse response) throws ServletException, UnavailableException { + // Ensure the servlet is initialized prior to any filters being invoked getServlet(); - MultipartConfigElement mpce = ((Registration)getRegistration()).getMultipartConfig(); - if (mpce != null) - baseRequest.setAttribute(Request.MULTIPART_CONFIG_ELEMENT, mpce); + + // Check for multipart config + if (_registration != null) + { + MultipartConfigElement mpce = ((Registration)_registration).getMultipartConfig(); + if (mpce != null) + baseRequest.setAttribute(Request.MULTIPART_CONFIG_ELEMENT, mpce); + } } @Deprecated @@ -757,7 +785,7 @@ public class ServletHolder extends Holder implements UserIdentity.Scope { try { - Servlet servlet = getServlet(); + Servlet servlet = getServletInstance(); if (servlet == null) throw new UnavailableException("Servlet Not Initialized"); servlet.service(request, response); @@ -1197,72 +1225,69 @@ public class ServletHolder extends Holder implements UserIdentity.Scope @Override public String toString() { - return String.format("%s@%x==%s,jsp=%s,order=%d,inst=%b,async=%b", getName(), hashCode(), getClassName(), _forcedPath, _initOrder, _servlet != null, isAsyncSupported()); + return String.format("%s==%s@%x{jsp=%s,order=%d,inst=%b,async=%b,src=%s}", + getName(), getClassName(), hashCode(), + _forcedPath, _initOrder, _servlet != null, isAsyncSupported(), getSource()); } - private class UnavailableServlet extends GenericServlet + private class UnavailableServlet extends Wrapper { final UnavailableException _unavailableException; - final Servlet _servlet; - final long _available; + final AtomicLong _unavailableStart; public UnavailableServlet(UnavailableException unavailableException, Servlet servlet) { + super(servlet != null ? servlet : new GenericServlet() + { + @Override + public void service(ServletRequest req, ServletResponse res) throws IOException + { + ((HttpServletResponse)res).sendError(HttpServletResponse.SC_NOT_FOUND); + } + }); _unavailableException = unavailableException; if (unavailableException.isPermanent()) - { - _servlet = null; - _available = -1; - if (servlet != null) - { - try - { - destroyInstance(servlet); - } - catch (Throwable th) - { - if (th != unavailableException) - unavailableException.addSuppressed(th); - } - } - } + _unavailableStart = null; else { - _servlet = servlet; - _available = System.nanoTime() + TimeUnit.SECONDS.toNanos(unavailableException.getUnavailableSeconds()); + long start = System.nanoTime(); + while (start == 0) + start = System.nanoTime(); + _unavailableStart = new AtomicLong(start); } } @Override public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { - if (_available == -1) + if (LOG.isDebugEnabled()) + LOG.debug("Unavailable {}", req, _unavailableException); + if (_unavailableStart == null) + { ((HttpServletResponse)res).sendError(HttpServletResponse.SC_NOT_FOUND); - else if (System.nanoTime() < _available) - ((HttpServletResponse)res).sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE); + } else { - synchronized (ServletHolder.this) - { - ServletHolder.this._servlet = this._servlet; - _servlet.service(req, res); - } - } - } + long start = _unavailableStart.get(); - @Override - public void destroy() - { - if (_servlet != null) - { - try + if (start == 0 || System.nanoTime() - start < TimeUnit.SECONDS.toNanos(_unavailableException.getUnavailableSeconds())) { - destroyInstance(_servlet); + ((HttpServletResponse)res).sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE); } - catch (Throwable th) + else if (_unavailableStart.compareAndSet(start, 0)) { - LOG.warn(th); + synchronized (this) + { + _servlet = getWrapped(); + } + Request baseRequest = Request.getBaseRequest(req); + ServletHolder.this.prepare(baseRequest, req, res); + ServletHolder.this.handle(baseRequest, req, res); + } + else + { + ((HttpServletResponse)res).sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE); } } } @@ -1294,53 +1319,53 @@ public class ServletHolder extends Holder implements UserIdentity.Scope public static class Wrapper implements Servlet, Wrapped { - private final Servlet _servlet; + private final Servlet _wrappedServlet; public Wrapper(Servlet servlet) { - _servlet = Objects.requireNonNull(servlet, "Servlet cannot be null"); + _wrappedServlet = Objects.requireNonNull(servlet, "Servlet cannot be null"); } @Override public Servlet getWrapped() { - return _servlet; + return _wrappedServlet; } @Override public void init(ServletConfig config) throws ServletException { - _servlet.init(config); + _wrappedServlet.init(config); } @Override public ServletConfig getServletConfig() { - return _servlet.getServletConfig(); + return _wrappedServlet.getServletConfig(); } @Override public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { - _servlet.service(req, res); + _wrappedServlet.service(req, res); } @Override public String getServletInfo() { - return _servlet.getServletInfo(); + return _wrappedServlet.getServletInfo(); } @Override public void destroy() { - _servlet.destroy(); + _wrappedServlet.destroy(); } @Override public String toString() { - return String.format("%s:%s", this.getClass().getSimpleName(), _servlet.toString()); + return String.format("%s:%s", this.getClass().getSimpleName(), _wrappedServlet.toString()); } } diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java index 84930ea8950..55fd67963ae 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/StatisticsServlet.java @@ -203,7 +203,7 @@ public class StatisticsServlet extends HttpServlet sb.append(" ").append(connectionStats.getConnectionDurationMax()).append("\n"); sb.append(" ").append(connectionStats.getConnectionDurationStdDev()).append("\n"); sb.append(" ").append(connectionStats.getReceivedBytes()).append("\n"); - sb.append(" ").append(connectionStats.getSentBytes()).append("\n"); + sb.append(" ").append(connectionStats.getSentBytes()).append("\n"); sb.append(" ").append(connectionStats.getReceivedMessages()).append("\n"); sb.append(" ").append(connectionStats.getSentMessages()).append("\n"); } diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ErrorPageTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ErrorPageTest.java index 45668965ed7..59064a280a5 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ErrorPageTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ErrorPageTest.java @@ -422,6 +422,7 @@ public class ErrorPageTest __destroyed = new AtomicBoolean(false); String response = _connector.getResponse("GET /unavailable/info HTTP/1.0\r\n\r\n"); assertThat(response, Matchers.containsString("HTTP/1.1 404 ")); + _server.stop(); assertTrue(__destroyed.get()); } } diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletHandlerTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletHandlerTest.java index 29dc90ad1c1..5bddd101f30 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletHandlerTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletHandlerTest.java @@ -18,18 +18,29 @@ package org.eclipse.jetty.servlet; +import java.io.IOException; import java.util.ArrayList; import java.util.EnumSet; import java.util.List; import javax.servlet.DispatcherType; +import javax.servlet.Filter; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; import org.eclipse.jetty.http.pathmap.MappedResource; +import org.eclipse.jetty.server.LocalConnector; +import org.eclipse.jetty.server.Server; import org.eclipse.jetty.util.component.Container; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -730,4 +741,111 @@ public class ServletHandlerTest assertTrue(removeResults.contains(sh1)); assertTrue(removeResults.contains(lh1)); } + + @Test + public void testServletMappings() throws Exception + { + Server server = new Server(); + ServletHandler handler = new ServletHandler(); + server.setHandler(handler); + for (final String mapping : new String[] {"/", "/foo", "/bar/*", "*.bob"}) + { + handler.addServletWithMapping(new ServletHolder(new HttpServlet() + { + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException + { + resp.getOutputStream().println("mapping='" + mapping + "'"); + } + }), mapping); + } + // add servlet with no mapping + handler.addServlet(new ServletHolder(new HttpServlet() {})); + + LocalConnector connector = new LocalConnector(server); + server.addConnector(connector); + + server.start(); + + assertThat(connector.getResponse("GET /default HTTP/1.0\r\n\r\n"), containsString("mapping='/'")); + assertThat(connector.getResponse("GET /foo HTTP/1.0\r\n\r\n"), containsString("mapping='/foo'")); + assertThat(connector.getResponse("GET /bar HTTP/1.0\r\n\r\n"), containsString("mapping='/bar/*'")); + assertThat(connector.getResponse("GET /bar/bob HTTP/1.0\r\n\r\n"), containsString("mapping='/bar/*'")); + assertThat(connector.getResponse("GET /bar/foo.bob HTTP/1.0\r\n\r\n"), containsString("mapping='/bar/*'")); + assertThat(connector.getResponse("GET /other/foo.bob HTTP/1.0\r\n\r\n"), containsString("mapping='*.bob'")); + } + + @Test + public void testFilterMappings() throws Exception + { + Server server = new Server(); + ServletHandler handler = new ServletHandler(); + server.setHandler(handler); + + ServletHolder foo = new ServletHolder(new HttpServlet() + { + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException + { + resp.getOutputStream().println("FOO"); + } + }); + foo.setName("foo"); + handler.addServletWithMapping(foo, "/foo/*"); + + ServletHolder def = new ServletHolder(new HttpServlet() + { + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException + { + resp.getOutputStream().println("default"); + } + }); + def.setName("default"); + handler.addServletWithMapping(def, "/"); + + for (final String mapping : new String[]{"/*", "/foo", "/bar/*", "*.bob"}) + { + handler.addFilterWithMapping(new FilterHolder((TestFilter)(request, response, chain) -> + { + response.getOutputStream().print("path-" + mapping + "-"); + chain.doFilter(request, response); + }), mapping, EnumSet.of(DispatcherType.REQUEST)); + } + + FilterHolder fooFilter = new FilterHolder((TestFilter)(request, response, chain) -> + { + response.getOutputStream().print("name-foo-"); + chain.doFilter(request, response); + }); + fooFilter.setName("fooFilter"); + FilterMapping named = new FilterMapping(); + named.setFilterHolder(fooFilter); + named.setServletName("foo"); + handler.addFilter(fooFilter, named); + + LocalConnector connector = new LocalConnector(server); + server.addConnector(connector); + + server.start(); + + assertThat(connector.getResponse("GET /default HTTP/1.0\r\n\r\n"), containsString("path-/*-default")); + assertThat(connector.getResponse("GET /foo HTTP/1.0\r\n\r\n"), containsString("path-/*-path-/foo-name-foo-FOO")); + assertThat(connector.getResponse("GET /foo/bar HTTP/1.0\r\n\r\n"), containsString("path-/*-name-foo-FOO")); + assertThat(connector.getResponse("GET /foo/bar.bob HTTP/1.0\r\n\r\n"), containsString("path-/*-path-*.bob-name-foo-FOO")); + assertThat(connector.getResponse("GET /other.bob HTTP/1.0\r\n\r\n"), containsString("path-/*-path-*.bob-default")); + } + + private interface TestFilter extends Filter + { + default void init(FilterConfig filterConfig) throws ServletException + { + } + + @Override + default void destroy() + { + } + } + } diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletLifeCycleTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletLifeCycleTest.java index 0e49712f836..65d92ee5d5a 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletLifeCycleTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletLifeCycleTest.java @@ -59,6 +59,10 @@ public class ServletLifeCycleTest context.getObjectFactory().addDecorator(new TestDecorator()); + // TODO review this test in jetty-10. Instances that are created externally and passed in should not be + // TODO decorated by the object factory unless: a) there is an explicit call to ServletContext.createXxx; + // TODO ; and b) the Servlet dyanmic API is used to register them. + ServletHandler sh = context.getServletHandler(); sh.addListener(new ListenerHolder(TestListener.class)); //added directly to ServletHandler context.addEventListener(context.getServletContext().createListener(TestListener2.class));//create,decorate and add listener to context - no holder! diff --git a/jetty-servlets/pom.xml b/jetty-servlets/pom.xml index d5eb6cda20f..385464af381 100644 --- a/jetty-servlets/pom.xml +++ b/jetty-servlets/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-servlets diff --git a/jetty-spring/pom.xml b/jetty-spring/pom.xml index b292f1d60f5..b502831988e 100644 --- a/jetty-spring/pom.xml +++ b/jetty-spring/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-spring diff --git a/jetty-start/pom.xml b/jetty-start/pom.xml index faed9c6b443..39ef94ad638 100644 --- a/jetty-start/pom.xml +++ b/jetty-start/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-start diff --git a/jetty-unixsocket/pom.xml b/jetty-unixsocket/pom.xml index 97418cb7e69..a17c565bd1c 100644 --- a/jetty-unixsocket/pom.xml +++ b/jetty-unixsocket/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-unixsocket @@ -80,7 +80,7 @@ run - + @@ -92,7 +92,7 @@ - + diff --git a/jetty-util-ajax/pom.xml b/jetty-util-ajax/pom.xml index b082beb79fb..2f96269a47d 100644 --- a/jetty-util-ajax/pom.xml +++ b/jetty-util-ajax/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-util-ajax diff --git a/jetty-util/pom.xml b/jetty-util/pom.xml index dc65f9f7ebf..d1c9f04ed5f 100644 --- a/jetty-util/pom.xml +++ b/jetty-util/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-util diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/component/AbstractLifeCycle.java b/jetty-util/src/main/java/org/eclipse/jetty/util/component/AbstractLifeCycle.java index 3a9b07e795a..1fb5793ac6f 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/component/AbstractLifeCycle.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/component/AbstractLifeCycle.java @@ -20,6 +20,7 @@ package org.eclipse.jetty.util.component; import java.util.concurrent.CopyOnWriteArrayList; +import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.Uptime; import org.eclipse.jetty.util.annotation.ManagedAttribute; import org.eclipse.jetty.util.annotation.ManagedObject; @@ -280,13 +281,9 @@ public abstract class AbstractLifeCycle implements LifeCycle @Override public String toString() { - Class clazz = getClass(); - String name = clazz.getSimpleName(); - if ((name == null || name.length() == 0) && clazz.getSuperclass() != null) - { - clazz = clazz.getSuperclass(); - name = clazz.getSimpleName(); - } + String name = getClass().getSimpleName(); + if (StringUtil.isBlank(name) && getClass().getSuperclass() != null) + name = getClass().getSuperclass().getSimpleName(); return String.format("%s@%x{%s}", name, hashCode(), getState()); } } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java index e9931f548e4..e29e285c4b1 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java @@ -571,11 +571,7 @@ public class PathResource extends Resource int size = entries.size(); return entries.toArray(new String[size]); } - catch (DirectoryIteratorException e) - { - LOG.debug(e); - } - catch (IOException e) + catch (DirectoryIteratorException | IOException e) { LOG.debug(e); } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/ResourceCollection.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/ResourceCollection.java index 594ba49c3b3..3f080072465 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/ResourceCollection.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/ResourceCollection.java @@ -434,11 +434,12 @@ public class ResourceCollection extends Resource public String[] list() { assertResourcesSet(); - HashSet set = new HashSet<>(); for (Resource r : _resources) { - Collections.addAll(set, r.list()); + String[] list = r.list(); + if (list != null) + Collections.addAll(set, list); } String[] result = set.toArray(new String[0]); Arrays.sort(result); diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java b/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java index 8776e418205..5ec5e82b7b2 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java @@ -47,14 +47,12 @@ import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; -import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.function.Consumer; -import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.net.ssl.CertPathTrustManagerParameters; import javax.net.ssl.HostnameVerifier; @@ -140,7 +138,7 @@ public class SslContextFactory extends AbstractLifeCycle implements Dumpable private final Set _excludeProtocols = new LinkedHashSet<>(); private final Set _includeProtocols = new LinkedHashSet<>(); private final Set _excludeCipherSuites = new LinkedHashSet<>(); - private final List _includeCipherSuites = new ArrayList<>(); + private final Set _includeCipherSuites = new LinkedHashSet<>(); private final Map _aliasX509 = new HashMap<>(); private final Map _certHosts = new HashMap<>(); private final Map _certWilds = new HashMap<>(); @@ -526,6 +524,8 @@ public class SslContextFactory extends AbstractLifeCycle implements Dumpable } /** + * You can either use the exact Protocol name or a a regular expression. + * * @param protocols The array of protocol names to exclude from * {@link SSLEngine#setEnabledProtocols(String[])} */ @@ -536,7 +536,9 @@ public class SslContextFactory extends AbstractLifeCycle implements Dumpable } /** - * @param protocol Protocol names to add to {@link SSLEngine#setEnabledProtocols(String[])} + * You can either use the exact Protocol name or a a regular expression. + * + * @param protocol Protocol name patterns to add to {@link SSLEngine#setEnabledProtocols(String[])} */ public void addExcludeProtocols(String... protocol) { @@ -544,7 +546,7 @@ public class SslContextFactory extends AbstractLifeCycle implements Dumpable } /** - * @return The array of protocol names to include in + * @return The array of protocol name patterns to include in * {@link SSLEngine#setEnabledProtocols(String[])} */ @ManagedAttribute("The included TLS protocols") @@ -554,7 +556,9 @@ public class SslContextFactory extends AbstractLifeCycle implements Dumpable } /** - * @param protocols The array of protocol names to include in + * You can either use the exact Protocol name or a a regular expression. + * + * @param protocols The array of protocol name patterns to include in * {@link SSLEngine#setEnabledProtocols(String[])} */ public void setIncludeProtocols(String... protocols) @@ -564,7 +568,7 @@ public class SslContextFactory extends AbstractLifeCycle implements Dumpable } /** - * @return The array of cipher suite names to exclude from + * @return The array of cipher suite name patterns to exclude from * {@link SSLEngine#setEnabledCipherSuites(String[])} */ @ManagedAttribute("The excluded cipher suites") @@ -574,7 +578,7 @@ public class SslContextFactory extends AbstractLifeCycle implements Dumpable } /** - * You can either use the exact cipher suite name or a a regular expression. + * You can either use the exact Cipher suite name or a a regular expression. * * @param cipherSuites The array of cipher suite names to exclude from * {@link SSLEngine#setEnabledCipherSuites(String[])} @@ -586,6 +590,8 @@ public class SslContextFactory extends AbstractLifeCycle implements Dumpable } /** + * You can either use the exact Cipher suite name or a a regular expression. + * * @param cipher Cipher names to add to {@link SSLEngine#setEnabledCipherSuites(String[])} */ public void addExcludeCipherSuites(String... cipher) @@ -594,7 +600,7 @@ public class SslContextFactory extends AbstractLifeCycle implements Dumpable } /** - * @return The array of cipher suite names to include in + * @return The array of Cipher suite names to include in * {@link SSLEngine#setEnabledCipherSuites(String[])} */ @ManagedAttribute("The included cipher suites") @@ -604,7 +610,7 @@ public class SslContextFactory extends AbstractLifeCycle implements Dumpable } /** - * You can either use the exact cipher suite name or a a regular expression. + * You can either use the exact Cipher suite name or a a regular expression. * * @param cipherSuites The array of cipher suite names to include in * {@link SSLEngine#setEnabledCipherSuites(String[])} @@ -1357,28 +1363,10 @@ public class SslContextFactory extends AbstractLifeCycle implements Dumpable */ public void selectProtocols(String[] enabledProtocols, String[] supportedProtocols) { - Set selectedProtocols = new LinkedHashSet<>(); - - // Set the starting protocols - either from the included or enabled list - if (!_includeProtocols.isEmpty()) - { - // Use only the supported included protocols - for (String protocol : _includeProtocols) - { - if (Arrays.asList(supportedProtocols).contains(protocol)) - selectedProtocols.add(protocol); - else - LOG.info("Protocol {} not supported in {}", protocol, Arrays.asList(supportedProtocols)); - } - } - else - selectedProtocols.addAll(Arrays.asList(enabledProtocols)); - - // Remove any excluded protocols - selectedProtocols.removeAll(_excludeProtocols); + List selectedProtocols = processIncludeExcludePatterns("Protocols", enabledProtocols, supportedProtocols, _includeProtocols, _excludeProtocols); if (selectedProtocols.isEmpty()) - LOG.warn("No selected protocols from {}", Arrays.asList(supportedProtocols)); + LOG.warn("No selected Protocols from {}", Arrays.asList(supportedProtocols)); _selectedProtocols = selectedProtocols.toArray(new String[0]); } @@ -1393,18 +1381,10 @@ public class SslContextFactory extends AbstractLifeCycle implements Dumpable */ protected void selectCipherSuites(String[] enabledCipherSuites, String[] supportedCipherSuites) { - List selectedCiphers = new ArrayList<>(); - - // Set the starting ciphers - either from the included or enabled list - if (_includeCipherSuites.isEmpty()) - selectedCiphers.addAll(Arrays.asList(enabledCipherSuites)); - else - processIncludeCipherSuites(supportedCipherSuites, selectedCiphers); - - removeExcludedCipherSuites(selectedCiphers); + List selectedCiphers = processIncludeExcludePatterns("Cipher Suite", enabledCipherSuites, supportedCipherSuites, _includeCipherSuites, _excludeCipherSuites); if (selectedCiphers.isEmpty()) - LOG.warn("No supported ciphers from {}", Arrays.asList(supportedCipherSuites)); + LOG.warn("No supported Cipher Suite from {}", Arrays.asList(supportedCipherSuites)); Comparator comparator = getCipherComparator(); if (comparator != null) @@ -1417,39 +1397,58 @@ public class SslContextFactory extends AbstractLifeCycle implements Dumpable _selectedCipherSuites = selectedCiphers.toArray(new String[0]); } - protected void processIncludeCipherSuites(String[] supportedCipherSuites, List selectedCiphers) + private List processIncludeExcludePatterns(String type, String[] enabled, String[] supported, Set included, Set excluded) { - for (String cipherSuite : _includeCipherSuites) + List selected = new ArrayList<>(); + // Set the starting list - either from the included or enabled list + if (included.isEmpty()) { - Pattern p = Pattern.compile(cipherSuite); - boolean added = false; - for (String supportedCipherSuite : supportedCipherSuites) - { - Matcher m = p.matcher(supportedCipherSuite); - if (m.matches()) - { - added = true; - selectedCiphers.add(supportedCipherSuite); - } - } - if (!added) - LOG.info("No Cipher matching '{}' is supported", cipherSuite); + selected.addAll(Arrays.asList(enabled)); } + else + { + // process include patterns + for (String includedItem : included) + { + Pattern pattern = Pattern.compile(includedItem); + boolean added = false; + for (String supportedItem : supported) + { + if (pattern.matcher(supportedItem).matches()) + { + added = true; + selected.add(supportedItem); + } + } + if (!added) + LOG.info("No {} matching '{}' is supported", type, includedItem); + } + } + + // process exclude patterns + for (String excludedItem : excluded) + { + Pattern pattern = Pattern.compile(excludedItem); + selected.removeIf(selectedItem -> pattern.matcher(selectedItem).matches()); + } + + return selected; } + /** + * @deprecated no replacement + */ + @Deprecated + protected void processIncludeCipherSuites(String[] supportedCipherSuites, List selectedCiphers) + { + } + + /** + * @deprecated no replacement + */ + @Deprecated protected void removeExcludedCipherSuites(List selectedCiphers) { - for (String excludeCipherSuite : _excludeCipherSuites) - { - Pattern excludeCipherPattern = Pattern.compile(excludeCipherSuite); - for (Iterator i = selectedCiphers.iterator(); i.hasNext(); ) - { - String selectedCipherSuite = i.next(); - Matcher m = excludeCipherPattern.matcher(selectedCipherSuite); - if (m.matches()) - i.remove(); - } - } } /** diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/ResourceCollectionTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/ResourceCollectionTest.java index 51200037cce..d3e212517c6 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/ResourceCollectionTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/ResourceCollectionTest.java @@ -22,6 +22,7 @@ import java.io.BufferedReader; import java.io.File; import java.io.InputStreamReader; import java.nio.file.Path; +import java.util.Arrays; import org.eclipse.jetty.toolchain.test.FS; import org.eclipse.jetty.toolchain.test.MavenTestingUtils; @@ -32,7 +33,9 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.nullValue; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -174,6 +177,20 @@ public class ResourceCollectionTest }); } + @Test + public void testList() throws Exception + { + ResourceCollection rc1 = new ResourceCollection( + Resource.newResource("src/test/resources/org/eclipse/jetty/util/resource/one/"), + Resource.newResource("src/test/resources/org/eclipse/jetty/util/resource/two/"), + Resource.newResource("src/test/resources/org/eclipse/jetty/util/resource/three/")); + + assertThat(Arrays.asList(rc1.list()), contains("1.txt", "2.txt", "3.txt", "dir/")); + assertThat(Arrays.asList(rc1.addPath("dir").list()), contains("1.txt", "2.txt", "3.txt")); + assertThat(rc1.addPath("unknown").list(), nullValue()); + // TODO for jetty-10 assertThat(rc1.addPath("unknown").list(), nullValue()); + } + @Test public void testMultipleSources1() throws Exception { diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/ssl/SslContextFactoryTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/ssl/SslContextFactoryTest.java index 0ce32702e06..6171d2f1936 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/ssl/SslContextFactoryTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/ssl/SslContextFactoryTest.java @@ -30,6 +30,7 @@ import java.security.cert.X509Certificate; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -46,7 +47,6 @@ import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.component.AbstractLifeCycle; import org.eclipse.jetty.util.log.StacklessLogging; import org.eclipse.jetty.util.resource.Resource; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; @@ -55,6 +55,7 @@ import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.hasItem; +import static org.hamcrest.Matchers.hasItemInArray; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.matchesRegex; import static org.hamcrest.Matchers.not; @@ -69,25 +70,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class SslContextFactoryTest { - private SslContextFactory cf; - - @BeforeEach - public void setUp() throws Exception - { - cf = new SslContextFactory.Server(); - - java.security.cert.CertPathBuilder certPathBuilder = java.security.cert.CertPathBuilder.getInstance("PKIX"); - java.security.cert.PKIXRevocationChecker revocationChecker = (java.security.cert.PKIXRevocationChecker)certPathBuilder.getRevocationChecker(); - revocationChecker.setOptions(java.util.EnumSet.of( - java.security.cert.PKIXRevocationChecker.Option.valueOf("PREFER_CRLS"), - java.security.cert.PKIXRevocationChecker.Option.valueOf("SOFT_FAIL"), - java.security.cert.PKIXRevocationChecker.Option.valueOf("NO_FALLBACK"))); - cf.setPkixCertPathChecker(revocationChecker); - } - @Test public void testSLOTH() throws Exception { + SslContextFactory.Server cf = new SslContextFactory.Server(); cf.setKeyStorePassword("storepwd"); cf.setKeyManagerPassword("keypwd"); @@ -96,9 +82,13 @@ public class SslContextFactoryTest // cf.dump(System.out, ""); List dumps = cf.selectionDump(); - SslSelectionDump cipherDump = dumps.stream() + Optional cipherSuiteDumpOpt = dumps.stream() .filter((dump) -> dump.type.contains("Cipher Suite")) - .findFirst().get(); + .findFirst(); + + assertTrue(cipherSuiteDumpOpt.isPresent(), "Cipher Suite dump section should exist"); + + SslSelectionDump cipherDump = cipherSuiteDumpOpt.get(); for (String enabledCipher : cipherDump.enabled) { @@ -106,9 +96,42 @@ public class SslContextFactoryTest } } + @Test + public void testDumpExcludedProtocols() throws Exception + { + SslContextFactory.Server cf = new SslContextFactory.Server(); + cf.setExcludeProtocols("TLSv1\\.?[01]?"); + cf.start(); + + // Confirm behavior in engine + assertThat(cf.newSSLEngine().getEnabledProtocols(), not(hasItemInArray("TLSv1.1"))); + assertThat(cf.newSSLEngine().getEnabledProtocols(), not(hasItemInArray("TLSv1"))); + + // Confirm output in dump + List dumps = cf.selectionDump(); + + Optional protocolDumpOpt = dumps.stream() + .filter((dump) -> dump.type.contains("Protocol")) + .findFirst(); + + assertTrue(protocolDumpOpt.isPresent(), "Protocol dump section should exist"); + + SslSelectionDump protocolDump = protocolDumpOpt.get(); + + long countTls11Enabled = protocolDump.enabled.stream().filter((t) -> t.contains("TLSv1.1")).count(); + long countTls11Disabled = protocolDump.disabled.stream().filter((t) -> t.contains("TLSv1.1")).count(); + + assertThat("Enabled Protocols TLSv1.1 count", countTls11Enabled, is(0L)); + assertThat("Disabled Protocols TLSv1.1 count", countTls11Disabled, is(1L)); + + // Uncomment to show dump in console. + // cf.dump(System.out, ""); + } + @Test public void testDumpIncludeTlsRsa() throws Exception { + SslContextFactory.Server cf = new SslContextFactory.Server(); cf.setKeyStorePassword("storepwd"); cf.setKeyManagerPassword("keypwd"); cf.setIncludeCipherSuites("TLS_RSA_.*"); @@ -126,9 +149,15 @@ public class SslContextFactoryTest .collect(Collectors.toList()); List selectedSuites = Arrays.asList(cf.getSelectedCipherSuites()); - SslSelectionDump cipherDump = dumps.stream() + + Optional cipherSuiteDumpOpt = dumps.stream() .filter((dump) -> dump.type.contains("Cipher Suite")) - .findFirst().get(); + .findFirst(); + + assertTrue(cipherSuiteDumpOpt.isPresent(), "Cipher Suite dump section should exist"); + + SslSelectionDump cipherDump = cipherSuiteDumpOpt.get(); + assertThat("Dump Enabled List size is equal to selected list size", cipherDump.enabled.size(), is(selectedSuites.size())); for (String expectedCipherSuite : tlsRsaSuites) @@ -141,17 +170,19 @@ public class SslContextFactoryTest @Test public void testNoTsFileKs() throws Exception { + SslContextFactory.Server cf = new SslContextFactory.Server(); cf.setKeyStorePassword("storepwd"); cf.setKeyManagerPassword("keypwd"); cf.start(); - assertTrue(cf.getSslContext() != null); + assertNotNull(cf.getSslContext()); } @Test public void testNoTsSetKs() throws Exception { + SslContextFactory.Server cf = new SslContextFactory.Server(); KeyStore ks = KeyStore.getInstance("JKS"); try (InputStream keystoreInputStream = this.getClass().getResourceAsStream("keystore")) { @@ -162,26 +193,21 @@ public class SslContextFactoryTest cf.start(); - assertTrue(cf.getSslContext() != null); + assertNotNull(cf.getSslContext()); } @Test public void testNoTsNoKs() throws Exception { + SslContextFactory.Server cf = new SslContextFactory.Server(); cf.start(); - assertTrue(cf.getSslContext() != null); - } - - @Test - public void testTrustAll() throws Exception - { - cf.start(); - assertTrue(cf.getSslContext() != null); + assertNotNull(cf.getSslContext()); } @Test public void testNoTsResourceKs() throws Exception { + SslContextFactory.Server cf = new SslContextFactory.Server(); Resource keystoreResource = Resource.newSystemResource("keystore"); cf.setKeyStoreResource(keystoreResource); @@ -192,12 +218,13 @@ public class SslContextFactoryTest cf.start(); - assertTrue(cf.getSslContext() != null); + assertNotNull(cf.getSslContext()); } @Test public void testResourceTsResourceKs() throws Exception { + SslContextFactory.Server cf = new SslContextFactory.Server(); Resource keystoreResource = Resource.newSystemResource("keystore"); Resource truststoreResource = Resource.newSystemResource("keystore"); @@ -209,12 +236,13 @@ public class SslContextFactoryTest cf.start(); - assertTrue(cf.getSslContext() != null); + assertNotNull(cf.getSslContext()); } @Test public void testResourceTsResourceKsWrongPW() throws Exception { + SslContextFactory.Server cf = new SslContextFactory.Server(); Resource keystoreResource = Resource.newSystemResource("keystore"); Resource truststoreResource = Resource.newSystemResource("keystore"); @@ -227,7 +255,7 @@ public class SslContextFactoryTest try (StacklessLogging ignore = new StacklessLogging(AbstractLifeCycle.class)) { java.security.UnrecoverableKeyException x = assertThrows( - java.security.UnrecoverableKeyException.class, () -> cf.start()); + java.security.UnrecoverableKeyException.class, cf::start); assertThat(x.getMessage(), containsString("Cannot recover key")); } } @@ -235,6 +263,7 @@ public class SslContextFactoryTest @Test public void testResourceTsWrongPWResourceKs() throws Exception { + SslContextFactory.Server cf = new SslContextFactory.Server(); Resource keystoreResource = Resource.newSystemResource("keystore"); Resource truststoreResource = Resource.newSystemResource("keystore"); @@ -246,14 +275,15 @@ public class SslContextFactoryTest try (StacklessLogging ignore = new StacklessLogging(AbstractLifeCycle.class)) { - IOException x = assertThrows(IOException.class, () -> cf.start()); + IOException x = assertThrows(IOException.class, cf::start); assertThat(x.getMessage(), containsString("Keystore was tampered with, or password was incorrect")); } } @Test - public void testNoKeyConfig() throws Exception + public void testNoKeyConfig() { + SslContextFactory.Server cf = new SslContextFactory.Server(); try (StacklessLogging ignore = new StacklessLogging(AbstractLifeCycle.class)) { IllegalStateException x = assertThrows(IllegalStateException.class, () -> @@ -268,6 +298,7 @@ public class SslContextFactoryTest @Test public void testSetExcludeCipherSuitesRegex() throws Exception { + SslContextFactory.Server cf = new SslContextFactory.Server(); cf.setExcludeCipherSuites(".*RC4.*"); cf.start(); SSLEngine sslEngine = cf.newSSLEngine(); @@ -282,6 +313,7 @@ public class SslContextFactoryTest @Test public void testSetIncludeCipherSuitesRegex() throws Exception { + SslContextFactory.Server cf = new SslContextFactory.Server(); cf.setIncludeCipherSuites(".*ECDHE.*", ".*WIBBLE.*"); cf.start(); @@ -297,6 +329,7 @@ public class SslContextFactoryTest @Test public void testProtocolAndCipherSettingsAreNPESafe() { + SslContextFactory.Server cf = new SslContextFactory.Server(); assertNotNull(cf.getExcludeProtocols()); assertNotNull(cf.getIncludeProtocols()); assertNotNull(cf.getExcludeCipherSuites()); @@ -306,6 +339,7 @@ public class SslContextFactoryTest @Test public void testSNICertificates() throws Exception { + SslContextFactory.Server cf = new SslContextFactory.Server(); Resource keystoreResource = Resource.newSystemResource("snikeystore"); cf.setKeyStoreResource(keystoreResource); @@ -347,7 +381,7 @@ public class SslContextFactoryTest @Test public void testNonDefaultKeyStoreTypeUsedForTrustStore() throws Exception { - cf = new SslContextFactory.Server(); + SslContextFactory.Server cf = new SslContextFactory.Server(); cf.setKeyStoreResource(Resource.newSystemResource("keystore.p12")); cf.setKeyStoreType("pkcs12"); cf.setKeyStorePassword("storepwd"); @@ -365,7 +399,7 @@ public class SslContextFactoryTest @Test public void testClientSslContextFactory() throws Exception { - cf = new SslContextFactory.Client(); + SslContextFactory.Client cf = new SslContextFactory.Client(); cf.start(); assertEquals("HTTPS", cf.getEndpointIdentificationAlgorithm()); @@ -374,7 +408,7 @@ public class SslContextFactoryTest @Test public void testServerSslContextFactory() throws Exception { - cf = new SslContextFactory.Server(); + SslContextFactory.Server cf = new SslContextFactory.Server(); cf.start(); assertNull(cf.getEndpointIdentificationAlgorithm()); diff --git a/jetty-webapp/pom.xml b/jetty-webapp/pom.xml index 8154b7ee84c..9532030c0bc 100644 --- a/jetty-webapp/pom.xml +++ b/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-webapp diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java index 3f959ce88bd..33967487af3 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java @@ -38,6 +38,7 @@ import org.eclipse.jetty.http.pathmap.ServletPathSpec; import org.eclipse.jetty.security.ConstraintAware; import org.eclipse.jetty.security.ConstraintMapping; import org.eclipse.jetty.security.authentication.FormAuthenticator; +import org.eclipse.jetty.server.session.SessionHandler; import org.eclipse.jetty.servlet.ErrorPageErrorHandler; import org.eclipse.jetty.servlet.FilterHolder; import org.eclipse.jetty.servlet.FilterMapping; @@ -732,7 +733,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor case WebFragment: { //a web-fragment set the value, all web-fragments must have the same value - if (!context.getSessionHandler().getSessionCookieConfig().getName().equals(name)) + if (!name.equals(SessionHandler.getSessionCookieName(context.getSessionHandler().getSessionCookieConfig()))) throw new IllegalStateException("Conflicting cookie-config name " + name + " in " + descriptor.getResource()); break; } @@ -806,7 +807,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor case WebFragment: { //a web-fragment set the value, all web-fragments must have the same value - if (!context.getSessionHandler().getSessionCookieConfig().getPath().equals(path)) + if (!path.equals(context.getSessionHandler().getSessionCookieConfig().getPath())) throw new IllegalStateException("Conflicting cookie-config path " + path + " in " + descriptor.getResource()); break; } diff --git a/jetty-websocket/javax-websocket-client-impl/pom.xml b/jetty-websocket/javax-websocket-client-impl/pom.xml index 43a38067e8b..033a7fd9e21 100644 --- a/jetty-websocket/javax-websocket-client-impl/pom.xml +++ b/jetty-websocket/javax-websocket-client-impl/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.websocket websocket-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-websocket/javax-websocket-server-impl/pom.xml b/jetty-websocket/javax-websocket-server-impl/pom.xml index b037bbd1f5a..81445c35aa0 100644 --- a/jetty-websocket/javax-websocket-server-impl/pom.xml +++ b/jetty-websocket/javax-websocket-server-impl/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.websocket websocket-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-websocket/jetty-websocket-tests/pom.xml b/jetty-websocket/jetty-websocket-tests/pom.xml index e25f47d4ef7..ffc823b1053 100644 --- a/jetty-websocket/jetty-websocket-tests/pom.xml +++ b/jetty-websocket/jetty-websocket-tests/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.websocket websocket-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml index 25af902913c..9093b527eaa 100644 --- a/jetty-websocket/pom.xml +++ b/jetty-websocket/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-websocket/websocket-api/pom.xml b/jetty-websocket/websocket-api/pom.xml index e8a7b49e72f..03562a56af3 100644 --- a/jetty-websocket/websocket-api/pom.xml +++ b/jetty-websocket/websocket-api/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.websocket websocket-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/ExtensionFactory.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/ExtensionFactory.java index 81ebff5ba9e..f9341976e55 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/ExtensionFactory.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/ExtensionFactory.java @@ -32,17 +32,26 @@ import java.util.Set; @Deprecated public abstract class ExtensionFactory implements Iterable> { - private ServiceLoader extensionLoader = ServiceLoader.load(Extension.class); - private Map> availableExtensions; + private final Map> availableExtensions; public ExtensionFactory() { availableExtensions = new HashMap<>(); - for (Extension ext : extensionLoader) + Iterator iterator = ServiceLoader.load(Extension.class).iterator(); + while (true) { - if (ext != null) + try { - availableExtensions.put(ext.getName(), ext.getClass()); + if (!iterator.hasNext()) + break; + + Extension ext = iterator.next(); + if (ext != null) + availableExtensions.put(ext.getName(), ext.getClass()); + } + catch (Throwable ignored) + { + // Ignored. } } } diff --git a/jetty-websocket/websocket-client/pom.xml b/jetty-websocket/websocket-client/pom.xml index f76dfccfc07..48a72fb1b5e 100644 --- a/jetty-websocket/websocket-client/pom.xml +++ b/jetty-websocket/websocket-client/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.websocket websocket-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 @@ -24,6 +24,7 @@ org.eclipse.jetty jetty-xml ${project.version} + true org.eclipse.jetty diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/HttpClientProvider.java b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/HttpClientProvider.java index e2c89dab64d..bd91f697e66 100644 --- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/HttpClientProvider.java +++ b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/HttpClientProvider.java @@ -18,33 +18,16 @@ package org.eclipse.jetty.websocket.client; -import java.lang.reflect.Method; - import org.eclipse.jetty.client.HttpClient; -import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope; public final class HttpClientProvider { public static HttpClient get(WebSocketContainerScope scope) { - try - { - if (Class.forName("org.eclipse.jetty.xml.XmlConfiguration") != null) - { - Class xmlClazz = Class.forName("org.eclipse.jetty.websocket.client.XmlBasedHttpClientProvider"); - Method getMethod = xmlClazz.getMethod("get", WebSocketContainerScope.class); - Object ret = getMethod.invoke(null, scope); - if ((ret != null) && (ret instanceof HttpClient)) - { - return (HttpClient)ret; - } - } - } - catch (Throwable ignore) - { - Log.getLogger(HttpClientProvider.class).ignore(ignore); - } + HttpClient httpClient = XmlBasedHttpClientProvider.get(scope); + if (httpClient != null) + return httpClient; return DefaultHttpClientProvider.newHttpClient(scope); } diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/XmlBasedHttpClientProvider.java b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/XmlBasedHttpClientProvider.java index e4a7a09199f..b93f0f3bb89 100644 --- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/XmlBasedHttpClientProvider.java +++ b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/XmlBasedHttpClientProvider.java @@ -22,27 +22,46 @@ import java.net.URL; import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope; import org.eclipse.jetty.xml.XmlConfiguration; class XmlBasedHttpClientProvider { + public static final Logger LOG = Log.getLogger(XmlBasedHttpClientProvider.class); + public static HttpClient get(@SuppressWarnings("unused") WebSocketContainerScope scope) { - URL resource = Thread.currentThread().getContextClassLoader().getResource("jetty-websocket-httpclient.xml"); - if (resource == null) - { + ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); + if (contextClassLoader == null) + return null; + + URL resource = contextClassLoader.getResource("jetty-websocket-httpclient.xml"); + if (resource == null) return null; - } try { - XmlConfiguration configuration = new XmlConfiguration(resource); + Thread.currentThread().setContextClassLoader(HttpClient.class.getClassLoader()); + return newHttpClient(resource); + } + finally + { + Thread.currentThread().setContextClassLoader(contextClassLoader); + } + } + + private static HttpClient newHttpClient(URL resource) + { + try + { + XmlConfiguration configuration = new XmlConfiguration(Resource.newResource(resource)); return (HttpClient)configuration.configure(); } catch (Throwable t) { - Log.getLogger(XmlBasedHttpClientProvider.class).warn("Unable to load: " + resource, t); + LOG.warn("Failure to load HttpClient from XML {}", resource, t); } return null; diff --git a/jetty-websocket/websocket-common/pom.xml b/jetty-websocket/websocket-common/pom.xml index e3d7b715658..6240f785609 100644 --- a/jetty-websocket/websocket-common/pom.xml +++ b/jetty-websocket/websocket-common/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.websocket websocket-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-websocket/websocket-server/pom.xml b/jetty-websocket/websocket-server/pom.xml index 678c199e54d..2a2cec63809 100644 --- a/jetty-websocket/websocket-server/pom.xml +++ b/jetty-websocket/websocket-server/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.websocket websocket-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-websocket/websocket-servlet/pom.xml b/jetty-websocket/websocket-servlet/pom.xml index ea7bbe4f119..e3663eb1d85 100644 --- a/jetty-websocket/websocket-servlet/pom.xml +++ b/jetty-websocket/websocket-servlet/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.websocket websocket-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/jetty-xml/pom.xml b/jetty-xml/pom.xml index ea6e9ee8538..b3928128f3e 100644 --- a/jetty-xml/pom.xml +++ b/jetty-xml/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jetty-xml diff --git a/pom.xml b/pom.xml index 9abe5a8127e..f881dd28394 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT Jetty :: Project The Eclipse Jetty Project pom @@ -26,6 +26,8 @@ 1.1.3.v20160715 8.5.54 9.4.8.Final + 4.3.4.Final + 2.8.6 2.0.10 2.5.1 9.0 @@ -34,7 +36,7 @@ 1.4.0 5.7.0 3.6.3 - 1.3.1 + 1.6.1 3.1.0 3.1.5.Final 3.4.1.Final @@ -463,7 +465,7 @@ org.apache.maven.plugins maven-antrun-plugin - 1.8 + 3.0.0 org.apache.maven.plugins @@ -575,7 +577,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.2.0 8 UTF-8 @@ -726,7 +728,7 @@ org.asciidoctor asciidoctor-maven-plugin - 1.5.6 + 2.1.0 org.codehaus.mojo @@ -1154,7 +1156,7 @@ io.grpc grpc-core - 1.0.1 + 1.33.0 org.apache.ant diff --git a/tests/pom.xml b/tests/pom.xml index 5a9593494a5..d6aa9c817a0 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT ../pom.xml org.eclipse.jetty.tests diff --git a/tests/test-continuation/pom.xml b/tests/test-continuation/pom.xml index 64af455e280..792edd34b8f 100644 --- a/tests/test-continuation/pom.xml +++ b/tests/test-continuation/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.tests tests-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT ../pom.xml 4.0.0 diff --git a/tests/test-distribution/pom.xml b/tests/test-distribution/pom.xml index f6718611ce9..2edaa313664 100644 --- a/tests/test-distribution/pom.xml +++ b/tests/test-distribution/pom.xml @@ -2,7 +2,7 @@ tests-parent org.eclipse.jetty.tests - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 @@ -32,6 +32,21 @@ maven-resolver-provider ${maven.version} + + org.apache.maven.resolver + maven-resolver-util + ${maven.resolver.version} + + + org.apache.maven.resolver + maven-resolver-api + ${maven.resolver.version} + + + org.apache.maven.resolver + maven-resolver-spi + ${maven.resolver.version} + org.apache.maven.resolver maven-resolver-connector-basic @@ -102,6 +117,18 @@ ${project.version} test + + org.eclipse.jetty.websocket + websocket-api + ${project.version} + test + + + org.eclipse.jetty.websocket + websocket-client + ${project.version} + test + org.eclipse.jetty.tests test-felix-webapp diff --git a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/AbstractDistributionTest.java b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/AbstractDistributionTest.java index f4428f0f5c2..bb8d2b3e841 100644 --- a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/AbstractDistributionTest.java +++ b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/AbstractDistributionTest.java @@ -21,6 +21,7 @@ package org.eclipse.jetty.tests.distribution; import java.util.function.Supplier; import org.eclipse.jetty.client.HttpClient; +import org.eclipse.jetty.util.ssl.SslContextFactory; import org.junit.jupiter.api.AfterEach; public class AbstractDistributionTest @@ -29,7 +30,15 @@ public class AbstractDistributionTest protected void startHttpClient() throws Exception { - startHttpClient(HttpClient::new); + startHttpClient(false); + } + + protected void startHttpClient(boolean secure) throws Exception + { + if (secure) + startHttpClient(() -> new HttpClient(new SslContextFactory.Client(true))); + else + startHttpClient(HttpClient::new); } protected void startHttpClient(Supplier supplier) throws Exception diff --git a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DemoBaseTests.java b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DemoBaseTests.java index b5fb2eaf69f..57956fdc1e7 100644 --- a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DemoBaseTests.java +++ b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DemoBaseTests.java @@ -202,8 +202,11 @@ public class DemoBaseTests extends AbstractDistributionTest assertTrue(run.awaitConsoleLogsFor("Started @", 10, TimeUnit.SECONDS)); startHttpClient(); - ContentResponse response = client.GET("http://localhost:" + httpPort + "/test/hello"); - assertEquals(HttpStatus.OK_200, response.getStatus()); + ContentResponse helloResponse = client.GET("http://localhost:" + httpPort + "/test/hello"); + assertEquals(HttpStatus.OK_200, helloResponse.getStatus()); + + ContentResponse cssResponse = client.GET("http://localhost:" + httpPort + "/jetty-dir.css"); + assertEquals(HttpStatus.OK_200, cssResponse.getStatus()); } } diff --git a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DistributionTests.java b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DistributionTests.java index f1702270823..d89185bda5d 100644 --- a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DistributionTests.java +++ b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DistributionTests.java @@ -19,6 +19,7 @@ package org.eclipse.jetty.tests.distribution; import java.io.File; +import java.net.URI; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -39,6 +40,8 @@ import org.junit.jupiter.api.condition.DisabledOnJre; import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.JRE; import org.junit.jupiter.api.condition.OS; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; @@ -304,4 +307,103 @@ public class DistributionTests extends AbstractDistributionTest IO.delete(jettyBase.toFile()); } } + + @ParameterizedTest + @ValueSource(strings = {"http", "https"}) + public void testWebsocketClientInWebappProvidedByServer(String scheme) throws Exception + { + Path jettyBase = Files.createTempDirectory("jetty_base"); + String jettyVersion = System.getProperty("jettyVersion"); + DistributionTester distribution = DistributionTester.Builder.newInstance() + .jettyVersion(jettyVersion) + .jettyBase(jettyBase) + .mavenLocalRepository(System.getProperty("mavenRepoPath")) + .build(); + + String[] args1 = { + "--create-startd", + "--approve-all-licenses", + "--add-to-start=resources,server,webapp,deploy,jsp,jmx,servlet,servlets,websocket," + scheme + }; + try (DistributionTester.Run run1 = distribution.start(args1)) + { + assertTrue(run1.awaitFor(5, TimeUnit.SECONDS)); + assertEquals(0, run1.getExitValue()); + + File webApp = distribution.resolveArtifact("org.eclipse.jetty.tests:test-websocket-client-provided-webapp:war:" + jettyVersion); + distribution.installWarFile(webApp, "test"); + + int port = distribution.freePort(); + String[] args2 = { + "jetty.http.port=" + port, + "jetty.ssl.port=" + port, + // "jetty.server.dumpAfterStart=true", + }; + + try (DistributionTester.Run run2 = distribution.start(args2)) + { + assertTrue(run2.awaitConsoleLogsFor("Started @", 10, TimeUnit.SECONDS)); + + // We should get the correct configuration from the jetty-websocket-httpclient.xml file. + startHttpClient(scheme.equals("https")); + URI serverUri = URI.create(scheme + "://localhost:" + port + "/test"); + ContentResponse response = client.GET(serverUri); + assertEquals(HttpStatus.OK_200, response.getStatus()); + String content = response.getContentAsString(); + assertThat(content, containsString("WebSocketEcho: success")); + assertThat(content, containsString("ConnectTimeout: 4999")); + } + } + } + + @ParameterizedTest + @ValueSource(strings = {"http", "https"}) + public void testWebsocketClientInWebapp(String scheme) throws Exception + { + Path jettyBase = Files.createTempDirectory("jetty_base"); + String jettyVersion = System.getProperty("jettyVersion"); + DistributionTester distribution = DistributionTester.Builder.newInstance() + .jettyVersion(jettyVersion) + .jettyBase(jettyBase) + .mavenLocalRepository(System.getProperty("mavenRepoPath")) + .build(); + + String[] args1 = { + "--create-startd", + "--approve-all-licenses", + "--add-to-start=resources,server,webapp,deploy,jsp,jmx,servlet,servlets,websocket," + scheme + }; + try (DistributionTester.Run run1 = distribution.start(args1)) + { + assertTrue(run1.awaitFor(5, TimeUnit.SECONDS)); + assertEquals(0, run1.getExitValue()); + + File webApp = distribution.resolveArtifact("org.eclipse.jetty.tests:test-websocket-client-webapp:war:" + jettyVersion); + distribution.installWarFile(webApp, "test"); + + int port = distribution.freePort(); + String[] args2 = { + "jetty.http.port=" + port, + "jetty.ssl.port=" + port, + // We must hide the websocket classes from the webapp if we are to include websocket client jars in WEB-INF/lib. + "jetty.webapp.addServerClasses+=,+org.eclipse.jetty.websocket.", + "jetty.webapp.addSystemClasses+=,-org.eclipse.jetty.websocket.", + // "jetty.server.dumpAfterStart=true", + }; + + try (DistributionTester.Run run2 = distribution.start(args2)) + { + assertTrue(run2.awaitConsoleLogsFor("Started @", 10, TimeUnit.SECONDS)); + + // We should get the correct configuration from the jetty-websocket-httpclient.xml file. + startHttpClient(scheme.equals("https")); + URI serverUri = URI.create(scheme + "://localhost:" + port + "/test"); + ContentResponse response = client.GET(serverUri); + assertEquals(HttpStatus.OK_200, response.getStatus()); + String content = response.getContentAsString(); + assertThat(content, containsString("WebSocketEcho: success")); + assertThat(content, containsString("ConnectTimeout: 4999")); + } + } + } } diff --git a/tests/test-http-client-transport/pom.xml b/tests/test-http-client-transport/pom.xml index b3020edbbc0..4db7d2e3a0b 100644 --- a/tests/test-http-client-transport/pom.xml +++ b/tests/test-http-client-transport/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.tests tests-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml index 8365326f36b..ec74ebb9130 100644 --- a/tests/test-integration/pom.xml +++ b/tests/test-integration/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.tests tests-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 test-integration diff --git a/tests/test-jmx/jmx-webapp-it/pom.xml b/tests/test-jmx/jmx-webapp-it/pom.xml index cdf9b3f44a5..a1b4a7dce3a 100644 --- a/tests/test-jmx/jmx-webapp-it/pom.xml +++ b/tests/test-jmx/jmx-webapp-it/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.tests test-jmx-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 jmx-webapp-it diff --git a/tests/test-jmx/jmx-webapp/pom.xml b/tests/test-jmx/jmx-webapp/pom.xml index 57d8efbe003..8801d5187e8 100644 --- a/tests/test-jmx/jmx-webapp/pom.xml +++ b/tests/test-jmx/jmx-webapp/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests test-jmx-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT jmx-webapp war diff --git a/tests/test-jmx/pom.xml b/tests/test-jmx/pom.xml index 736e848987a..9f495ce54d9 100644 --- a/tests/test-jmx/pom.xml +++ b/tests/test-jmx/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.tests tests-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 test-jmx-parent diff --git a/tests/test-loginservice/pom.xml b/tests/test-loginservice/pom.xml index 021ba05eb73..ce644f84e79 100644 --- a/tests/test-loginservice/pom.xml +++ b/tests/test-loginservice/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests tests-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT test-loginservice Jetty Tests :: Login Service diff --git a/tests/test-quickstart/pom.xml b/tests/test-quickstart/pom.xml index db4c32b37f7..7a6fcbc4a84 100644 --- a/tests/test-quickstart/pom.xml +++ b/tests/test-quickstart/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.tests tests-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT ../pom.xml 4.0.0 diff --git a/tests/test-sessions/pom.xml b/tests/test-sessions/pom.xml index 227ca989049..9c32d2653f5 100644 --- a/tests/test-sessions/pom.xml +++ b/tests/test-sessions/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests tests-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT test-sessions-parent Jetty Tests :: Sessions :: Parent diff --git a/tests/test-sessions/test-file-sessions/pom.xml b/tests/test-sessions/test-file-sessions/pom.xml index 2164a3ab542..3aaafd382ec 100644 --- a/tests/test-sessions/test-file-sessions/pom.xml +++ b/tests/test-sessions/test-file-sessions/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests test-sessions-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT test-file-sessions Jetty Tests :: Sessions :: File diff --git a/tests/test-sessions/test-gcloud-sessions/pom.xml b/tests/test-sessions/test-gcloud-sessions/pom.xml index bce88380e4e..606509801db 100644 --- a/tests/test-sessions/test-gcloud-sessions/pom.xml +++ b/tests/test-sessions/test-gcloud-sessions/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests test-sessions-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT test-gcloud-sessions Jetty Tests :: Sessions :: GCloud diff --git a/tests/test-sessions/test-hazelcast-sessions/pom.xml b/tests/test-sessions/test-hazelcast-sessions/pom.xml index c6da70f57af..a891fa39f27 100644 --- a/tests/test-sessions/test-hazelcast-sessions/pom.xml +++ b/tests/test-sessions/test-hazelcast-sessions/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests test-sessions-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT test-hazelcast-sessions Jetty Tests :: Sessions :: Hazelcast diff --git a/tests/test-sessions/test-infinispan-sessions/pom.xml b/tests/test-sessions/test-infinispan-sessions/pom.xml index a76f441b583..1faf12950d4 100644 --- a/tests/test-sessions/test-infinispan-sessions/pom.xml +++ b/tests/test-sessions/test-infinispan-sessions/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests test-sessions-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT test-infinispan-sessions Jetty Tests :: Sessions :: Infinispan @@ -126,7 +126,13 @@ org.infinispan.protostream protostream - 4.2.2.Final + ${infinispan.protostream.version} + test + + + com.google.code.gson + gson + ${gson.version} test diff --git a/tests/test-sessions/test-jdbc-sessions/pom.xml b/tests/test-sessions/test-jdbc-sessions/pom.xml index d38ef82fb85..4ce332db26d 100644 --- a/tests/test-sessions/test-jdbc-sessions/pom.xml +++ b/tests/test-sessions/test-jdbc-sessions/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests test-sessions-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT test-jdbc-sessions Jetty Tests :: Sessions :: JDBC @@ -83,7 +83,7 @@ org.mariadb.jdbc mariadb-java-client - 2.6.0 + 2.7.0 test diff --git a/tests/test-sessions/test-memcached-sessions/pom.xml b/tests/test-sessions/test-memcached-sessions/pom.xml index 668e4f5cc93..784e8672e92 100644 --- a/tests/test-sessions/test-memcached-sessions/pom.xml +++ b/tests/test-sessions/test-memcached-sessions/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests test-sessions-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT test-memcached-sessions Jetty Tests :: Sessions :: Memcached diff --git a/tests/test-sessions/test-mongodb-sessions/pom.xml b/tests/test-sessions/test-mongodb-sessions/pom.xml index 793eb26875b..7fc62c95fd8 100644 --- a/tests/test-sessions/test-mongodb-sessions/pom.xml +++ b/tests/test-sessions/test-mongodb-sessions/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests test-sessions-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT test-mongodb-sessions Jetty Tests :: Sessions :: Mongo diff --git a/tests/test-sessions/test-sessions-common/pom.xml b/tests/test-sessions/test-sessions-common/pom.xml index 36b1adae281..3a177247ae9 100644 --- a/tests/test-sessions/test-sessions-common/pom.xml +++ b/tests/test-sessions/test-sessions-common/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests test-sessions-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT test-sessions-common Jetty Tests :: Sessions :: Common diff --git a/tests/test-webapps/pom.xml b/tests/test-webapps/pom.xml index ec73057e341..ecb57de631e 100644 --- a/tests/test-webapps/pom.xml +++ b/tests/test-webapps/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests tests-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT ../pom.xml test-webapps-parent @@ -43,5 +43,7 @@ test-cdi-common-webapp test-weld-cdi-webapp test-owb-cdi-webapp + test-websocket-client-webapp + test-websocket-client-provided-webapp diff --git a/tests/test-webapps/test-cdi-common-webapp/pom.xml b/tests/test-webapps/test-cdi-common-webapp/pom.xml index 922b6ada194..215a1d6a029 100644 --- a/tests/test-webapps/test-cdi-common-webapp/pom.xml +++ b/tests/test-webapps/test-cdi-common-webapp/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.tests test-webapps-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/tests/test-webapps/test-felix-webapp/pom.xml b/tests/test-webapps/test-felix-webapp/pom.xml index 394bfbf8c8b..78179b3f355 100644 --- a/tests/test-webapps/test-felix-webapp/pom.xml +++ b/tests/test-webapps/test-felix-webapp/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.tests test-webapps-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/tests/test-webapps/test-http2-webapp/pom.xml b/tests/test-webapps/test-http2-webapp/pom.xml index 102fb0f39ec..b7ed1071569 100644 --- a/tests/test-webapps/test-http2-webapp/pom.xml +++ b/tests/test-webapps/test-http2-webapp/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.tests test-webapps-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 diff --git a/tests/test-webapps/test-jaas-webapp/pom.xml b/tests/test-webapps/test-jaas-webapp/pom.xml index b0a5026f07d..4071e7b8260 100644 --- a/tests/test-webapps/test-jaas-webapp/pom.xml +++ b/tests/test-webapps/test-jaas-webapp/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests test-webapps-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT test-jaas-webapp Jetty Tests :: WebApp :: JAAS diff --git a/tests/test-webapps/test-jetty-webapp/pom.xml b/tests/test-webapps/test-jetty-webapp/pom.xml index 1c320f8adb6..51791c1b2f0 100644 --- a/tests/test-webapps/test-jetty-webapp/pom.xml +++ b/tests/test-webapps/test-jetty-webapp/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.tests test-webapps-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT ../pom.xml 4.0.0 diff --git a/tests/test-webapps/test-jndi-webapp/pom.xml b/tests/test-webapps/test-jndi-webapp/pom.xml index 0d30fe3028e..ca1f315c39b 100644 --- a/tests/test-webapps/test-jndi-webapp/pom.xml +++ b/tests/test-webapps/test-jndi-webapp/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests test-webapps-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT test-jndi-webapp Jetty Tests :: WebApp :: JNDI @@ -29,14 +29,14 @@ generate-xml-files process-resources - + - + run diff --git a/tests/test-webapps/test-mock-resources/pom.xml b/tests/test-webapps/test-mock-resources/pom.xml index a9d666689fa..748386ec010 100644 --- a/tests/test-webapps/test-mock-resources/pom.xml +++ b/tests/test-webapps/test-mock-resources/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.tests test-webapps-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT Jetty Tests :: WebApp :: Mock Resources test-mock-resources diff --git a/tests/test-webapps/test-owb-cdi-webapp/pom.xml b/tests/test-webapps/test-owb-cdi-webapp/pom.xml index 03246d0cec1..9876e7bd2fd 100644 --- a/tests/test-webapps/test-owb-cdi-webapp/pom.xml +++ b/tests/test-webapps/test-owb-cdi-webapp/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.tests test-webapps-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0 @@ -13,7 +13,7 @@ ${project.groupId}.cdi.owb - 2.0.18 + 2.0.19 @@ -40,7 +40,7 @@ org.apache.geronimo.specs geronimo-annotation_1.3_spec - 1.1 + 1.3 org.apache.geronimo.specs diff --git a/tests/test-webapps/test-proxy-webapp/pom.xml b/tests/test-webapps/test-proxy-webapp/pom.xml index 7c434eb60a0..f2daf296a1e 100644 --- a/tests/test-webapps/test-proxy-webapp/pom.xml +++ b/tests/test-webapps/test-proxy-webapp/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.tests test-webapps-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT ../pom.xml 4.0.0 diff --git a/tests/test-webapps/test-servlet-spec/pom.xml b/tests/test-webapps/test-servlet-spec/pom.xml index 69857dcb9d7..1a3654eb216 100644 --- a/tests/test-webapps/test-servlet-spec/pom.xml +++ b/tests/test-webapps/test-servlet-spec/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests test-webapps-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT test-servlet-spec-parent Jetty Tests :: Spec Test WebApp :: Parent diff --git a/tests/test-webapps/test-servlet-spec/test-container-initializer/pom.xml b/tests/test-webapps/test-servlet-spec/test-container-initializer/pom.xml index 97118c437ee..7513470d4d8 100644 --- a/tests/test-webapps/test-servlet-spec/test-container-initializer/pom.xml +++ b/tests/test-webapps/test-servlet-spec/test-container-initializer/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.tests test-servlet-spec-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT test-container-initializer jar diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml b/tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml index b0f04aa29e1..26666938060 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests test-servlet-spec-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT Jetty Tests :: Webapps :: Spec Webapp test-spec-webapp @@ -92,14 +92,14 @@ generate-xml-files process-resources - + - + run diff --git a/tests/test-webapps/test-servlet-spec/test-web-fragment/pom.xml b/tests/test-webapps/test-servlet-spec/test-web-fragment/pom.xml index cc8bfc47d5d..94a2e79e84d 100644 --- a/tests/test-webapps/test-servlet-spec/test-web-fragment/pom.xml +++ b/tests/test-webapps/test-servlet-spec/test-web-fragment/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.tests test-servlet-spec-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT Jetty Tests :: WebApp :: Servlet Spec :: Fragment Jar diff --git a/tests/test-webapps/test-simple-webapp/pom.xml b/tests/test-webapps/test-simple-webapp/pom.xml index ba7d13d5820..a19600394ad 100644 --- a/tests/test-webapps/test-simple-webapp/pom.xml +++ b/tests/test-webapps/test-simple-webapp/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests test-webapps-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT test-simple-webapp diff --git a/tests/test-webapps/test-webapp-rfc2616/pom.xml b/tests/test-webapps/test-webapp-rfc2616/pom.xml index 3f84697ad40..7011dae4bc9 100644 --- a/tests/test-webapps/test-webapp-rfc2616/pom.xml +++ b/tests/test-webapps/test-webapp-rfc2616/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests test-webapps-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT test-webapp-rfc2616 Jetty Tests :: WebApp :: RFC2616 diff --git a/tests/test-webapps/test-websocket-client-provided-webapp/pom.xml b/tests/test-webapps/test-websocket-client-provided-webapp/pom.xml new file mode 100644 index 00000000000..d4463bfbf55 --- /dev/null +++ b/tests/test-webapps/test-websocket-client-provided-webapp/pom.xml @@ -0,0 +1,33 @@ + + + + org.eclipse.jetty.tests + test-webapps-parent + 9.4.35-SNAPSHOT + + + 4.0.0 + test-websocket-client-provided-webapp + war + + Test :: Jetty Websocket Simple Webapp with WebSocketClient + + + + javax.servlet + javax.servlet-api + provided + + + javax.websocket + javax.websocket-api + provided + + + org.eclipse.jetty.websocket + websocket-client + ${project.version} + provided + + + diff --git a/tests/test-webapps/test-websocket-client-provided-webapp/src/main/java/org/eclipse/jetty/tests/webapp/websocket/EchoEndpoint.java b/tests/test-webapps/test-websocket-client-provided-webapp/src/main/java/org/eclipse/jetty/tests/webapp/websocket/EchoEndpoint.java new file mode 100644 index 00000000000..2120c5d7cca --- /dev/null +++ b/tests/test-webapps/test-websocket-client-provided-webapp/src/main/java/org/eclipse/jetty/tests/webapp/websocket/EchoEndpoint.java @@ -0,0 +1,32 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.tests.webapp.websocket; + +import javax.websocket.OnMessage; +import javax.websocket.server.ServerEndpoint; + +@ServerEndpoint(value = "/echo") +public class EchoEndpoint +{ + @OnMessage + public String echo(String message) + { + return message; + } +} diff --git a/tests/test-webapps/test-websocket-client-provided-webapp/src/main/java/org/eclipse/jetty/tests/webapp/websocket/WebSocketClientServlet.java b/tests/test-webapps/test-websocket-client-provided-webapp/src/main/java/org/eclipse/jetty/tests/webapp/websocket/WebSocketClientServlet.java new file mode 100644 index 00000000000..8dbbc957b84 --- /dev/null +++ b/tests/test-webapps/test-websocket-client-provided-webapp/src/main/java/org/eclipse/jetty/tests/webapp/websocket/WebSocketClientServlet.java @@ -0,0 +1,133 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.tests.webapp.websocket; + +import java.io.PrintWriter; +import java.lang.reflect.Method; +import java.net.URI; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.eclipse.jetty.websocket.api.Session; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; +import org.eclipse.jetty.websocket.api.util.WSURI; +import org.eclipse.jetty.websocket.client.WebSocketClient; + +@WebServlet("/") +public class WebSocketClientServlet extends HttpServlet +{ + private WebSocketClient client; + + @Override + public void init() throws ServletException + { + // Cannot instantiate an HttpClient here because it's a server class, and therefore must rely on jetty-websocket-httpclient.xml + client = new WebSocketClient(); + + try + { + client.start(); + } + catch (Exception e) + { + throw new ServletException(e); + } + } + + @Override + public void destroy() + { + try + { + client.stop(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) + { + try + { + resp.setContentType("text/html"); + + // Send and receive a websocket echo on the same server. + ClientSocket clientSocket = new ClientSocket(); + URI wsUri = WSURI.toWebsocket(req.getRequestURL()).resolve("echo"); + client.connect(clientSocket, wsUri).get(5, TimeUnit.SECONDS); + clientSocket.session.getRemote().sendString("test message"); + String response = clientSocket.textMessages.poll(5, TimeUnit.SECONDS); + clientSocket.session.close(); + clientSocket.closeLatch.await(5, TimeUnit.SECONDS); + + PrintWriter writer = resp.getWriter(); + writer.println("WebSocketEcho: " + ("test message".equals(response) ? "success" : "failure")); + writer.println("WebSocketEcho: success"); + + // We need to test HttpClient timeout with reflection because it is a server class not exposed to the webapp. + Object httpClient = client.getHttpClient(); + Method getConnectTimeout = httpClient.getClass().getMethod("getConnectTimeout"); + writer.println("ConnectTimeout: " + getConnectTimeout.invoke(httpClient)); + } + catch (Exception e) + { + throw new RuntimeException(e); + } + } + + @WebSocket + public static class ClientSocket + { + public Session session; + public CountDownLatch openLatch = new CountDownLatch(1); + public CountDownLatch closeLatch = new CountDownLatch(1); + public ArrayBlockingQueue textMessages = new ArrayBlockingQueue<>(10); + + @OnWebSocketConnect + public void onOpen(Session session) + { + this.session = session; + openLatch.countDown(); + } + + @OnWebSocketMessage + public void onMessage(String message) + { + textMessages.add(message); + } + + @OnWebSocketClose + public void onClose(int statusCode, String reason) + { + closeLatch.countDown(); + } + } +} diff --git a/tests/test-webapps/test-websocket-client-provided-webapp/src/main/resources/jetty-websocket-httpclient.xml b/tests/test-webapps/test-websocket-client-provided-webapp/src/main/resources/jetty-websocket-httpclient.xml new file mode 100644 index 00000000000..49b65a05746 --- /dev/null +++ b/tests/test-webapps/test-websocket-client-provided-webapp/src/main/resources/jetty-websocket-httpclient.xml @@ -0,0 +1,10 @@ + + + + + + true + + + 4999 + diff --git a/tests/test-webapps/test-websocket-client-provided-webapp/src/main/webapp/WEB-INF/web.xml b/tests/test-webapps/test-websocket-client-provided-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000000..99907fad52a --- /dev/null +++ b/tests/test-webapps/test-websocket-client-provided-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,8 @@ + + + diff --git a/tests/test-webapps/test-websocket-client-webapp/pom.xml b/tests/test-webapps/test-websocket-client-webapp/pom.xml new file mode 100644 index 00000000000..da831550f03 --- /dev/null +++ b/tests/test-webapps/test-websocket-client-webapp/pom.xml @@ -0,0 +1,32 @@ + + + + org.eclipse.jetty.tests + test-webapps-parent + 9.4.35-SNAPSHOT + + + 4.0.0 + test-websocket-client-webapp + war + + Test :: Jetty Websocket Simple Webapp with WebSocketClient + + + + javax.servlet + javax.servlet-api + provided + + + javax.websocket + javax.websocket-api + provided + + + org.eclipse.jetty.websocket + websocket-client + ${project.version} + + + diff --git a/tests/test-webapps/test-websocket-client-webapp/src/main/java/org/eclipse/jetty/tests/webapp/websocket/EchoEndpoint.java b/tests/test-webapps/test-websocket-client-webapp/src/main/java/org/eclipse/jetty/tests/webapp/websocket/EchoEndpoint.java new file mode 100644 index 00000000000..2120c5d7cca --- /dev/null +++ b/tests/test-webapps/test-websocket-client-webapp/src/main/java/org/eclipse/jetty/tests/webapp/websocket/EchoEndpoint.java @@ -0,0 +1,32 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.tests.webapp.websocket; + +import javax.websocket.OnMessage; +import javax.websocket.server.ServerEndpoint; + +@ServerEndpoint(value = "/echo") +public class EchoEndpoint +{ + @OnMessage + public String echo(String message) + { + return message; + } +} diff --git a/tests/test-webapps/test-websocket-client-webapp/src/main/java/org/eclipse/jetty/tests/webapp/websocket/WebSocketClientServlet.java b/tests/test-webapps/test-websocket-client-webapp/src/main/java/org/eclipse/jetty/tests/webapp/websocket/WebSocketClientServlet.java new file mode 100644 index 00000000000..36401a42e88 --- /dev/null +++ b/tests/test-webapps/test-websocket-client-webapp/src/main/java/org/eclipse/jetty/tests/webapp/websocket/WebSocketClientServlet.java @@ -0,0 +1,133 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.tests.webapp.websocket; + +import java.io.PrintWriter; +import java.net.URI; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.eclipse.jetty.client.HttpClient; +import org.eclipse.jetty.util.ssl.SslContextFactory; +import org.eclipse.jetty.websocket.api.Session; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; +import org.eclipse.jetty.websocket.api.util.WSURI; +import org.eclipse.jetty.websocket.client.WebSocketClient; + +@WebServlet("/") +public class WebSocketClientServlet extends HttpServlet +{ + private WebSocketClient client; + + @Override + public void init() throws ServletException + { + // We can't use the jetty-websocket-httpclient.xml if the websocket client jars are in WEB-INF/lib. + SslContextFactory.Client sslContextFactory = new SslContextFactory.Client(true); + HttpClient httpClient = new HttpClient(sslContextFactory); + httpClient.setConnectTimeout(4999); + this.client = new WebSocketClient(httpClient); + + try + { + this.client.start(); + } + catch (Exception e) + { + throw new ServletException(e); + } + } + + @Override + public void destroy() + { + try + { + client.stop(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) + { + try + { + resp.setContentType("text/html"); + + // Send and receive a websocket echo on the same server. + ClientSocket clientSocket = new ClientSocket(); + URI wsUri = WSURI.toWebsocket(req.getRequestURL()).resolve("echo"); + client.connect(clientSocket, wsUri).get(5, TimeUnit.SECONDS); + clientSocket.session.getRemote().sendString("test message"); + String response = clientSocket.textMessages.poll(5, TimeUnit.SECONDS); + clientSocket.session.close(); + clientSocket.closeLatch.await(5, TimeUnit.SECONDS); + + PrintWriter writer = resp.getWriter(); + writer.println("WebSocketEcho: " + ("test message".equals(response) ? "success" : "failure")); + writer.println("WebSocketEcho: success"); + writer.println("ConnectTimeout: " + client.getHttpClient().getConnectTimeout()); + } + catch (Exception e) + { + throw new RuntimeException(e); + } + } + + @WebSocket + public static class ClientSocket + { + public Session session; + public CountDownLatch openLatch = new CountDownLatch(1); + public CountDownLatch closeLatch = new CountDownLatch(1); + public ArrayBlockingQueue textMessages = new ArrayBlockingQueue<>(10); + + @OnWebSocketConnect + public void onOpen(Session session) + { + this.session = session; + openLatch.countDown(); + } + + @OnWebSocketMessage + public void onMessage(String message) + { + textMessages.add(message); + } + + @OnWebSocketClose + public void onClose(int statusCode, String reason) + { + closeLatch.countDown(); + } + } +} diff --git a/tests/test-webapps/test-websocket-client-webapp/src/main/webapp/WEB-INF/web.xml b/tests/test-webapps/test-websocket-client-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000000..99907fad52a --- /dev/null +++ b/tests/test-webapps/test-websocket-client-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,8 @@ + + + diff --git a/tests/test-webapps/test-weld-cdi-webapp/pom.xml b/tests/test-webapps/test-weld-cdi-webapp/pom.xml index a72ad4b0d17..a70965a307d 100644 --- a/tests/test-webapps/test-weld-cdi-webapp/pom.xml +++ b/tests/test-webapps/test-weld-cdi-webapp/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.tests test-webapps-parent - 9.4.34-SNAPSHOT + 9.4.35-SNAPSHOT 4.0.0