From 83781bce8de95cd23371e947f44e3aab03250a55 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Mon, 10 Sep 2012 12:57:18 -0500 Subject: [PATCH 01/56] prepare for release --- VERSION.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index e1404c07221..15f22f5c46e 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,4 +1,6 @@ -jetty-7.6.7-SNAPSHOT +jetty-7.6.7-SNAPSHOT - 10 September 2012 + + 388895 Update dependencies for jetty-jndi + + fix busy logging statement re: sessions jetty-7.6.6.v20120903 - 03 September 2012 + 347130 Empty getResourcePaths due to ZipFileClosedException From 4180d7e1f565a80f36ff43025588a2ea05aa1442 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Mon, 10 Sep 2012 12:59:04 -0500 Subject: [PATCH 02/56] prepare for release --- VERSION.txt | 2 +- example-jetty-embedded/pom.xml | 2 +- jetty-aggregate/jetty-all-server/pom.xml | 2 +- jetty-aggregate/jetty-all/pom.xml | 2 +- jetty-aggregate/jetty-client/pom.xml | 2 +- jetty-aggregate/jetty-plus/pom.xml | 2 +- jetty-aggregate/jetty-server/pom.xml | 2 +- jetty-aggregate/jetty-servlet/pom.xml | 2 +- jetty-aggregate/jetty-webapp/pom.xml | 2 +- jetty-aggregate/jetty-websocket/pom.xml | 2 +- jetty-aggregate/pom.xml | 2 +- jetty-ajp/pom.xml | 2 +- jetty-annotations/pom.xml | 2 +- jetty-client/pom.xml | 2 +- jetty-continuation/pom.xml | 2 +- jetty-deploy/pom.xml | 2 +- jetty-distribution/pom.xml | 2 +- jetty-http-spi/pom.xml | 2 +- jetty-http/pom.xml | 2 +- jetty-io/pom.xml | 2 +- jetty-jaspi/pom.xml | 2 +- jetty-jmx/pom.xml | 2 +- jetty-jndi/pom.xml | 2 +- jetty-jsp/pom.xml | 2 +- jetty-monitor/pom.xml | 2 +- jetty-nested/pom.xml | 2 +- jetty-nosql/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-jsp/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-logback/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-warurl/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot/pom.xml | 2 +- jetty-osgi/jetty-osgi-equinoxtools/pom.xml | 2 +- jetty-osgi/jetty-osgi-httpservice/pom.xml | 2 +- jetty-osgi/pom.xml | 2 +- jetty-osgi/test-jetty-osgi-context/pom.xml | 2 +- jetty-osgi/test-jetty-osgi-webapp/pom.xml | 2 +- jetty-osgi/test-jetty-osgi/pom.xml | 2 +- jetty-overlay-deployer/pom.xml | 2 +- jetty-plus/pom.xml | 2 +- jetty-policy/pom.xml | 2 +- jetty-rewrite/pom.xml | 2 +- jetty-security/pom.xml | 2 +- jetty-server/pom.xml | 2 +- jetty-servlet/pom.xml | 2 +- jetty-servlets/pom.xml | 2 +- jetty-spdy/pom.xml | 2 +- jetty-spdy/spdy-core/pom.xml | 2 +- jetty-spdy/spdy-jetty-http-webapp/pom.xml | 2 +- jetty-spdy/spdy-jetty-http/pom.xml | 2 +- jetty-spdy/spdy-jetty/pom.xml | 2 +- jetty-start/pom.xml | 2 +- jetty-util/pom.xml | 2 +- jetty-webapp/pom.xml | 2 +- jetty-websocket/pom.xml | 2 +- jetty-xml/pom.xml | 2 +- pom.xml | 2 +- test-continuation/pom.xml | 2 +- test-jetty-nested/pom.xml | 2 +- test-jetty-servlet/pom.xml | 2 +- test-jetty-webapp/pom.xml | 2 +- tests/pom.xml | 2 +- tests/test-integration/pom.xml | 2 +- tests/test-loginservice/pom.xml | 2 +- tests/test-sessions/pom.xml | 2 +- tests/test-sessions/test-hash-sessions/pom.xml | 2 +- tests/test-sessions/test-jdbc-sessions/pom.xml | 2 +- tests/test-sessions/test-mongodb-sessions/pom.xml | 2 +- tests/test-sessions/test-sessions-common/pom.xml | 2 +- tests/test-webapps/pom.xml | 2 +- tests/test-webapps/test-webapp-rfc2616/pom.xml | 2 +- 70 files changed, 70 insertions(+), 70 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 15f22f5c46e..f8f836b1b8f 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,4 +1,4 @@ -jetty-7.6.7-SNAPSHOT - 10 September 2012 +jetty-7.6.7.v20120910 - 10 September 2012 + 388895 Update dependencies for jetty-jndi + fix busy logging statement re: sessions diff --git a/example-jetty-embedded/pom.xml b/example-jetty-embedded/pom.xml index 5cb2f9ff3c2..531d1c03628 100644 --- a/example-jetty-embedded/pom.xml +++ b/example-jetty-embedded/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 example-jetty-embedded diff --git a/jetty-aggregate/jetty-all-server/pom.xml b/jetty-aggregate/jetty-all-server/pom.xml index 3e0f62559f9..5c7dda10c42 100644 --- a/jetty-aggregate/jetty-all-server/pom.xml +++ b/jetty-aggregate/jetty-all-server/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-all-server diff --git a/jetty-aggregate/jetty-all/pom.xml b/jetty-aggregate/jetty-all/pom.xml index b6692fcffe4..09dc8a69b4a 100644 --- a/jetty-aggregate/jetty-all/pom.xml +++ b/jetty-aggregate/jetty-all/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-all diff --git a/jetty-aggregate/jetty-client/pom.xml b/jetty-aggregate/jetty-client/pom.xml index 4a8c793d1f0..4eb71f66795 100644 --- a/jetty-aggregate/jetty-client/pom.xml +++ b/jetty-aggregate/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-client diff --git a/jetty-aggregate/jetty-plus/pom.xml b/jetty-aggregate/jetty-plus/pom.xml index 7087e7df3c9..9b79030833c 100644 --- a/jetty-aggregate/jetty-plus/pom.xml +++ b/jetty-aggregate/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-plus diff --git a/jetty-aggregate/jetty-server/pom.xml b/jetty-aggregate/jetty-server/pom.xml index 19379127025..fdb66eb9e60 100644 --- a/jetty-aggregate/jetty-server/pom.xml +++ b/jetty-aggregate/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-server diff --git a/jetty-aggregate/jetty-servlet/pom.xml b/jetty-aggregate/jetty-servlet/pom.xml index b595e2adcce..423a728f71a 100644 --- a/jetty-aggregate/jetty-servlet/pom.xml +++ b/jetty-aggregate/jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-servlet diff --git a/jetty-aggregate/jetty-webapp/pom.xml b/jetty-aggregate/jetty-webapp/pom.xml index cf18d271e06..febfe9f7fc6 100644 --- a/jetty-aggregate/jetty-webapp/pom.xml +++ b/jetty-aggregate/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-webapp diff --git a/jetty-aggregate/jetty-websocket/pom.xml b/jetty-aggregate/jetty-websocket/pom.xml index e9662707a21..a1ebe25fbeb 100644 --- a/jetty-aggregate/jetty-websocket/pom.xml +++ b/jetty-aggregate/jetty-websocket/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-websocket diff --git a/jetty-aggregate/pom.xml b/jetty-aggregate/pom.xml index f0171f8a888..8ddb23c3c34 100644 --- a/jetty-aggregate/pom.xml +++ b/jetty-aggregate/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 org.eclipse.jetty.aggregate jetty-aggregate-project diff --git a/jetty-ajp/pom.xml b/jetty-ajp/pom.xml index 21e24e4e352..a95cfd2e3b2 100644 --- a/jetty-ajp/pom.xml +++ b/jetty-ajp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-ajp diff --git a/jetty-annotations/pom.xml b/jetty-annotations/pom.xml index cfbbe72a4eb..ab97853d3dd 100644 --- a/jetty-annotations/pom.xml +++ b/jetty-annotations/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-annotations diff --git a/jetty-client/pom.xml b/jetty-client/pom.xml index faa1b8172bf..be69c6b7151 100644 --- a/jetty-client/pom.xml +++ b/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 diff --git a/jetty-continuation/pom.xml b/jetty-continuation/pom.xml index 991aa76c0d5..56a15dde859 100644 --- a/jetty-continuation/pom.xml +++ b/jetty-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-continuation diff --git a/jetty-deploy/pom.xml b/jetty-deploy/pom.xml index 69d497c66f7..a901c14a809 100644 --- a/jetty-deploy/pom.xml +++ b/jetty-deploy/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-deploy diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index d5fd87e35a3..349c4088380 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 jetty-distribution Jetty :: Distribution Assemblies diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml index e6c35f8d0f4..79e095989c6 100644 --- a/jetty-http-spi/pom.xml +++ b/jetty-http-spi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-http-spi diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml index a6cb2d0e58a..7459eafc211 100644 --- a/jetty-http/pom.xml +++ b/jetty-http/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-http diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml index 895c23bb1f8..75a8a22781d 100644 --- a/jetty-io/pom.xml +++ b/jetty-io/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-io diff --git a/jetty-jaspi/pom.xml b/jetty-jaspi/pom.xml index 6b69970851d..790ddbb695d 100644 --- a/jetty-jaspi/pom.xml +++ b/jetty-jaspi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-jaspi diff --git a/jetty-jmx/pom.xml b/jetty-jmx/pom.xml index b92c04abf7e..d5257a8414d 100644 --- a/jetty-jmx/pom.xml +++ b/jetty-jmx/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-jmx diff --git a/jetty-jndi/pom.xml b/jetty-jndi/pom.xml index 42758eb5ab0..6298f9cea1e 100644 --- a/jetty-jndi/pom.xml +++ b/jetty-jndi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-jndi diff --git a/jetty-jsp/pom.xml b/jetty-jsp/pom.xml index db7f44a657d..e10c723c271 100644 --- a/jetty-jsp/pom.xml +++ b/jetty-jsp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-jsp diff --git a/jetty-monitor/pom.xml b/jetty-monitor/pom.xml index a2d8f4f2070..48bf0abddb5 100644 --- a/jetty-monitor/pom.xml +++ b/jetty-monitor/pom.xml @@ -19,7 +19,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-monitor diff --git a/jetty-nested/pom.xml b/jetty-nested/pom.xml index 372653f71ad..90bbd5894c2 100644 --- a/jetty-nested/pom.xml +++ b/jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 jetty-nested Jetty :: Nested diff --git a/jetty-nosql/pom.xml b/jetty-nosql/pom.xml index 8f9b847627e..215bc73b9ba 100644 --- a/jetty-nosql/pom.xml +++ b/jetty-nosql/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-nosql diff --git a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml index 55cd3f2d3d1..c50421e9c47 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 - 7.6.7-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-logback/pom.xml b/jetty-osgi/jetty-osgi-boot-logback/pom.xml index 16902267aa6..8a934cded4c 100644 --- a/jetty-osgi/jetty-osgi-boot-logback/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-logback/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml index e6f50111ebc..213a0c4bfb3 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 - 7.6.7-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot/pom.xml b/jetty-osgi/jetty-osgi-boot/pom.xml index b074f95ba5e..816b6ea7474 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 - 7.6.7-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml index 6e07c4aa389..a16c0787fe0 100644 --- a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml +++ b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-httpservice/pom.xml b/jetty-osgi/jetty-osgi-httpservice/pom.xml index 250455c046a..301b01bc043 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 - 7.6.7-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-osgi/pom.xml b/jetty-osgi/pom.xml index 0d9f7bdb759..4043c6d9162 100644 --- a/jetty-osgi/pom.xml +++ b/jetty-osgi/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 ../pom.xml org.eclipse.jetty.osgi diff --git a/jetty-osgi/test-jetty-osgi-context/pom.xml b/jetty-osgi/test-jetty-osgi-context/pom.xml index 18f2b88e7b6..911eb4cef93 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 - 7.6.7-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-osgi/test-jetty-osgi-webapp/pom.xml b/jetty-osgi/test-jetty-osgi-webapp/pom.xml index e90225320f2..f389300df2c 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 - 7.6.7-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml index e42e1cdc51d..63f8ca07395 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 - 7.6.7-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-overlay-deployer/pom.xml b/jetty-overlay-deployer/pom.xml index 8a447cdfb78..505a01e3e0a 100644 --- a/jetty-overlay-deployer/pom.xml +++ b/jetty-overlay-deployer/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-overlay-deployer diff --git a/jetty-plus/pom.xml b/jetty-plus/pom.xml index 1a635415401..86d1286444c 100644 --- a/jetty-plus/pom.xml +++ b/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-plus diff --git a/jetty-policy/pom.xml b/jetty-policy/pom.xml index 8d8c7425f5d..4c3e65aa94e 100644 --- a/jetty-policy/pom.xml +++ b/jetty-policy/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 jetty-policy Jetty :: Policy Tool diff --git a/jetty-rewrite/pom.xml b/jetty-rewrite/pom.xml index ac4c33784b3..14ae85dab0f 100644 --- a/jetty-rewrite/pom.xml +++ b/jetty-rewrite/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-rewrite diff --git a/jetty-security/pom.xml b/jetty-security/pom.xml index f43c1f84a8b..9c13c947948 100644 --- a/jetty-security/pom.xml +++ b/jetty-security/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-security diff --git a/jetty-server/pom.xml b/jetty-server/pom.xml index f81b6a029da..64a317154e0 100644 --- a/jetty-server/pom.xml +++ b/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-server diff --git a/jetty-servlet/pom.xml b/jetty-servlet/pom.xml index 670ec2e3114..2df0889a0c8 100644 --- a/jetty-servlet/pom.xml +++ b/jetty-servlet/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-servlet diff --git a/jetty-servlets/pom.xml b/jetty-servlets/pom.xml index f00c5a41048..db586ef5f30 100644 --- a/jetty-servlets/pom.xml +++ b/jetty-servlets/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-servlets diff --git a/jetty-spdy/pom.xml b/jetty-spdy/pom.xml index 166a7dddaca..4d7fd46d6b9 100644 --- a/jetty-spdy/pom.xml +++ b/jetty-spdy/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 diff --git a/jetty-spdy/spdy-core/pom.xml b/jetty-spdy/spdy-core/pom.xml index 2ae9cb1be8d..bc51c7be1a9 100644 --- a/jetty-spdy/spdy-core/pom.xml +++ b/jetty-spdy/spdy-core/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.spdy spdy-parent - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 diff --git a/jetty-spdy/spdy-jetty-http-webapp/pom.xml b/jetty-spdy/spdy-jetty-http-webapp/pom.xml index 41eda07c6e8..5d5e3af0dd3 100644 --- a/jetty-spdy/spdy-jetty-http-webapp/pom.xml +++ b/jetty-spdy/spdy-jetty-http-webapp/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.spdy spdy-parent - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 spdy-jetty-http-webapp diff --git a/jetty-spdy/spdy-jetty-http/pom.xml b/jetty-spdy/spdy-jetty-http/pom.xml index 6930b4d67d9..ea287a63c0e 100644 --- a/jetty-spdy/spdy-jetty-http/pom.xml +++ b/jetty-spdy/spdy-jetty-http/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.spdy spdy-parent - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 spdy-jetty-http diff --git a/jetty-spdy/spdy-jetty/pom.xml b/jetty-spdy/spdy-jetty/pom.xml index 7d15f772f79..774743cd93c 100644 --- a/jetty-spdy/spdy-jetty/pom.xml +++ b/jetty-spdy/spdy-jetty/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.spdy spdy-parent - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 spdy-jetty diff --git a/jetty-start/pom.xml b/jetty-start/pom.xml index f5c9cf19c26..b590c8d5768 100644 --- a/jetty-start/pom.xml +++ b/jetty-start/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-start diff --git a/jetty-util/pom.xml b/jetty-util/pom.xml index 17e95f9fd3c..d7bcc8c3c30 100644 --- a/jetty-util/pom.xml +++ b/jetty-util/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-util diff --git a/jetty-webapp/pom.xml b/jetty-webapp/pom.xml index 891542d4e98..ab2cfa0360c 100644 --- a/jetty-webapp/pom.xml +++ b/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-webapp diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml index d95e3c21afb..efb128b3760 100644 --- a/jetty-websocket/pom.xml +++ b/jetty-websocket/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 diff --git a/jetty-xml/pom.xml b/jetty-xml/pom.xml index 16656bbe550..5bde467c592 100644 --- a/jetty-xml/pom.xml +++ b/jetty-xml/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-xml diff --git a/pom.xml b/pom.xml index 6b1fc50e3df..7d63a961969 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 20 jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 Jetty :: Project ${jetty.url} pom diff --git a/test-continuation/pom.xml b/test-continuation/pom.xml index 892ed2281cb..78036a168d2 100644 --- a/test-continuation/pom.xml +++ b/test-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 test-continuation diff --git a/test-jetty-nested/pom.xml b/test-jetty-nested/pom.xml index 32c36f3c5db..fe1d30e1ec7 100644 --- a/test-jetty-nested/pom.xml +++ b/test-jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 test-jetty-nested Jetty :: Nested Test diff --git a/test-jetty-servlet/pom.xml b/test-jetty-servlet/pom.xml index 11394ddebfd..70ae5f45078 100644 --- a/test-jetty-servlet/pom.xml +++ b/test-jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 test-jetty-servlet diff --git a/test-jetty-webapp/pom.xml b/test-jetty-webapp/pom.xml index 3be79598af9..12494574129 100644 --- a/test-jetty-webapp/pom.xml +++ b/test-jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 test-jetty-webapp diff --git a/tests/pom.xml b/tests/pom.xml index 15a4134deea..da8e17d490d 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty jetty-project - 7.6.7-SNAPSHOT + 7.6.7.v20120910 org.eclipse.jetty.tests tests-parent diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml index 280a71915d9..772c27fa3f6 100644 --- a/tests/test-integration/pom.xml +++ b/tests/test-integration/pom.xml @@ -20,7 +20,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.7-SNAPSHOT + 7.6.7.v20120910 4.0.0 test-integration diff --git a/tests/test-loginservice/pom.xml b/tests/test-loginservice/pom.xml index cb0eb7d1d0b..d32e35f5002 100644 --- a/tests/test-loginservice/pom.xml +++ b/tests/test-loginservice/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.7-SNAPSHOT + 7.6.7.v20120910 test-loginservice Jetty Tests :: Login Service diff --git a/tests/test-sessions/pom.xml b/tests/test-sessions/pom.xml index d3f855dc4b9..d688e7e3b2e 100644 --- a/tests/test-sessions/pom.xml +++ b/tests/test-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.7-SNAPSHOT + 7.6.7.v20120910 test-sessions-parent Jetty Tests :: Sessions :: Parent diff --git a/tests/test-sessions/test-hash-sessions/pom.xml b/tests/test-sessions/test-hash-sessions/pom.xml index 1752be27af2..128dd28efc2 100644 --- a/tests/test-sessions/test-hash-sessions/pom.xml +++ b/tests/test-sessions/test-hash-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.7-SNAPSHOT + 7.6.7.v20120910 test-hash-sessions Jetty Tests :: Sessions :: Hash diff --git a/tests/test-sessions/test-jdbc-sessions/pom.xml b/tests/test-sessions/test-jdbc-sessions/pom.xml index 268c46759ce..f77e4895d92 100644 --- a/tests/test-sessions/test-jdbc-sessions/pom.xml +++ b/tests/test-sessions/test-jdbc-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.7-SNAPSHOT + 7.6.7.v20120910 test-jdbc-sessions Jetty Tests :: Sessions :: JDBC diff --git a/tests/test-sessions/test-mongodb-sessions/pom.xml b/tests/test-sessions/test-mongodb-sessions/pom.xml index da519ba4680..2a3d735904b 100644 --- a/tests/test-sessions/test-mongodb-sessions/pom.xml +++ b/tests/test-sessions/test-mongodb-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.7-SNAPSHOT + 7.6.7.v20120910 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 ff28fffc205..c704f65319a 100644 --- a/tests/test-sessions/test-sessions-common/pom.xml +++ b/tests/test-sessions/test-sessions-common/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.7-SNAPSHOT + 7.6.7.v20120910 test-sessions-common Jetty Tests :: Sessions :: Common diff --git a/tests/test-webapps/pom.xml b/tests/test-webapps/pom.xml index 6683d5a967d..62b791193a0 100644 --- a/tests/test-webapps/pom.xml +++ b/tests/test-webapps/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.7-SNAPSHOT + 7.6.7.v20120910 test-webapps-parent Jetty Tests :: WebApps :: Parent diff --git a/tests/test-webapps/test-webapp-rfc2616/pom.xml b/tests/test-webapps/test-webapp-rfc2616/pom.xml index 0c68dd40116..4079f191b3d 100644 --- a/tests/test-webapps/test-webapp-rfc2616/pom.xml +++ b/tests/test-webapps/test-webapp-rfc2616/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-webapps-parent - 7.6.7-SNAPSHOT + 7.6.7.v20120910 test-webapp-rfc2616 Jetty Tests :: WebApp :: RFC2616 From 1ec8b2621b1cb7a2ee13a1e0e8eb8c5ff8cf100a Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Mon, 10 Sep 2012 13:47:05 -0500 Subject: [PATCH 03/56] [maven-release-plugin] prepare release jetty-7.6.7.v20120910 --- example-jetty-embedded/pom.xml | 2 +- jetty-aggregate/jetty-all-server/pom.xml | 2 +- jetty-aggregate/jetty-all/pom.xml | 2 +- jetty-aggregate/jetty-client/pom.xml | 2 +- jetty-aggregate/jetty-plus/pom.xml | 2 +- jetty-aggregate/jetty-server/pom.xml | 2 +- jetty-aggregate/jetty-servlet/pom.xml | 2 +- jetty-aggregate/jetty-webapp/pom.xml | 2 +- jetty-aggregate/jetty-websocket/pom.xml | 2 +- jetty-aggregate/pom.xml | 2 +- jetty-ajp/pom.xml | 2 +- jetty-annotations/pom.xml | 2 +- jetty-client/pom.xml | 2 +- jetty-continuation/pom.xml | 2 +- jetty-deploy/pom.xml | 2 +- jetty-distribution/pom.xml | 2 +- jetty-http-spi/pom.xml | 2 +- jetty-http/pom.xml | 2 +- jetty-io/pom.xml | 2 +- jetty-jaspi/pom.xml | 2 +- jetty-jmx/pom.xml | 2 +- jetty-jndi/pom.xml | 2 +- jetty-jsp/pom.xml | 2 +- jetty-monitor/pom.xml | 2 +- jetty-nested/pom.xml | 2 +- jetty-nosql/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-jsp/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-logback/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-warurl/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot/pom.xml | 2 +- jetty-osgi/jetty-osgi-equinoxtools/pom.xml | 2 +- jetty-osgi/jetty-osgi-httpservice/pom.xml | 2 +- jetty-osgi/pom.xml | 2 +- jetty-osgi/test-jetty-osgi-context/pom.xml | 2 +- jetty-osgi/test-jetty-osgi-webapp/pom.xml | 2 +- jetty-osgi/test-jetty-osgi/pom.xml | 2 +- jetty-overlay-deployer/pom.xml | 2 +- jetty-plus/pom.xml | 2 +- jetty-policy/pom.xml | 2 +- jetty-rewrite/pom.xml | 2 +- jetty-security/pom.xml | 2 +- jetty-server/pom.xml | 2 +- jetty-servlet/pom.xml | 2 +- jetty-servlets/pom.xml | 2 +- jetty-spdy/pom.xml | 2 +- jetty-spdy/spdy-core/pom.xml | 2 +- jetty-spdy/spdy-jetty-http-webapp/pom.xml | 2 +- jetty-spdy/spdy-jetty-http/pom.xml | 2 +- jetty-spdy/spdy-jetty/pom.xml | 2 +- jetty-start/pom.xml | 2 +- jetty-util/pom.xml | 2 +- jetty-webapp/pom.xml | 2 +- jetty-websocket/pom.xml | 2 +- jetty-xml/pom.xml | 2 +- pom.xml | 2 +- test-continuation/pom.xml | 2 +- test-jetty-nested/pom.xml | 2 +- test-jetty-servlet/pom.xml | 2 +- test-jetty-webapp/pom.xml | 2 +- tests/pom.xml | 2 +- tests/test-integration/pom.xml | 2 +- tests/test-loginservice/pom.xml | 2 +- tests/test-sessions/pom.xml | 2 +- tests/test-sessions/test-hash-sessions/pom.xml | 2 +- tests/test-sessions/test-jdbc-sessions/pom.xml | 2 +- tests/test-sessions/test-mongodb-sessions/pom.xml | 2 +- tests/test-sessions/test-sessions-common/pom.xml | 2 +- tests/test-webapps/pom.xml | 2 +- tests/test-webapps/test-webapp-rfc2616/pom.xml | 2 +- 69 files changed, 69 insertions(+), 69 deletions(-) diff --git a/example-jetty-embedded/pom.xml b/example-jetty-embedded/pom.xml index 531d1c03628..2ea9a89d389 100644 --- a/example-jetty-embedded/pom.xml +++ b/example-jetty-embedded/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 example-jetty-embedded diff --git a/jetty-aggregate/jetty-all-server/pom.xml b/jetty-aggregate/jetty-all-server/pom.xml index 5c7dda10c42..ab289a0a5a4 100644 --- a/jetty-aggregate/jetty-all-server/pom.xml +++ b/jetty-aggregate/jetty-all-server/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-all-server diff --git a/jetty-aggregate/jetty-all/pom.xml b/jetty-aggregate/jetty-all/pom.xml index 09dc8a69b4a..9235332dfbe 100644 --- a/jetty-aggregate/jetty-all/pom.xml +++ b/jetty-aggregate/jetty-all/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-all diff --git a/jetty-aggregate/jetty-client/pom.xml b/jetty-aggregate/jetty-client/pom.xml index 4eb71f66795..1be391592ea 100644 --- a/jetty-aggregate/jetty-client/pom.xml +++ b/jetty-aggregate/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-client diff --git a/jetty-aggregate/jetty-plus/pom.xml b/jetty-aggregate/jetty-plus/pom.xml index 9b79030833c..4d3af294304 100644 --- a/jetty-aggregate/jetty-plus/pom.xml +++ b/jetty-aggregate/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-plus diff --git a/jetty-aggregate/jetty-server/pom.xml b/jetty-aggregate/jetty-server/pom.xml index fdb66eb9e60..4464aff513d 100644 --- a/jetty-aggregate/jetty-server/pom.xml +++ b/jetty-aggregate/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-server diff --git a/jetty-aggregate/jetty-servlet/pom.xml b/jetty-aggregate/jetty-servlet/pom.xml index 423a728f71a..47f24feeed3 100644 --- a/jetty-aggregate/jetty-servlet/pom.xml +++ b/jetty-aggregate/jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-servlet diff --git a/jetty-aggregate/jetty-webapp/pom.xml b/jetty-aggregate/jetty-webapp/pom.xml index febfe9f7fc6..c8d6cb0fa69 100644 --- a/jetty-aggregate/jetty-webapp/pom.xml +++ b/jetty-aggregate/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-webapp diff --git a/jetty-aggregate/jetty-websocket/pom.xml b/jetty-aggregate/jetty-websocket/pom.xml index a1ebe25fbeb..2cb09de092c 100644 --- a/jetty-aggregate/jetty-websocket/pom.xml +++ b/jetty-aggregate/jetty-websocket/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-websocket diff --git a/jetty-aggregate/pom.xml b/jetty-aggregate/pom.xml index 8ddb23c3c34..c52f3100a4a 100644 --- a/jetty-aggregate/pom.xml +++ b/jetty-aggregate/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT org.eclipse.jetty.aggregate jetty-aggregate-project diff --git a/jetty-ajp/pom.xml b/jetty-ajp/pom.xml index a95cfd2e3b2..d7d35e4a082 100644 --- a/jetty-ajp/pom.xml +++ b/jetty-ajp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-ajp diff --git a/jetty-annotations/pom.xml b/jetty-annotations/pom.xml index ab97853d3dd..c21cf4a9e08 100644 --- a/jetty-annotations/pom.xml +++ b/jetty-annotations/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-annotations diff --git a/jetty-client/pom.xml b/jetty-client/pom.xml index be69c6b7151..dbbf90f26e9 100644 --- a/jetty-client/pom.xml +++ b/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 diff --git a/jetty-continuation/pom.xml b/jetty-continuation/pom.xml index 56a15dde859..b5ad6936667 100644 --- a/jetty-continuation/pom.xml +++ b/jetty-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-continuation diff --git a/jetty-deploy/pom.xml b/jetty-deploy/pom.xml index a901c14a809..880e2f28813 100644 --- a/jetty-deploy/pom.xml +++ b/jetty-deploy/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-deploy diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index 349c4088380..c8f77aab331 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT jetty-distribution Jetty :: Distribution Assemblies diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml index 79e095989c6..29a49593b6a 100644 --- a/jetty-http-spi/pom.xml +++ b/jetty-http-spi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-http-spi diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml index 7459eafc211..bf838f1b91a 100644 --- a/jetty-http/pom.xml +++ b/jetty-http/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-http diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml index 75a8a22781d..c08d403fba6 100644 --- a/jetty-io/pom.xml +++ b/jetty-io/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-io diff --git a/jetty-jaspi/pom.xml b/jetty-jaspi/pom.xml index 790ddbb695d..c1a3a3cd0ab 100644 --- a/jetty-jaspi/pom.xml +++ b/jetty-jaspi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-jaspi diff --git a/jetty-jmx/pom.xml b/jetty-jmx/pom.xml index d5257a8414d..726fca4c099 100644 --- a/jetty-jmx/pom.xml +++ b/jetty-jmx/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-jmx diff --git a/jetty-jndi/pom.xml b/jetty-jndi/pom.xml index 6298f9cea1e..fea782ecc64 100644 --- a/jetty-jndi/pom.xml +++ b/jetty-jndi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-jndi diff --git a/jetty-jsp/pom.xml b/jetty-jsp/pom.xml index e10c723c271..c422892319b 100644 --- a/jetty-jsp/pom.xml +++ b/jetty-jsp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-jsp diff --git a/jetty-monitor/pom.xml b/jetty-monitor/pom.xml index 48bf0abddb5..1eea5ee00ba 100644 --- a/jetty-monitor/pom.xml +++ b/jetty-monitor/pom.xml @@ -19,7 +19,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-monitor diff --git a/jetty-nested/pom.xml b/jetty-nested/pom.xml index 90bbd5894c2..a043d69617c 100644 --- a/jetty-nested/pom.xml +++ b/jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT jetty-nested Jetty :: Nested diff --git a/jetty-nosql/pom.xml b/jetty-nosql/pom.xml index 215bc73b9ba..fb50c9d2608 100644 --- a/jetty-nosql/pom.xml +++ b/jetty-nosql/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-nosql diff --git a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml index c50421e9c47..95a03e1cad7 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 - 7.6.7.v20120910 + 7.6.8-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-logback/pom.xml b/jetty-osgi/jetty-osgi-boot-logback/pom.xml index 8a934cded4c..b2061220f0d 100644 --- a/jetty-osgi/jetty-osgi-boot-logback/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-logback/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml index 213a0c4bfb3..8ca64e39f24 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 - 7.6.7.v20120910 + 7.6.8-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 816b6ea7474..849d308bc57 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 - 7.6.7.v20120910 + 7.6.8-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml index a16c0787fe0..84e8bf683dc 100644 --- a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml +++ b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-httpservice/pom.xml b/jetty-osgi/jetty-osgi-httpservice/pom.xml index 301b01bc043..26246ac4dc7 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 - 7.6.7.v20120910 + 7.6.8-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/pom.xml b/jetty-osgi/pom.xml index 4043c6d9162..63b9bd055c9 100644 --- a/jetty-osgi/pom.xml +++ b/jetty-osgi/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT ../pom.xml org.eclipse.jetty.osgi diff --git a/jetty-osgi/test-jetty-osgi-context/pom.xml b/jetty-osgi/test-jetty-osgi-context/pom.xml index 911eb4cef93..5b65bc00f1c 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 - 7.6.7.v20120910 + 7.6.8-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/test-jetty-osgi-webapp/pom.xml b/jetty-osgi/test-jetty-osgi-webapp/pom.xml index f389300df2c..3e4d27d4e29 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 - 7.6.7.v20120910 + 7.6.8-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 63f8ca07395..5e321f0b9bb 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 - 7.6.7.v20120910 + 7.6.8-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-overlay-deployer/pom.xml b/jetty-overlay-deployer/pom.xml index 505a01e3e0a..5a11c02a897 100644 --- a/jetty-overlay-deployer/pom.xml +++ b/jetty-overlay-deployer/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-overlay-deployer diff --git a/jetty-plus/pom.xml b/jetty-plus/pom.xml index 86d1286444c..d5615a005d7 100644 --- a/jetty-plus/pom.xml +++ b/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-plus diff --git a/jetty-policy/pom.xml b/jetty-policy/pom.xml index 4c3e65aa94e..51b8f4c951d 100644 --- a/jetty-policy/pom.xml +++ b/jetty-policy/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT jetty-policy Jetty :: Policy Tool diff --git a/jetty-rewrite/pom.xml b/jetty-rewrite/pom.xml index 14ae85dab0f..5de6184e310 100644 --- a/jetty-rewrite/pom.xml +++ b/jetty-rewrite/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-rewrite diff --git a/jetty-security/pom.xml b/jetty-security/pom.xml index 9c13c947948..e25b2299d7f 100644 --- a/jetty-security/pom.xml +++ b/jetty-security/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-security diff --git a/jetty-server/pom.xml b/jetty-server/pom.xml index 64a317154e0..169cde21179 100644 --- a/jetty-server/pom.xml +++ b/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-server diff --git a/jetty-servlet/pom.xml b/jetty-servlet/pom.xml index 2df0889a0c8..cb80ecefd82 100644 --- a/jetty-servlet/pom.xml +++ b/jetty-servlet/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-servlet diff --git a/jetty-servlets/pom.xml b/jetty-servlets/pom.xml index db586ef5f30..c8b365cc477 100644 --- a/jetty-servlets/pom.xml +++ b/jetty-servlets/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-servlets diff --git a/jetty-spdy/pom.xml b/jetty-spdy/pom.xml index 4d7fd46d6b9..ed6cff25b74 100644 --- a/jetty-spdy/pom.xml +++ b/jetty-spdy/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 diff --git a/jetty-spdy/spdy-core/pom.xml b/jetty-spdy/spdy-core/pom.xml index bc51c7be1a9..953eaffb9ad 100644 --- a/jetty-spdy/spdy-core/pom.xml +++ b/jetty-spdy/spdy-core/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.spdy spdy-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 diff --git a/jetty-spdy/spdy-jetty-http-webapp/pom.xml b/jetty-spdy/spdy-jetty-http-webapp/pom.xml index 5d5e3af0dd3..295c777f6c3 100644 --- a/jetty-spdy/spdy-jetty-http-webapp/pom.xml +++ b/jetty-spdy/spdy-jetty-http-webapp/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.spdy spdy-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 spdy-jetty-http-webapp diff --git a/jetty-spdy/spdy-jetty-http/pom.xml b/jetty-spdy/spdy-jetty-http/pom.xml index ea287a63c0e..dbbfee3b0bf 100644 --- a/jetty-spdy/spdy-jetty-http/pom.xml +++ b/jetty-spdy/spdy-jetty-http/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.spdy spdy-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 spdy-jetty-http diff --git a/jetty-spdy/spdy-jetty/pom.xml b/jetty-spdy/spdy-jetty/pom.xml index 774743cd93c..ca6b17f3b1e 100644 --- a/jetty-spdy/spdy-jetty/pom.xml +++ b/jetty-spdy/spdy-jetty/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.spdy spdy-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 spdy-jetty diff --git a/jetty-start/pom.xml b/jetty-start/pom.xml index b590c8d5768..ef22b94371b 100644 --- a/jetty-start/pom.xml +++ b/jetty-start/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-start diff --git a/jetty-util/pom.xml b/jetty-util/pom.xml index d7bcc8c3c30..7df9a67d53c 100644 --- a/jetty-util/pom.xml +++ b/jetty-util/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-util diff --git a/jetty-webapp/pom.xml b/jetty-webapp/pom.xml index ab2cfa0360c..a088601b749 100644 --- a/jetty-webapp/pom.xml +++ b/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-webapp diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml index efb128b3760..bd6ea7feb24 100644 --- a/jetty-websocket/pom.xml +++ b/jetty-websocket/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 diff --git a/jetty-xml/pom.xml b/jetty-xml/pom.xml index 5bde467c592..8f69dae4db5 100644 --- a/jetty-xml/pom.xml +++ b/jetty-xml/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-xml diff --git a/pom.xml b/pom.xml index 7d63a961969..826feab40a8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 20 jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT Jetty :: Project ${jetty.url} pom diff --git a/test-continuation/pom.xml b/test-continuation/pom.xml index 78036a168d2..f07979a5618 100644 --- a/test-continuation/pom.xml +++ b/test-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 test-continuation diff --git a/test-jetty-nested/pom.xml b/test-jetty-nested/pom.xml index fe1d30e1ec7..adf850d21ff 100644 --- a/test-jetty-nested/pom.xml +++ b/test-jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT test-jetty-nested Jetty :: Nested Test diff --git a/test-jetty-servlet/pom.xml b/test-jetty-servlet/pom.xml index 70ae5f45078..b4b732b719e 100644 --- a/test-jetty-servlet/pom.xml +++ b/test-jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 test-jetty-servlet diff --git a/test-jetty-webapp/pom.xml b/test-jetty-webapp/pom.xml index 12494574129..45cbfe7353d 100644 --- a/test-jetty-webapp/pom.xml +++ b/test-jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 test-jetty-webapp diff --git a/tests/pom.xml b/tests/pom.xml index da8e17d490d..b4761a4a69e 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT org.eclipse.jetty.tests tests-parent diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml index 772c27fa3f6..949d9b2b201 100644 --- a/tests/test-integration/pom.xml +++ b/tests/test-integration/pom.xml @@ -20,7 +20,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 test-integration diff --git a/tests/test-loginservice/pom.xml b/tests/test-loginservice/pom.xml index d32e35f5002..9bf59faa9cd 100644 --- a/tests/test-loginservice/pom.xml +++ b/tests/test-loginservice/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT test-loginservice Jetty Tests :: Login Service diff --git a/tests/test-sessions/pom.xml b/tests/test-sessions/pom.xml index d688e7e3b2e..edbe06b94fc 100644 --- a/tests/test-sessions/pom.xml +++ b/tests/test-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT test-sessions-parent Jetty Tests :: Sessions :: Parent diff --git a/tests/test-sessions/test-hash-sessions/pom.xml b/tests/test-sessions/test-hash-sessions/pom.xml index 128dd28efc2..28979d63e06 100644 --- a/tests/test-sessions/test-hash-sessions/pom.xml +++ b/tests/test-sessions/test-hash-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT test-hash-sessions Jetty Tests :: Sessions :: Hash diff --git a/tests/test-sessions/test-jdbc-sessions/pom.xml b/tests/test-sessions/test-jdbc-sessions/pom.xml index f77e4895d92..a2fec154f53 100644 --- a/tests/test-sessions/test-jdbc-sessions/pom.xml +++ b/tests/test-sessions/test-jdbc-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT test-jdbc-sessions Jetty Tests :: Sessions :: JDBC diff --git a/tests/test-sessions/test-mongodb-sessions/pom.xml b/tests/test-sessions/test-mongodb-sessions/pom.xml index 2a3d735904b..4b28896243c 100644 --- a/tests/test-sessions/test-mongodb-sessions/pom.xml +++ b/tests/test-sessions/test-mongodb-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.7.v20120910 + 7.6.8-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 c704f65319a..1e6a7941a5d 100644 --- a/tests/test-sessions/test-sessions-common/pom.xml +++ b/tests/test-sessions/test-sessions-common/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT test-sessions-common Jetty Tests :: Sessions :: Common diff --git a/tests/test-webapps/pom.xml b/tests/test-webapps/pom.xml index 62b791193a0..7ba2b864c0d 100644 --- a/tests/test-webapps/pom.xml +++ b/tests/test-webapps/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT test-webapps-parent Jetty Tests :: WebApps :: Parent diff --git a/tests/test-webapps/test-webapp-rfc2616/pom.xml b/tests/test-webapps/test-webapp-rfc2616/pom.xml index 4079f191b3d..3e5b85eca61 100644 --- a/tests/test-webapps/test-webapp-rfc2616/pom.xml +++ b/tests/test-webapps/test-webapp-rfc2616/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-webapps-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT test-webapp-rfc2616 Jetty Tests :: WebApp :: RFC2616 From 92180a9700788f3040a4fdf6405ed25e33bea811 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Mon, 10 Sep 2012 14:18:01 -0500 Subject: [PATCH 04/56] [maven-release-plugin] prepare release jetty-7.6.7.v20120910 --- example-jetty-embedded/pom.xml | 2 +- jetty-aggregate/jetty-all-server/pom.xml | 2 +- jetty-aggregate/jetty-all/pom.xml | 2 +- jetty-aggregate/jetty-client/pom.xml | 2 +- jetty-aggregate/jetty-plus/pom.xml | 2 +- jetty-aggregate/jetty-server/pom.xml | 2 +- jetty-aggregate/jetty-servlet/pom.xml | 2 +- jetty-aggregate/jetty-webapp/pom.xml | 2 +- jetty-aggregate/jetty-websocket/pom.xml | 2 +- jetty-aggregate/pom.xml | 2 +- jetty-ajp/pom.xml | 2 +- jetty-annotations/pom.xml | 2 +- jetty-client/pom.xml | 2 +- jetty-continuation/pom.xml | 2 +- jetty-deploy/pom.xml | 2 +- jetty-distribution/pom.xml | 2 +- jetty-http-spi/pom.xml | 2 +- jetty-http/pom.xml | 2 +- jetty-io/pom.xml | 2 +- jetty-jaspi/pom.xml | 2 +- jetty-jmx/pom.xml | 2 +- jetty-jndi/pom.xml | 2 +- jetty-jsp/pom.xml | 2 +- jetty-monitor/pom.xml | 2 +- jetty-nested/pom.xml | 2 +- jetty-nosql/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-jsp/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-logback/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-warurl/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot/pom.xml | 2 +- jetty-osgi/jetty-osgi-equinoxtools/pom.xml | 2 +- jetty-osgi/jetty-osgi-httpservice/pom.xml | 2 +- jetty-osgi/pom.xml | 2 +- jetty-osgi/test-jetty-osgi-context/pom.xml | 2 +- jetty-osgi/test-jetty-osgi-webapp/pom.xml | 2 +- jetty-osgi/test-jetty-osgi/pom.xml | 2 +- jetty-overlay-deployer/pom.xml | 2 +- jetty-plus/pom.xml | 2 +- jetty-policy/pom.xml | 2 +- jetty-rewrite/pom.xml | 2 +- jetty-security/pom.xml | 2 +- jetty-server/pom.xml | 2 +- jetty-servlet/pom.xml | 2 +- jetty-servlets/pom.xml | 2 +- jetty-spdy/pom.xml | 2 +- jetty-spdy/spdy-core/pom.xml | 2 +- jetty-spdy/spdy-jetty-http-webapp/pom.xml | 2 +- jetty-spdy/spdy-jetty-http/pom.xml | 2 +- jetty-spdy/spdy-jetty/pom.xml | 2 +- jetty-start/pom.xml | 2 +- jetty-util/pom.xml | 2 +- jetty-webapp/pom.xml | 2 +- jetty-websocket/pom.xml | 2 +- jetty-xml/pom.xml | 2 +- pom.xml | 2 +- test-continuation/pom.xml | 2 +- test-jetty-nested/pom.xml | 2 +- test-jetty-servlet/pom.xml | 2 +- test-jetty-webapp/pom.xml | 2 +- tests/pom.xml | 2 +- tests/test-integration/pom.xml | 2 +- tests/test-loginservice/pom.xml | 2 +- tests/test-sessions/pom.xml | 2 +- tests/test-sessions/test-hash-sessions/pom.xml | 2 +- tests/test-sessions/test-jdbc-sessions/pom.xml | 2 +- tests/test-sessions/test-mongodb-sessions/pom.xml | 2 +- tests/test-sessions/test-sessions-common/pom.xml | 2 +- tests/test-webapps/pom.xml | 2 +- tests/test-webapps/test-webapp-rfc2616/pom.xml | 2 +- 69 files changed, 69 insertions(+), 69 deletions(-) diff --git a/example-jetty-embedded/pom.xml b/example-jetty-embedded/pom.xml index 2ea9a89d389..531d1c03628 100644 --- a/example-jetty-embedded/pom.xml +++ b/example-jetty-embedded/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 example-jetty-embedded diff --git a/jetty-aggregate/jetty-all-server/pom.xml b/jetty-aggregate/jetty-all-server/pom.xml index ab289a0a5a4..5c7dda10c42 100644 --- a/jetty-aggregate/jetty-all-server/pom.xml +++ b/jetty-aggregate/jetty-all-server/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-all-server diff --git a/jetty-aggregate/jetty-all/pom.xml b/jetty-aggregate/jetty-all/pom.xml index 9235332dfbe..09dc8a69b4a 100644 --- a/jetty-aggregate/jetty-all/pom.xml +++ b/jetty-aggregate/jetty-all/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-all diff --git a/jetty-aggregate/jetty-client/pom.xml b/jetty-aggregate/jetty-client/pom.xml index 1be391592ea..4eb71f66795 100644 --- a/jetty-aggregate/jetty-client/pom.xml +++ b/jetty-aggregate/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-client diff --git a/jetty-aggregate/jetty-plus/pom.xml b/jetty-aggregate/jetty-plus/pom.xml index 4d3af294304..9b79030833c 100644 --- a/jetty-aggregate/jetty-plus/pom.xml +++ b/jetty-aggregate/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-plus diff --git a/jetty-aggregate/jetty-server/pom.xml b/jetty-aggregate/jetty-server/pom.xml index 4464aff513d..fdb66eb9e60 100644 --- a/jetty-aggregate/jetty-server/pom.xml +++ b/jetty-aggregate/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-server diff --git a/jetty-aggregate/jetty-servlet/pom.xml b/jetty-aggregate/jetty-servlet/pom.xml index 47f24feeed3..423a728f71a 100644 --- a/jetty-aggregate/jetty-servlet/pom.xml +++ b/jetty-aggregate/jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-servlet diff --git a/jetty-aggregate/jetty-webapp/pom.xml b/jetty-aggregate/jetty-webapp/pom.xml index c8d6cb0fa69..febfe9f7fc6 100644 --- a/jetty-aggregate/jetty-webapp/pom.xml +++ b/jetty-aggregate/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-webapp diff --git a/jetty-aggregate/jetty-websocket/pom.xml b/jetty-aggregate/jetty-websocket/pom.xml index 2cb09de092c..a1ebe25fbeb 100644 --- a/jetty-aggregate/jetty-websocket/pom.xml +++ b/jetty-aggregate/jetty-websocket/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-websocket diff --git a/jetty-aggregate/pom.xml b/jetty-aggregate/pom.xml index c52f3100a4a..8ddb23c3c34 100644 --- a/jetty-aggregate/pom.xml +++ b/jetty-aggregate/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 org.eclipse.jetty.aggregate jetty-aggregate-project diff --git a/jetty-ajp/pom.xml b/jetty-ajp/pom.xml index d7d35e4a082..a95cfd2e3b2 100644 --- a/jetty-ajp/pom.xml +++ b/jetty-ajp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-ajp diff --git a/jetty-annotations/pom.xml b/jetty-annotations/pom.xml index c21cf4a9e08..ab97853d3dd 100644 --- a/jetty-annotations/pom.xml +++ b/jetty-annotations/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-annotations diff --git a/jetty-client/pom.xml b/jetty-client/pom.xml index dbbf90f26e9..be69c6b7151 100644 --- a/jetty-client/pom.xml +++ b/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 diff --git a/jetty-continuation/pom.xml b/jetty-continuation/pom.xml index b5ad6936667..56a15dde859 100644 --- a/jetty-continuation/pom.xml +++ b/jetty-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-continuation diff --git a/jetty-deploy/pom.xml b/jetty-deploy/pom.xml index 880e2f28813..a901c14a809 100644 --- a/jetty-deploy/pom.xml +++ b/jetty-deploy/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-deploy diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index c8f77aab331..349c4088380 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 jetty-distribution Jetty :: Distribution Assemblies diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml index 29a49593b6a..79e095989c6 100644 --- a/jetty-http-spi/pom.xml +++ b/jetty-http-spi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-http-spi diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml index bf838f1b91a..7459eafc211 100644 --- a/jetty-http/pom.xml +++ b/jetty-http/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-http diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml index c08d403fba6..75a8a22781d 100644 --- a/jetty-io/pom.xml +++ b/jetty-io/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-io diff --git a/jetty-jaspi/pom.xml b/jetty-jaspi/pom.xml index c1a3a3cd0ab..790ddbb695d 100644 --- a/jetty-jaspi/pom.xml +++ b/jetty-jaspi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-jaspi diff --git a/jetty-jmx/pom.xml b/jetty-jmx/pom.xml index 726fca4c099..d5257a8414d 100644 --- a/jetty-jmx/pom.xml +++ b/jetty-jmx/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-jmx diff --git a/jetty-jndi/pom.xml b/jetty-jndi/pom.xml index fea782ecc64..6298f9cea1e 100644 --- a/jetty-jndi/pom.xml +++ b/jetty-jndi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-jndi diff --git a/jetty-jsp/pom.xml b/jetty-jsp/pom.xml index c422892319b..e10c723c271 100644 --- a/jetty-jsp/pom.xml +++ b/jetty-jsp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-jsp diff --git a/jetty-monitor/pom.xml b/jetty-monitor/pom.xml index 1eea5ee00ba..48bf0abddb5 100644 --- a/jetty-monitor/pom.xml +++ b/jetty-monitor/pom.xml @@ -19,7 +19,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-monitor diff --git a/jetty-nested/pom.xml b/jetty-nested/pom.xml index a043d69617c..90bbd5894c2 100644 --- a/jetty-nested/pom.xml +++ b/jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 jetty-nested Jetty :: Nested diff --git a/jetty-nosql/pom.xml b/jetty-nosql/pom.xml index fb50c9d2608..215bc73b9ba 100644 --- a/jetty-nosql/pom.xml +++ b/jetty-nosql/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-nosql diff --git a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml index 95a03e1cad7..c50421e9c47 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 - 7.6.8-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-logback/pom.xml b/jetty-osgi/jetty-osgi-boot-logback/pom.xml index b2061220f0d..8a934cded4c 100644 --- a/jetty-osgi/jetty-osgi-boot-logback/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-logback/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml index 8ca64e39f24..213a0c4bfb3 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 - 7.6.8-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot/pom.xml b/jetty-osgi/jetty-osgi-boot/pom.xml index 849d308bc57..816b6ea7474 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 - 7.6.8-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml index 84e8bf683dc..a16c0787fe0 100644 --- a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml +++ b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-httpservice/pom.xml b/jetty-osgi/jetty-osgi-httpservice/pom.xml index 26246ac4dc7..301b01bc043 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 - 7.6.8-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-osgi/pom.xml b/jetty-osgi/pom.xml index 63b9bd055c9..4043c6d9162 100644 --- a/jetty-osgi/pom.xml +++ b/jetty-osgi/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 ../pom.xml org.eclipse.jetty.osgi diff --git a/jetty-osgi/test-jetty-osgi-context/pom.xml b/jetty-osgi/test-jetty-osgi-context/pom.xml index 5b65bc00f1c..911eb4cef93 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 - 7.6.8-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-osgi/test-jetty-osgi-webapp/pom.xml b/jetty-osgi/test-jetty-osgi-webapp/pom.xml index 3e4d27d4e29..f389300df2c 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 - 7.6.8-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml index 5e321f0b9bb..63f8ca07395 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 - 7.6.8-SNAPSHOT + 7.6.7.v20120910 ../pom.xml 4.0.0 diff --git a/jetty-overlay-deployer/pom.xml b/jetty-overlay-deployer/pom.xml index 5a11c02a897..505a01e3e0a 100644 --- a/jetty-overlay-deployer/pom.xml +++ b/jetty-overlay-deployer/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-overlay-deployer diff --git a/jetty-plus/pom.xml b/jetty-plus/pom.xml index d5615a005d7..86d1286444c 100644 --- a/jetty-plus/pom.xml +++ b/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-plus diff --git a/jetty-policy/pom.xml b/jetty-policy/pom.xml index 51b8f4c951d..4c3e65aa94e 100644 --- a/jetty-policy/pom.xml +++ b/jetty-policy/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 jetty-policy Jetty :: Policy Tool diff --git a/jetty-rewrite/pom.xml b/jetty-rewrite/pom.xml index 5de6184e310..14ae85dab0f 100644 --- a/jetty-rewrite/pom.xml +++ b/jetty-rewrite/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-rewrite diff --git a/jetty-security/pom.xml b/jetty-security/pom.xml index e25b2299d7f..9c13c947948 100644 --- a/jetty-security/pom.xml +++ b/jetty-security/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-security diff --git a/jetty-server/pom.xml b/jetty-server/pom.xml index 169cde21179..64a317154e0 100644 --- a/jetty-server/pom.xml +++ b/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-server diff --git a/jetty-servlet/pom.xml b/jetty-servlet/pom.xml index cb80ecefd82..2df0889a0c8 100644 --- a/jetty-servlet/pom.xml +++ b/jetty-servlet/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-servlet diff --git a/jetty-servlets/pom.xml b/jetty-servlets/pom.xml index c8b365cc477..db586ef5f30 100644 --- a/jetty-servlets/pom.xml +++ b/jetty-servlets/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-servlets diff --git a/jetty-spdy/pom.xml b/jetty-spdy/pom.xml index ed6cff25b74..4d7fd46d6b9 100644 --- a/jetty-spdy/pom.xml +++ b/jetty-spdy/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 diff --git a/jetty-spdy/spdy-core/pom.xml b/jetty-spdy/spdy-core/pom.xml index 953eaffb9ad..bc51c7be1a9 100644 --- a/jetty-spdy/spdy-core/pom.xml +++ b/jetty-spdy/spdy-core/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.spdy spdy-parent - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 diff --git a/jetty-spdy/spdy-jetty-http-webapp/pom.xml b/jetty-spdy/spdy-jetty-http-webapp/pom.xml index 295c777f6c3..5d5e3af0dd3 100644 --- a/jetty-spdy/spdy-jetty-http-webapp/pom.xml +++ b/jetty-spdy/spdy-jetty-http-webapp/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.spdy spdy-parent - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 spdy-jetty-http-webapp diff --git a/jetty-spdy/spdy-jetty-http/pom.xml b/jetty-spdy/spdy-jetty-http/pom.xml index dbbfee3b0bf..ea287a63c0e 100644 --- a/jetty-spdy/spdy-jetty-http/pom.xml +++ b/jetty-spdy/spdy-jetty-http/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.spdy spdy-parent - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 spdy-jetty-http diff --git a/jetty-spdy/spdy-jetty/pom.xml b/jetty-spdy/spdy-jetty/pom.xml index ca6b17f3b1e..774743cd93c 100644 --- a/jetty-spdy/spdy-jetty/pom.xml +++ b/jetty-spdy/spdy-jetty/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.spdy spdy-parent - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 spdy-jetty diff --git a/jetty-start/pom.xml b/jetty-start/pom.xml index ef22b94371b..b590c8d5768 100644 --- a/jetty-start/pom.xml +++ b/jetty-start/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-start diff --git a/jetty-util/pom.xml b/jetty-util/pom.xml index 7df9a67d53c..d7bcc8c3c30 100644 --- a/jetty-util/pom.xml +++ b/jetty-util/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-util diff --git a/jetty-webapp/pom.xml b/jetty-webapp/pom.xml index a088601b749..ab2cfa0360c 100644 --- a/jetty-webapp/pom.xml +++ b/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-webapp diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml index bd6ea7feb24..efb128b3760 100644 --- a/jetty-websocket/pom.xml +++ b/jetty-websocket/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 diff --git a/jetty-xml/pom.xml b/jetty-xml/pom.xml index 8f69dae4db5..5bde467c592 100644 --- a/jetty-xml/pom.xml +++ b/jetty-xml/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 jetty-xml diff --git a/pom.xml b/pom.xml index 826feab40a8..7d63a961969 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 20 jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 Jetty :: Project ${jetty.url} pom diff --git a/test-continuation/pom.xml b/test-continuation/pom.xml index f07979a5618..78036a168d2 100644 --- a/test-continuation/pom.xml +++ b/test-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 test-continuation diff --git a/test-jetty-nested/pom.xml b/test-jetty-nested/pom.xml index adf850d21ff..fe1d30e1ec7 100644 --- a/test-jetty-nested/pom.xml +++ b/test-jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 test-jetty-nested Jetty :: Nested Test diff --git a/test-jetty-servlet/pom.xml b/test-jetty-servlet/pom.xml index b4b732b719e..70ae5f45078 100644 --- a/test-jetty-servlet/pom.xml +++ b/test-jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 test-jetty-servlet diff --git a/test-jetty-webapp/pom.xml b/test-jetty-webapp/pom.xml index 45cbfe7353d..12494574129 100644 --- a/test-jetty-webapp/pom.xml +++ b/test-jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 test-jetty-webapp diff --git a/tests/pom.xml b/tests/pom.xml index b4761a4a69e..da8e17d490d 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty jetty-project - 7.6.8-SNAPSHOT + 7.6.7.v20120910 org.eclipse.jetty.tests tests-parent diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml index 949d9b2b201..772c27fa3f6 100644 --- a/tests/test-integration/pom.xml +++ b/tests/test-integration/pom.xml @@ -20,7 +20,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.8-SNAPSHOT + 7.6.7.v20120910 4.0.0 test-integration diff --git a/tests/test-loginservice/pom.xml b/tests/test-loginservice/pom.xml index 9bf59faa9cd..d32e35f5002 100644 --- a/tests/test-loginservice/pom.xml +++ b/tests/test-loginservice/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.8-SNAPSHOT + 7.6.7.v20120910 test-loginservice Jetty Tests :: Login Service diff --git a/tests/test-sessions/pom.xml b/tests/test-sessions/pom.xml index edbe06b94fc..d688e7e3b2e 100644 --- a/tests/test-sessions/pom.xml +++ b/tests/test-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.8-SNAPSHOT + 7.6.7.v20120910 test-sessions-parent Jetty Tests :: Sessions :: Parent diff --git a/tests/test-sessions/test-hash-sessions/pom.xml b/tests/test-sessions/test-hash-sessions/pom.xml index 28979d63e06..128dd28efc2 100644 --- a/tests/test-sessions/test-hash-sessions/pom.xml +++ b/tests/test-sessions/test-hash-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.8-SNAPSHOT + 7.6.7.v20120910 test-hash-sessions Jetty Tests :: Sessions :: Hash diff --git a/tests/test-sessions/test-jdbc-sessions/pom.xml b/tests/test-sessions/test-jdbc-sessions/pom.xml index a2fec154f53..f77e4895d92 100644 --- a/tests/test-sessions/test-jdbc-sessions/pom.xml +++ b/tests/test-sessions/test-jdbc-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.8-SNAPSHOT + 7.6.7.v20120910 test-jdbc-sessions Jetty Tests :: Sessions :: JDBC diff --git a/tests/test-sessions/test-mongodb-sessions/pom.xml b/tests/test-sessions/test-mongodb-sessions/pom.xml index 4b28896243c..2a3d735904b 100644 --- a/tests/test-sessions/test-mongodb-sessions/pom.xml +++ b/tests/test-sessions/test-mongodb-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.8-SNAPSHOT + 7.6.7.v20120910 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 1e6a7941a5d..c704f65319a 100644 --- a/tests/test-sessions/test-sessions-common/pom.xml +++ b/tests/test-sessions/test-sessions-common/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.8-SNAPSHOT + 7.6.7.v20120910 test-sessions-common Jetty Tests :: Sessions :: Common diff --git a/tests/test-webapps/pom.xml b/tests/test-webapps/pom.xml index 7ba2b864c0d..62b791193a0 100644 --- a/tests/test-webapps/pom.xml +++ b/tests/test-webapps/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.8-SNAPSHOT + 7.6.7.v20120910 test-webapps-parent Jetty Tests :: WebApps :: Parent diff --git a/tests/test-webapps/test-webapp-rfc2616/pom.xml b/tests/test-webapps/test-webapp-rfc2616/pom.xml index 3e5b85eca61..4079f191b3d 100644 --- a/tests/test-webapps/test-webapp-rfc2616/pom.xml +++ b/tests/test-webapps/test-webapp-rfc2616/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-webapps-parent - 7.6.8-SNAPSHOT + 7.6.7.v20120910 test-webapp-rfc2616 Jetty Tests :: WebApp :: RFC2616 From a8994178f5c2fd8040a7766cfcdcea7c9ea9b86b Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Mon, 10 Sep 2012 14:18:11 -0500 Subject: [PATCH 05/56] [maven-release-plugin] prepare for next development iteration --- example-jetty-embedded/pom.xml | 2 +- jetty-aggregate/jetty-all-server/pom.xml | 2 +- jetty-aggregate/jetty-all/pom.xml | 2 +- jetty-aggregate/jetty-client/pom.xml | 2 +- jetty-aggregate/jetty-plus/pom.xml | 2 +- jetty-aggregate/jetty-server/pom.xml | 2 +- jetty-aggregate/jetty-servlet/pom.xml | 2 +- jetty-aggregate/jetty-webapp/pom.xml | 2 +- jetty-aggregate/jetty-websocket/pom.xml | 2 +- jetty-aggregate/pom.xml | 2 +- jetty-ajp/pom.xml | 2 +- jetty-annotations/pom.xml | 2 +- jetty-client/pom.xml | 2 +- jetty-continuation/pom.xml | 2 +- jetty-deploy/pom.xml | 2 +- jetty-distribution/pom.xml | 2 +- jetty-http-spi/pom.xml | 2 +- jetty-http/pom.xml | 2 +- jetty-io/pom.xml | 2 +- jetty-jaspi/pom.xml | 2 +- jetty-jmx/pom.xml | 2 +- jetty-jndi/pom.xml | 2 +- jetty-jsp/pom.xml | 2 +- jetty-monitor/pom.xml | 2 +- jetty-nested/pom.xml | 2 +- jetty-nosql/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-jsp/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-logback/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-warurl/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot/pom.xml | 2 +- jetty-osgi/jetty-osgi-equinoxtools/pom.xml | 2 +- jetty-osgi/jetty-osgi-httpservice/pom.xml | 2 +- jetty-osgi/pom.xml | 2 +- jetty-osgi/test-jetty-osgi-context/pom.xml | 2 +- jetty-osgi/test-jetty-osgi-webapp/pom.xml | 2 +- jetty-osgi/test-jetty-osgi/pom.xml | 2 +- jetty-overlay-deployer/pom.xml | 2 +- jetty-plus/pom.xml | 2 +- jetty-policy/pom.xml | 2 +- jetty-rewrite/pom.xml | 2 +- jetty-security/pom.xml | 2 +- jetty-server/pom.xml | 2 +- jetty-servlet/pom.xml | 2 +- jetty-servlets/pom.xml | 2 +- jetty-spdy/pom.xml | 2 +- jetty-spdy/spdy-core/pom.xml | 2 +- jetty-spdy/spdy-jetty-http-webapp/pom.xml | 2 +- jetty-spdy/spdy-jetty-http/pom.xml | 2 +- jetty-spdy/spdy-jetty/pom.xml | 2 +- jetty-start/pom.xml | 2 +- jetty-util/pom.xml | 2 +- jetty-webapp/pom.xml | 2 +- jetty-websocket/pom.xml | 2 +- jetty-xml/pom.xml | 2 +- pom.xml | 2 +- test-continuation/pom.xml | 2 +- test-jetty-nested/pom.xml | 2 +- test-jetty-servlet/pom.xml | 2 +- test-jetty-webapp/pom.xml | 2 +- tests/pom.xml | 2 +- tests/test-integration/pom.xml | 2 +- tests/test-loginservice/pom.xml | 2 +- tests/test-sessions/pom.xml | 2 +- tests/test-sessions/test-hash-sessions/pom.xml | 2 +- tests/test-sessions/test-jdbc-sessions/pom.xml | 2 +- tests/test-sessions/test-mongodb-sessions/pom.xml | 2 +- tests/test-sessions/test-sessions-common/pom.xml | 2 +- tests/test-webapps/pom.xml | 2 +- tests/test-webapps/test-webapp-rfc2616/pom.xml | 2 +- 69 files changed, 69 insertions(+), 69 deletions(-) diff --git a/example-jetty-embedded/pom.xml b/example-jetty-embedded/pom.xml index 531d1c03628..2ea9a89d389 100644 --- a/example-jetty-embedded/pom.xml +++ b/example-jetty-embedded/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 example-jetty-embedded diff --git a/jetty-aggregate/jetty-all-server/pom.xml b/jetty-aggregate/jetty-all-server/pom.xml index 5c7dda10c42..ab289a0a5a4 100644 --- a/jetty-aggregate/jetty-all-server/pom.xml +++ b/jetty-aggregate/jetty-all-server/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-all-server diff --git a/jetty-aggregate/jetty-all/pom.xml b/jetty-aggregate/jetty-all/pom.xml index 09dc8a69b4a..9235332dfbe 100644 --- a/jetty-aggregate/jetty-all/pom.xml +++ b/jetty-aggregate/jetty-all/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-all diff --git a/jetty-aggregate/jetty-client/pom.xml b/jetty-aggregate/jetty-client/pom.xml index 4eb71f66795..1be391592ea 100644 --- a/jetty-aggregate/jetty-client/pom.xml +++ b/jetty-aggregate/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-client diff --git a/jetty-aggregate/jetty-plus/pom.xml b/jetty-aggregate/jetty-plus/pom.xml index 9b79030833c..4d3af294304 100644 --- a/jetty-aggregate/jetty-plus/pom.xml +++ b/jetty-aggregate/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-plus diff --git a/jetty-aggregate/jetty-server/pom.xml b/jetty-aggregate/jetty-server/pom.xml index fdb66eb9e60..4464aff513d 100644 --- a/jetty-aggregate/jetty-server/pom.xml +++ b/jetty-aggregate/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-server diff --git a/jetty-aggregate/jetty-servlet/pom.xml b/jetty-aggregate/jetty-servlet/pom.xml index 423a728f71a..47f24feeed3 100644 --- a/jetty-aggregate/jetty-servlet/pom.xml +++ b/jetty-aggregate/jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-servlet diff --git a/jetty-aggregate/jetty-webapp/pom.xml b/jetty-aggregate/jetty-webapp/pom.xml index febfe9f7fc6..c8d6cb0fa69 100644 --- a/jetty-aggregate/jetty-webapp/pom.xml +++ b/jetty-aggregate/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-webapp diff --git a/jetty-aggregate/jetty-websocket/pom.xml b/jetty-aggregate/jetty-websocket/pom.xml index a1ebe25fbeb..2cb09de092c 100644 --- a/jetty-aggregate/jetty-websocket/pom.xml +++ b/jetty-aggregate/jetty-websocket/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-websocket diff --git a/jetty-aggregate/pom.xml b/jetty-aggregate/pom.xml index 8ddb23c3c34..c52f3100a4a 100644 --- a/jetty-aggregate/pom.xml +++ b/jetty-aggregate/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT org.eclipse.jetty.aggregate jetty-aggregate-project diff --git a/jetty-ajp/pom.xml b/jetty-ajp/pom.xml index a95cfd2e3b2..d7d35e4a082 100644 --- a/jetty-ajp/pom.xml +++ b/jetty-ajp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-ajp diff --git a/jetty-annotations/pom.xml b/jetty-annotations/pom.xml index ab97853d3dd..c21cf4a9e08 100644 --- a/jetty-annotations/pom.xml +++ b/jetty-annotations/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-annotations diff --git a/jetty-client/pom.xml b/jetty-client/pom.xml index be69c6b7151..dbbf90f26e9 100644 --- a/jetty-client/pom.xml +++ b/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 diff --git a/jetty-continuation/pom.xml b/jetty-continuation/pom.xml index 56a15dde859..b5ad6936667 100644 --- a/jetty-continuation/pom.xml +++ b/jetty-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-continuation diff --git a/jetty-deploy/pom.xml b/jetty-deploy/pom.xml index a901c14a809..880e2f28813 100644 --- a/jetty-deploy/pom.xml +++ b/jetty-deploy/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-deploy diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index 349c4088380..c8f77aab331 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT jetty-distribution Jetty :: Distribution Assemblies diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml index 79e095989c6..29a49593b6a 100644 --- a/jetty-http-spi/pom.xml +++ b/jetty-http-spi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-http-spi diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml index 7459eafc211..bf838f1b91a 100644 --- a/jetty-http/pom.xml +++ b/jetty-http/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-http diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml index 75a8a22781d..c08d403fba6 100644 --- a/jetty-io/pom.xml +++ b/jetty-io/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-io diff --git a/jetty-jaspi/pom.xml b/jetty-jaspi/pom.xml index 790ddbb695d..c1a3a3cd0ab 100644 --- a/jetty-jaspi/pom.xml +++ b/jetty-jaspi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-jaspi diff --git a/jetty-jmx/pom.xml b/jetty-jmx/pom.xml index d5257a8414d..726fca4c099 100644 --- a/jetty-jmx/pom.xml +++ b/jetty-jmx/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-jmx diff --git a/jetty-jndi/pom.xml b/jetty-jndi/pom.xml index 6298f9cea1e..fea782ecc64 100644 --- a/jetty-jndi/pom.xml +++ b/jetty-jndi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-jndi diff --git a/jetty-jsp/pom.xml b/jetty-jsp/pom.xml index e10c723c271..c422892319b 100644 --- a/jetty-jsp/pom.xml +++ b/jetty-jsp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-jsp diff --git a/jetty-monitor/pom.xml b/jetty-monitor/pom.xml index 48bf0abddb5..1eea5ee00ba 100644 --- a/jetty-monitor/pom.xml +++ b/jetty-monitor/pom.xml @@ -19,7 +19,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-monitor diff --git a/jetty-nested/pom.xml b/jetty-nested/pom.xml index 90bbd5894c2..a043d69617c 100644 --- a/jetty-nested/pom.xml +++ b/jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT jetty-nested Jetty :: Nested diff --git a/jetty-nosql/pom.xml b/jetty-nosql/pom.xml index 215bc73b9ba..fb50c9d2608 100644 --- a/jetty-nosql/pom.xml +++ b/jetty-nosql/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-nosql diff --git a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml index c50421e9c47..95a03e1cad7 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 - 7.6.7.v20120910 + 7.6.8-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-logback/pom.xml b/jetty-osgi/jetty-osgi-boot-logback/pom.xml index 8a934cded4c..b2061220f0d 100644 --- a/jetty-osgi/jetty-osgi-boot-logback/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-logback/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml index 213a0c4bfb3..8ca64e39f24 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 - 7.6.7.v20120910 + 7.6.8-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 816b6ea7474..849d308bc57 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 - 7.6.7.v20120910 + 7.6.8-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml index a16c0787fe0..84e8bf683dc 100644 --- a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml +++ b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-httpservice/pom.xml b/jetty-osgi/jetty-osgi-httpservice/pom.xml index 301b01bc043..26246ac4dc7 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 - 7.6.7.v20120910 + 7.6.8-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/pom.xml b/jetty-osgi/pom.xml index 4043c6d9162..63b9bd055c9 100644 --- a/jetty-osgi/pom.xml +++ b/jetty-osgi/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT ../pom.xml org.eclipse.jetty.osgi diff --git a/jetty-osgi/test-jetty-osgi-context/pom.xml b/jetty-osgi/test-jetty-osgi-context/pom.xml index 911eb4cef93..5b65bc00f1c 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 - 7.6.7.v20120910 + 7.6.8-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/test-jetty-osgi-webapp/pom.xml b/jetty-osgi/test-jetty-osgi-webapp/pom.xml index f389300df2c..3e4d27d4e29 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 - 7.6.7.v20120910 + 7.6.8-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 63f8ca07395..5e321f0b9bb 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 - 7.6.7.v20120910 + 7.6.8-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-overlay-deployer/pom.xml b/jetty-overlay-deployer/pom.xml index 505a01e3e0a..5a11c02a897 100644 --- a/jetty-overlay-deployer/pom.xml +++ b/jetty-overlay-deployer/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-overlay-deployer diff --git a/jetty-plus/pom.xml b/jetty-plus/pom.xml index 86d1286444c..d5615a005d7 100644 --- a/jetty-plus/pom.xml +++ b/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-plus diff --git a/jetty-policy/pom.xml b/jetty-policy/pom.xml index 4c3e65aa94e..51b8f4c951d 100644 --- a/jetty-policy/pom.xml +++ b/jetty-policy/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT jetty-policy Jetty :: Policy Tool diff --git a/jetty-rewrite/pom.xml b/jetty-rewrite/pom.xml index 14ae85dab0f..5de6184e310 100644 --- a/jetty-rewrite/pom.xml +++ b/jetty-rewrite/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-rewrite diff --git a/jetty-security/pom.xml b/jetty-security/pom.xml index 9c13c947948..e25b2299d7f 100644 --- a/jetty-security/pom.xml +++ b/jetty-security/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-security diff --git a/jetty-server/pom.xml b/jetty-server/pom.xml index 64a317154e0..169cde21179 100644 --- a/jetty-server/pom.xml +++ b/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-server diff --git a/jetty-servlet/pom.xml b/jetty-servlet/pom.xml index 2df0889a0c8..cb80ecefd82 100644 --- a/jetty-servlet/pom.xml +++ b/jetty-servlet/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-servlet diff --git a/jetty-servlets/pom.xml b/jetty-servlets/pom.xml index db586ef5f30..c8b365cc477 100644 --- a/jetty-servlets/pom.xml +++ b/jetty-servlets/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-servlets diff --git a/jetty-spdy/pom.xml b/jetty-spdy/pom.xml index 4d7fd46d6b9..ed6cff25b74 100644 --- a/jetty-spdy/pom.xml +++ b/jetty-spdy/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 diff --git a/jetty-spdy/spdy-core/pom.xml b/jetty-spdy/spdy-core/pom.xml index bc51c7be1a9..953eaffb9ad 100644 --- a/jetty-spdy/spdy-core/pom.xml +++ b/jetty-spdy/spdy-core/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.spdy spdy-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 diff --git a/jetty-spdy/spdy-jetty-http-webapp/pom.xml b/jetty-spdy/spdy-jetty-http-webapp/pom.xml index 5d5e3af0dd3..295c777f6c3 100644 --- a/jetty-spdy/spdy-jetty-http-webapp/pom.xml +++ b/jetty-spdy/spdy-jetty-http-webapp/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.spdy spdy-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 spdy-jetty-http-webapp diff --git a/jetty-spdy/spdy-jetty-http/pom.xml b/jetty-spdy/spdy-jetty-http/pom.xml index ea287a63c0e..dbbfee3b0bf 100644 --- a/jetty-spdy/spdy-jetty-http/pom.xml +++ b/jetty-spdy/spdy-jetty-http/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.spdy spdy-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 spdy-jetty-http diff --git a/jetty-spdy/spdy-jetty/pom.xml b/jetty-spdy/spdy-jetty/pom.xml index 774743cd93c..ca6b17f3b1e 100644 --- a/jetty-spdy/spdy-jetty/pom.xml +++ b/jetty-spdy/spdy-jetty/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.spdy spdy-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 spdy-jetty diff --git a/jetty-start/pom.xml b/jetty-start/pom.xml index b590c8d5768..ef22b94371b 100644 --- a/jetty-start/pom.xml +++ b/jetty-start/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-start diff --git a/jetty-util/pom.xml b/jetty-util/pom.xml index d7bcc8c3c30..7df9a67d53c 100644 --- a/jetty-util/pom.xml +++ b/jetty-util/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-util diff --git a/jetty-webapp/pom.xml b/jetty-webapp/pom.xml index ab2cfa0360c..a088601b749 100644 --- a/jetty-webapp/pom.xml +++ b/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-webapp diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml index efb128b3760..bd6ea7feb24 100644 --- a/jetty-websocket/pom.xml +++ b/jetty-websocket/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 diff --git a/jetty-xml/pom.xml b/jetty-xml/pom.xml index 5bde467c592..8f69dae4db5 100644 --- a/jetty-xml/pom.xml +++ b/jetty-xml/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 jetty-xml diff --git a/pom.xml b/pom.xml index 7d63a961969..826feab40a8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 20 jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT Jetty :: Project ${jetty.url} pom diff --git a/test-continuation/pom.xml b/test-continuation/pom.xml index 78036a168d2..f07979a5618 100644 --- a/test-continuation/pom.xml +++ b/test-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 test-continuation diff --git a/test-jetty-nested/pom.xml b/test-jetty-nested/pom.xml index fe1d30e1ec7..adf850d21ff 100644 --- a/test-jetty-nested/pom.xml +++ b/test-jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT test-jetty-nested Jetty :: Nested Test diff --git a/test-jetty-servlet/pom.xml b/test-jetty-servlet/pom.xml index 70ae5f45078..b4b732b719e 100644 --- a/test-jetty-servlet/pom.xml +++ b/test-jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 test-jetty-servlet diff --git a/test-jetty-webapp/pom.xml b/test-jetty-webapp/pom.xml index 12494574129..45cbfe7353d 100644 --- a/test-jetty-webapp/pom.xml +++ b/test-jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 test-jetty-webapp diff --git a/tests/pom.xml b/tests/pom.xml index da8e17d490d..b4761a4a69e 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty jetty-project - 7.6.7.v20120910 + 7.6.8-SNAPSHOT org.eclipse.jetty.tests tests-parent diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml index 772c27fa3f6..949d9b2b201 100644 --- a/tests/test-integration/pom.xml +++ b/tests/test-integration/pom.xml @@ -20,7 +20,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT 4.0.0 test-integration diff --git a/tests/test-loginservice/pom.xml b/tests/test-loginservice/pom.xml index d32e35f5002..9bf59faa9cd 100644 --- a/tests/test-loginservice/pom.xml +++ b/tests/test-loginservice/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT test-loginservice Jetty Tests :: Login Service diff --git a/tests/test-sessions/pom.xml b/tests/test-sessions/pom.xml index d688e7e3b2e..edbe06b94fc 100644 --- a/tests/test-sessions/pom.xml +++ b/tests/test-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT test-sessions-parent Jetty Tests :: Sessions :: Parent diff --git a/tests/test-sessions/test-hash-sessions/pom.xml b/tests/test-sessions/test-hash-sessions/pom.xml index 128dd28efc2..28979d63e06 100644 --- a/tests/test-sessions/test-hash-sessions/pom.xml +++ b/tests/test-sessions/test-hash-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT test-hash-sessions Jetty Tests :: Sessions :: Hash diff --git a/tests/test-sessions/test-jdbc-sessions/pom.xml b/tests/test-sessions/test-jdbc-sessions/pom.xml index f77e4895d92..a2fec154f53 100644 --- a/tests/test-sessions/test-jdbc-sessions/pom.xml +++ b/tests/test-sessions/test-jdbc-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT test-jdbc-sessions Jetty Tests :: Sessions :: JDBC diff --git a/tests/test-sessions/test-mongodb-sessions/pom.xml b/tests/test-sessions/test-mongodb-sessions/pom.xml index 2a3d735904b..4b28896243c 100644 --- a/tests/test-sessions/test-mongodb-sessions/pom.xml +++ b/tests/test-sessions/test-mongodb-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.7.v20120910 + 7.6.8-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 c704f65319a..1e6a7941a5d 100644 --- a/tests/test-sessions/test-sessions-common/pom.xml +++ b/tests/test-sessions/test-sessions-common/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT test-sessions-common Jetty Tests :: Sessions :: Common diff --git a/tests/test-webapps/pom.xml b/tests/test-webapps/pom.xml index 62b791193a0..7ba2b864c0d 100644 --- a/tests/test-webapps/pom.xml +++ b/tests/test-webapps/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT test-webapps-parent Jetty Tests :: WebApps :: Parent diff --git a/tests/test-webapps/test-webapp-rfc2616/pom.xml b/tests/test-webapps/test-webapp-rfc2616/pom.xml index 4079f191b3d..3e5b85eca61 100644 --- a/tests/test-webapps/test-webapp-rfc2616/pom.xml +++ b/tests/test-webapps/test-webapp-rfc2616/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-webapps-parent - 7.6.7.v20120910 + 7.6.8-SNAPSHOT test-webapp-rfc2616 Jetty Tests :: WebApp :: RFC2616 From c7f8bdfee8d6ee4f0a73d4287cd6de778f7834f8 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Mon, 10 Sep 2012 16:10:42 -0500 Subject: [PATCH 06/56] prep for dev --- VERSION.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/VERSION.txt b/VERSION.txt index f8f836b1b8f..7f2af822831 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,3 +1,5 @@ +jetty-7.6.8-SNAPSHOT + jetty-7.6.7.v20120910 - 10 September 2012 + 388895 Update dependencies for jetty-jndi + fix busy logging statement re: sessions From 7af01587a82ed927b7c202037c17a7baf0f9d94f Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 13 Sep 2012 11:29:36 +1000 Subject: [PATCH 07/56] 389390 AnnotationConfiguration is ignored if the metadata-complete attribute is present in an override descriptor regardless of the value --- .../src/main/java/org/eclipse/jetty/webapp/MetaData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java index e9f6c249d0b..4434a8dd82d 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java @@ -201,7 +201,7 @@ public class MetaData _metaDataComplete=true; break; case False: - _metaDataComplete=true; + _metaDataComplete=false; break; case NotSet: break; From 0035343af33c3626e0d29bb3338e8e1256cabb50 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 13 Sep 2012 13:35:27 +1000 Subject: [PATCH 08/56] 388675 Non utf8 encoded query strings not decoded to parameter map using queryEncoding --- .../java/org/eclipse/jetty/http/HttpURI.java | 12 +- .../org/eclipse/jetty/server/Request.java | 10 +- .../java/org/eclipse/jetty/server/Server.java | 2 +- .../org/eclipse/jetty/server/HttpURITest.java | 105 ++++++++++++++++++ .../eclipse/jetty/servlet/DispatcherTest.java | 71 ++++++++++++ 5 files changed, 193 insertions(+), 7 deletions(-) diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java index 69e38239829..3a419db1ea8 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java @@ -94,7 +94,15 @@ public class HttpURI public HttpURI(String raw) { _rawString=raw; - byte[] b = raw.getBytes(); + byte[] b; + try + { + b = raw.getBytes(StringUtil.__UTF8); + } + catch (UnsupportedEncodingException e) + { + throw new RuntimeException(e.getMessage()); + } parse(b,0,b.length); } @@ -700,7 +708,7 @@ public class HttpURI if (encoding==null || StringUtil.isUTF8(encoding)) UrlEncoded.decodeUtf8To(_raw,_query+1,_fragment-_query-1,parameters); else - UrlEncoded.decodeTo(toUtf8String(_query+1,_fragment-_query-1),parameters,encoding); + UrlEncoded.decodeTo(StringUtil.toString(_raw,_query+1,_fragment-_query-1,encoding),parameters,encoding); } public void clear() diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index cf0118b0aa6..4d927bc3170 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -1739,6 +1739,7 @@ public class Request implements HttpServletRequest public void setQueryString(String queryString) { _queryString = queryString; + _queryEncoding = null; //assume utf-8 } /* ------------------------------------------------------------ */ @@ -1922,7 +1923,7 @@ public class Request implements HttpServletRequest { // extract parameters from dispatch query MultiMap parameters = new MultiMap(); - UrlEncoded.decodeTo(query,parameters,getCharacterEncoding()); + UrlEncoded.decodeTo(query,parameters, StringUtil.__UTF8); //have to assume UTF-8 because we can't know otherwise boolean merge_old_query = false; @@ -1957,10 +1958,11 @@ public class Request implements HttpServletRequest { StringBuilder overridden_query_string = new StringBuilder(); MultiMap overridden_old_query = new MultiMap(); - UrlEncoded.decodeTo(_queryString,overridden_old_query,getCharacterEncoding()); - + UrlEncoded.decodeTo(_queryString,overridden_old_query,getQueryEncoding());//decode using any queryencoding set for the request + + MultiMap overridden_new_query = new MultiMap(); - UrlEncoded.decodeTo(query,overridden_new_query,getCharacterEncoding()); + UrlEncoded.decodeTo(query,overridden_new_query,StringUtil.__UTF8); //have to assume utf8 as we cannot know otherwise Iterator> iter = overridden_old_query.entrySet().iterator(); while (iter.hasNext()) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java index 804ea5cbc2b..c891d63066d 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java @@ -386,7 +386,7 @@ public class Server extends HandlerWrapper implements Attributes baseRequest.setRequestURI(null); baseRequest.setPathInfo(baseRequest.getRequestURI()); if (uri.getQuery()!=null) - baseRequest.mergeQueryString(uri.getQuery()); + baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8 } final String target=baseRequest.getPathInfo(); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpURITest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpURITest.java index 823e58d2e77..b996bca42a9 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpURITest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpURITest.java @@ -19,6 +19,7 @@ package org.eclipse.jetty.server; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -26,12 +27,16 @@ import static org.junit.Assert.fail; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; +import java.util.Iterator; +import java.util.Set; import junit.framework.Assert; +import org.eclipse.jetty.http.EncodedHttpURI; import org.eclipse.jetty.http.HttpURI; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.util.MultiMap; +import org.eclipse.jetty.util.TypeUtil; import org.junit.Test; public class HttpURITest @@ -205,6 +210,106 @@ public class HttpURITest } } + + + @Test + public void testNoPercentEncodingOfQueryUsingNonUTF8() throws Exception + { + + byte[] utf8_bytes = "/%D0%A1%D1%82%D1%80%D0%BE%D0%BD%D0%B3-%D1%84%D0%B8%D0%BB%D1%8C%D1%82%D1%80/%D0%BA%D0%B0%D1%82%D0%B0%D0%BB%D0%BE%D0%B3?".getBytes("UTF-8"); + byte[] cp1251_bytes = TypeUtil.fromHexString("e2fbe1f0e0edee3dd2e5ecefe5f0e0f2f3f0e0"); + String expectedCP1251String = new String(cp1251_bytes, "cp1251"); + String expectedCP1251Key = new String(cp1251_bytes, 0, 7, "cp1251"); + String expectedCP1251Value = new String(cp1251_bytes, 8, cp1251_bytes.length-8, "cp1251"); + + //paste both byte arrays together to form the uri + byte[] allbytes = new byte[utf8_bytes.length+cp1251_bytes.length]; + int i=0; + for (;i expectedAttributeNames = Arrays.asList(Dispatcher.FORWARD_REQUEST_URI, Dispatcher.FORWARD_CONTEXT_PATH, + Dispatcher.FORWARD_SERVLET_PATH, Dispatcher.FORWARD_QUERY_STRING); + List requestAttributeNames = Collections.list(request.getAttributeNames()); + assertTrue(requestAttributeNames.containsAll(expectedAttributeNames)); + + assertEquals(null, request.getPathInfo()); + assertEquals(null, request.getPathTranslated()); + assertTrue(request.getQueryString().startsWith("do=end&else=%D0%B2%D1%8B%D0%B1%D1%80%D0%B0%D0%BD%D0%BE%3D%D0%A2%D0%B5%D0%BC%D0%BF%D0%B5%D1%80%D0%B0%D1%82%D1%83%D1%80%D0%B0&test=1&foreign=")); + + String[] vals = request.getParameterValues("foreign"); + assertTrue(vals!=null); + assertEquals(1, vals.length); + assertEquals(expectedCP1251String, vals[0]); + + assertEquals("/context/AssertForwardServlet", request.getRequestURI()); + assertEquals("/context", request.getContextPath()); + assertEquals("/AssertForwardServlet", request.getServletPath()); + + response.setContentType("text/html"); + response.setStatus(HttpServletResponse.SC_OK); + } + } + public static class AssertIncludeServlet extends HttpServlet implements Servlet { From 944b23240e0022e740c7e7cb833fd56cf34a5e5e Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 13 Sep 2012 17:03:10 +1000 Subject: [PATCH 09/56] 388706 Avoid unnecessary indirection through Charset.name --- .../org/eclipse/jetty/io/AbstractBuffer.java | 18 ++++++++++++++++++ .../main/java/org/eclipse/jetty/io/Buffer.java | 6 +++++- .../java/org/eclipse/jetty/io/BufferUtil.java | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractBuffer.java b/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractBuffer.java index 1c410e82d70..748016a6343 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractBuffer.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractBuffer.java @@ -21,6 +21,7 @@ package org.eclipse.jetty.io; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.charset.Charset; import org.eclipse.jetty.util.TypeUtil; import org.eclipse.jetty.util.log.Log; @@ -644,6 +645,23 @@ public abstract class AbstractBuffer implements Buffer } } + /* ------------------------------------------------------------ */ + public String toString(Charset charset) + { + try + { + byte[] bytes=array(); + if (bytes!=null) + return new String(bytes,getIndex(),length(),charset); + return new String(asArray(), 0, length(),charset); + } + catch(Exception e) + { + LOG.warn(e); + return new String(asArray(), 0, length()); + } + } + /* ------------------------------------------------------------ */ public String toDebugString() { diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/Buffer.java b/jetty-io/src/main/java/org/eclipse/jetty/io/Buffer.java index c6ff99ee7cc..ec6d23d77f1 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/Buffer.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/Buffer.java @@ -21,6 +21,7 @@ package org.eclipse.jetty.io; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.charset.Charset; /** @@ -365,7 +366,10 @@ public interface Buffer extends Cloneable /* ------------------------------------------------------------ */ String toString(String charset); - /* + /* ------------------------------------------------------------ */ + String toString(Charset charset); + + /* * Buffers implementing this interface should be compared with case insensitive equals * */ diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/BufferUtil.java b/jetty-io/src/main/java/org/eclipse/jetty/io/BufferUtil.java index 8c036347888..c24723dc906 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/BufferUtil.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/BufferUtil.java @@ -354,6 +354,6 @@ public class BufferUtil { if (buffer instanceof CachedBuffer) return buffer.toString(); - return buffer.toString(StringUtil.__ISO_8859_1); + return buffer.toString(StringUtil.__ISO_8859_1_CHARSET); } } From 394c478b19ee0b9b1c1e19a10ccafbdb18fddc27 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Fri, 14 Sep 2012 16:51:53 +1000 Subject: [PATCH 10/56] 389452 if web-fragment metadata-complete==true still scan its related jar if there there is a ServletContainerInitializer Also some refactoring to simplify scanning for annotations/classes. --- ...AbstractDiscoverableAnnotationHandler.java | 23 +- .../annotations/AnnotationConfiguration.java | 238 +++++++++----- .../jetty/annotations/AnnotationParser.java | 307 +++++++++++++++--- .../annotations/ClassInheritanceHandler.java | 8 +- ...ContainerInitializerAnnotationHandler.java | 11 + .../ServletContainerInitializerListener.java | 19 +- .../annotations/WebFilterAnnotation.java | 6 + .../WebFilterAnnotationHandler.java | 15 +- .../annotations/WebListenerAnnotation.java | 6 + .../WebListenerAnnotationHandler.java | 14 +- .../annotations/WebServletAnnotation.java | 9 +- .../WebServletAnnotationHandler.java | 14 +- .../TestAnnotationInheritance.java | 8 +- .../annotations/TestAnnotationParser.java | 21 +- .../annotations/AnnotationConfiguration.java | 31 +- .../jetty/webapp/DiscoveredAnnotation.java | 17 +- .../org/eclipse/jetty/webapp/MetaData.java | 34 +- 17 files changed, 611 insertions(+), 170 deletions(-) diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AbstractDiscoverableAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AbstractDiscoverableAnnotationHandler.java index 2367709243a..95c5b4145d2 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AbstractDiscoverableAnnotationHandler.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AbstractDiscoverableAnnotationHandler.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.jetty.annotations.AnnotationParser.DiscoverableAnnotationHandler; -import org.eclipse.jetty.annotations.AnnotationParser.Value; +import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.webapp.DiscoveredAnnotation; import org.eclipse.jetty.webapp.WebAppContext; @@ -34,13 +34,32 @@ import org.eclipse.jetty.webapp.WebAppContext; public abstract class AbstractDiscoverableAnnotationHandler implements DiscoverableAnnotationHandler { protected WebAppContext _context; - protected List _annotations = new ArrayList(); + protected List _annotations; + protected Resource _resource; public AbstractDiscoverableAnnotationHandler(WebAppContext context) + { + this(context, null); + } + + public AbstractDiscoverableAnnotationHandler(WebAppContext context, List list) { _context = context; + if (list == null) + _annotations = new ArrayList(); + else + _annotations = list; } + public Resource getResource() + { + return _resource; + } + + public void setResource(Resource resource) + { + _resource = resource; + } public List getAnnotationList () { diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java index 1ff4e9ca1c9..489c08b24b1 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java @@ -33,6 +33,7 @@ import javax.servlet.annotation.HandlesTypes; import org.eclipse.jetty.annotations.AnnotationParser.DiscoverableAnnotationHandler; import org.eclipse.jetty.plus.annotation.ContainerInitializer; +import org.eclipse.jetty.util.MultiMap; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.resource.Resource; @@ -55,12 +56,22 @@ public class AnnotationConfiguration extends AbstractConfiguration private static final Logger LOG = Log.getLogger(AnnotationConfiguration.class); public static final String CLASS_INHERITANCE_MAP = "org.eclipse.jetty.classInheritanceMap"; public static final String CONTAINER_INITIALIZERS = "org.eclipse.jetty.containerInitializers"; + + + protected List _discoverableAnnotationHandlers = new ArrayList(); + protected ClassInheritanceHandler _classInheritanceHandler; + protected List _containerInitializerAnnotationHandlers = new ArrayList(); public void preConfigure(final WebAppContext context) throws Exception { } + + + /** + * @see org.eclipse.jetty.webapp.AbstractConfiguration#configure(org.eclipse.jetty.webapp.WebAppContext) + */ @Override public void configure(WebAppContext context) throws Exception { @@ -75,10 +86,9 @@ public class AnnotationConfiguration extends AbstractConfiguration //If metadata isn't complete, if this is a servlet 3 webapp or isConfigDiscovered is true, we need to search for annotations if (context.getServletContext().getEffectiveMajorVersion() >= 3 || context.isConfigurationDiscovered()) { - parser = createAnnotationParser(); - parser.registerAnnotationHandler("javax.servlet.annotation.WebServlet", new WebServletAnnotationHandler(context)); - parser.registerAnnotationHandler("javax.servlet.annotation.WebFilter", new WebFilterAnnotationHandler(context)); - parser.registerAnnotationHandler("javax.servlet.annotation.WebListener", new WebListenerAnnotationHandler(context)); + _discoverableAnnotationHandlers.add(new WebServletAnnotationHandler(context)); + _discoverableAnnotationHandlers.add(new WebFilterAnnotationHandler(context)); + _discoverableAnnotationHandlers.add(new WebListenerAnnotationHandler(context)); } } else @@ -88,11 +98,11 @@ public class AnnotationConfiguration extends AbstractConfiguration //Regardless of metadata, if there are any ServletContainerInitializers with @HandlesTypes, then we need to scan all the //classes so we can call their onStartup() methods correctly - List nonExcludedInitializers = getNonExcludedInitializers(context); - parser = registerServletContainerInitializerAnnotationHandlers(context, parser, nonExcludedInitializers); + createServletContainerInitializerAnnotationHandlers(context, getNonExcludedInitializers(context)); - if (parser != null) + if (!_discoverableAnnotationHandlers.isEmpty() || _classInheritanceHandler != null || !_containerInitializerAnnotationHandlers.isEmpty()) { + parser = createAnnotationParser(); if (LOG.isDebugEnabled()) LOG.debug("Scanning all classses for annotations: webxmlVersion="+context.getServletContext().getEffectiveMajorVersion()+" configurationDiscovered="+context.isConfigurationDiscovered()); parseContainerPath(context, parser); //email from Rajiv Mordani jsrs 315 7 April 2010 @@ -102,11 +112,36 @@ public class AnnotationConfiguration extends AbstractConfiguration // WEB-INF/classes + order of the elements. parseWebInfClasses(context, parser); parseWebInfLib (context, parser); + + for (DiscoverableAnnotationHandler h:_discoverableAnnotationHandlers) + context.getMetaData().addDiscoveredAnnotations(((AbstractDiscoverableAnnotationHandler)h).getAnnotationList()); } } + /** + * @see org.eclipse.jetty.webapp.AbstractConfiguration#postConfigure(org.eclipse.jetty.webapp.WebAppContext) + */ + @Override + public void postConfigure(WebAppContext context) throws Exception + { + MultiMap map = (MultiMap)context.getAttribute(CLASS_INHERITANCE_MAP); + if (map != null) + map.clear(); + List initializers = (List)context.getAttribute(CONTAINER_INITIALIZERS); + if (initializers != null) + initializers.clear(); + if (_discoverableAnnotationHandlers != null) + _discoverableAnnotationHandlers.clear(); + _discoverableAnnotationHandlers = null; + _classInheritanceHandler = null; + if (_containerInitializerAnnotationHandlers != null) + _containerInitializerAnnotationHandlers.clear(); + _containerInitializerAnnotationHandlers = null; + super.postConfigure(context); + } + /** * @return a new AnnotationParser. This method can be overridden to use a different impleemntation of * the AnnotationParser. Note that this is considered internal API. @@ -116,6 +151,9 @@ public class AnnotationConfiguration extends AbstractConfiguration return new AnnotationParser(); } + /** + * @see org.eclipse.jetty.webapp.AbstractConfiguration#cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext) + */ @Override public void cloneConfigure(WebAppContext template, WebAppContext context) throws Exception { @@ -123,32 +161,21 @@ public class AnnotationConfiguration extends AbstractConfiguration } - - - public AnnotationParser registerServletContainerInitializerAnnotationHandlers (WebAppContext context, AnnotationParser parser, List scis) + + /** + * @param context + * @param scis + * @throws Exception + */ + public void createServletContainerInitializerAnnotationHandlers (WebAppContext context, List scis) throws Exception - { - - //TODO verify my interpretation of the spec. That is, that metadata-complete has nothing - //to do with finding the ServletContainerInitializers, classes designated to be of interest to them, - //or even calling them on startup. - - //Get all ServletContainerInitializers, and check them for HandlesTypes annotations. - //For each class in the HandlesTypes value, if it IS an annotation, register a handler - //that will record the classes that have that annotation. - //If it is NOT an annotation, then we will interrogate the type hierarchy discovered during - //parsing later on to find the applicable classes. + { if (scis == null || scis.isEmpty()) - return parser; // nothing to do - - ServletContainerInitializerListener listener = new ServletContainerInitializerListener(); - listener.setWebAppContext(context); - context.addEventListener(listener); - - //may need to add a listener + return; // nothing to do - ArrayList initializers = new ArrayList(); + + List initializers = new ArrayList(); context.setAttribute(CONTAINER_INITIALIZERS, initializers); for (ServletContainerInitializer service : scis) @@ -164,18 +191,14 @@ public class AnnotationConfiguration extends AbstractConfiguration if (classes != null) { initializer.setInterestedTypes(classes); - - //We need to create a parser if we haven't already - if (parser == null) - parser = createAnnotationParser(); - + //If we haven't already done so, we need to register a handler that will - //process the whole class hierarchy + //process the whole class hierarchy to satisfy the ServletContainerInitializer if (context.getAttribute(CLASS_INHERITANCE_MAP) == null) { - ClassInheritanceHandler classHandler = new ClassInheritanceHandler(); - context.setAttribute(CLASS_INHERITANCE_MAP, classHandler.getMap()); - parser.registerClassHandler(classHandler); + MultiMap map = new MultiMap(); + context.setAttribute(CLASS_INHERITANCE_MAP, map); + _classInheritanceHandler = new ClassInheritanceHandler(map); } for (Class c: classes) @@ -186,7 +209,7 @@ public class AnnotationConfiguration extends AbstractConfiguration { if (LOG.isDebugEnabled()) LOG.debug("Registering annotation handler for "+c.getName()); - parser.registerAnnotationHandler(c.getName(), new ContainerInitializerAnnotationHandler(initializer, c)); + _containerInitializerAnnotationHandlers.add(new ContainerInitializerAnnotationHandler(initializer, c)); } } } @@ -197,15 +220,15 @@ public class AnnotationConfiguration extends AbstractConfiguration if (LOG.isDebugEnabled()) LOG.debug("No annotation on initializer "+service.getClass()); } - //return the parser in case we lazily created it - return parser; + + //add a listener which will call the servletcontainerinitializers when appropriate + ServletContainerInitializerListener listener = new ServletContainerInitializerListener(); + listener.setWebAppContext(context); + context.addEventListener(listener); } - - - /** * Check to see if the ServletContainerIntializer loaded via the ServiceLoader came * from a jar that is excluded by the fragment ordering. See ServletSpec 3.0 p.85. @@ -248,7 +271,12 @@ public class AnnotationConfiguration extends AbstractConfiguration - public List getNonExcludedInitializers (WebAppContext context) + /** + * @param context + * @return + * @throws Exception + */ + public List getNonExcludedInitializers (WebAppContext context) throws Exception { List nonExcludedInitializers = new ArrayList(); @@ -270,14 +298,29 @@ public class AnnotationConfiguration extends AbstractConfiguration + /** + * Scan jars on container path. + * + * @param context + * @param parser + * @throws Exception + */ public void parseContainerPath (final WebAppContext context, final AnnotationParser parser) throws Exception { //if no pattern for the container path is defined, then by default scan NOTHING LOG.debug("Scanning container jars"); - //clear any previously discovered annotations - clearAnnotationList(parser.getAnnotationHandlers()); + //always parse for discoverable annotations as well as class hierarchy and servletcontainerinitializer related annotations + parser.clearHandlers(); + for (DiscoverableAnnotationHandler h:_discoverableAnnotationHandlers) + { + if (h instanceof AbstractDiscoverableAnnotationHandler) + ((AbstractDiscoverableAnnotationHandler)h).setResource(null); // + } + parser.registerHandlers(_discoverableAnnotationHandlers); + parser.registerHandler(_classInheritanceHandler); + parser.registerHandlers(_containerInitializerAnnotationHandlers); //Convert from Resource to URI ArrayList containerUris = new ArrayList(); @@ -304,16 +347,19 @@ public class AnnotationConfiguration extends AbstractConfiguration return true; return false; } - }); + }); - //gather together all annotations discovered - List annotations = new ArrayList(); - gatherAnnotations(annotations, parser.getAnnotationHandlers()); - - context.getMetaData().addDiscoveredAnnotations(annotations); + } + /** + * Scan jars in WEB-INF/lib + * + * @param context + * @param parser + * @throws Exception + */ public void parseWebInfLib (final WebAppContext context, final AnnotationParser parser) throws Exception { @@ -332,17 +378,34 @@ public class AnnotationConfiguration extends AbstractConfiguration for (Resource r : jars) { - //clear any previously discovered annotations from handlers - clearAnnotationList(parser.getAnnotationHandlers()); - - + //for each jar, we decide which set of annotations we need to parse for + parser.clearHandlers(); URI uri = r.getURI(); FragmentDescriptor f = getFragmentFromJar(r, frags); - //if a jar has no web-fragment.xml we scan it (because it is not exluded by the ordering) + //if its from a fragment jar that is metadata complete, we should skip scanning for @webservlet etc + // but yet we still need to do the scanning for the classes on behalf of the servletcontainerinitializers + //if a jar has no web-fragment.xml we scan it (because it is not excluded by the ordering) //or if it has a fragment we scan it if it is not metadata complete - if (f == null || !isMetaDataComplete(f)) + if (f == null || !isMetaDataComplete(f) || _classInheritanceHandler != null || !_containerInitializerAnnotationHandlers.isEmpty()) { + //register the classinheritance handler if there is one + parser.registerHandler(_classInheritanceHandler); + + //register the handlers for the @HandlesTypes values that are themselves annotations if there are any + parser.registerHandlers(_containerInitializerAnnotationHandlers); + + //only register the discoverable annotation handlers if this fragment is not metadata complete, or has no fragment descriptor + if (f == null || !isMetaDataComplete(f)) + { + for (DiscoverableAnnotationHandler h:_discoverableAnnotationHandlers) + { + if (h instanceof AbstractDiscoverableAnnotationHandler) + ((AbstractDiscoverableAnnotationHandler)h).setResource(r); + } + parser.registerHandlers(_discoverableAnnotationHandlers); + } + parser.parse(uri, new ClassNameResolver() { @@ -360,14 +423,18 @@ public class AnnotationConfiguration extends AbstractConfiguration return false; return true; } - }); - List annotations = new ArrayList(); - gatherAnnotations(annotations, parser.getAnnotationHandlers()); - context.getMetaData().addDiscoveredAnnotations(r, annotations); + }); } } } + /** + * Scan classes in WEB-INF/classes + * + * @param context + * @param parser + * @throws Exception + */ public void parseWebInfClasses (final WebAppContext context, final AnnotationParser parser) throws Exception { @@ -377,7 +444,16 @@ public class AnnotationConfiguration extends AbstractConfiguration Resource classesDir = context.getWebInf().addPath("classes/"); if (classesDir.exists()) { - clearAnnotationList(parser.getAnnotationHandlers()); + parser.clearHandlers(); + for (DiscoverableAnnotationHandler h:_discoverableAnnotationHandlers) + { + if (h instanceof AbstractDiscoverableAnnotationHandler) + ((AbstractDiscoverableAnnotationHandler)h).setResource(null); // + } + parser.registerHandlers(_discoverableAnnotationHandlers); + parser.registerHandler(_classInheritanceHandler); + parser.registerHandlers(_containerInitializerAnnotationHandlers); + parser.parse(classesDir, new ClassNameResolver() { @@ -396,17 +472,20 @@ public class AnnotationConfiguration extends AbstractConfiguration return true; } }); - - //TODO - where to set the annotations discovered from WEB-INF/classes? - List annotations = new ArrayList(); - gatherAnnotations(annotations, parser.getAnnotationHandlers()); - context.getMetaData().addDiscoveredAnnotations (annotations); } } } + /** + * Get the web-fragment.xml from a jar + * + * @param jar + * @param frags + * @return + * @throws Exception + */ public FragmentDescriptor getFragmentFromJar (Resource jar, List frags) throws Exception { @@ -428,25 +507,4 @@ public class AnnotationConfiguration extends AbstractConfiguration { return (d!=null && d.getMetaDataComplete() == MetaDataComplete.True); } - - protected void clearAnnotationList (List handlers) - { - if (handlers == null) - return; - - for (DiscoverableAnnotationHandler h:handlers) - { - if (h instanceof AbstractDiscoverableAnnotationHandler) - ((AbstractDiscoverableAnnotationHandler)h).resetList(); - } - } - - protected void gatherAnnotations (List annotations, List handlers) - { - for (DiscoverableAnnotationHandler h:handlers) - { - if (h instanceof AbstractDiscoverableAnnotationHandler) - annotations.addAll(((AbstractDiscoverableAnnotationHandler)h).getAnnotationList()); - } - } } diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java index 3f8b55f9ec1..3838239e311 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java @@ -53,11 +53,8 @@ public class AnnotationParser { private static final Logger LOG = Log.getLogger(AnnotationParser.class); - protected List _parsedClassNames = new ArrayList(); - protected Map> _annotationHandlers = new HashMap>(); - protected List _classHandlers = new ArrayList(); - protected List _methodHandlers = new ArrayList(); - protected List _fieldHandlers = new ArrayList(); + protected List _parsedClassNames = new ArrayList(); + protected List _handlers = new ArrayList(); public static String normalize (String name) { @@ -168,37 +165,122 @@ public class AnnotationParser - public interface DiscoverableAnnotationHandler + /** + * Handler + * + * Signature for all handlers that respond to parsing class files. + */ + public interface Handler { + + } + + + + /** + * DiscoverableAnnotationHandler + * + * Processes an annotation when it is discovered on a class. + */ + public interface DiscoverableAnnotationHandler extends Handler + { + /** + * Process an annotation that was discovered on a class + * @param className + * @param version + * @param access + * @param signature + * @param superName + * @param interfaces + * @param annotation + * @param values + */ public void handleClass (String className, int version, int access, String signature, String superName, String[] interfaces, String annotation, Listvalues); + /** + * Process an annotation that was discovered on a method + * @param className + * @param methodName + * @param access + * @param desc + * @param signature + * @param exceptions + * @param annotation + * @param values + */ public void handleMethod (String className, String methodName, int access, String desc, String signature,String[] exceptions, String annotation, Listvalues); + + /** + * Process an annotation that was discovered on a field + * @param className + * @param fieldName + * @param access + * @param fieldType + * @param signature + * @param value + * @param annotation + * @param values + */ public void handleField (String className, String fieldName, int access, String fieldType, String signature, Object value, String annotation, Listvalues); + + + /** + * Get the name of the annotation processed by this handler. Can be null + * + * @return + */ + public String getAnnotationName(); } - public interface ClassHandler + + /** + * ClassHandler + * + * Responds to finding a Class + */ + public interface ClassHandler extends Handler { public void handle (String className, int version, int access, String signature, String superName, String[] interfaces); } - public interface MethodHandler + + + /** + * MethodHandler + * + * Responds to finding a Method + */ + public interface MethodHandler extends Handler { public void handle (String className, String methodName, int access, String desc, String signature,String[] exceptions); } - public interface FieldHandler + + /** + * FieldHandler + * + * Responds to finding a Field + */ + public interface FieldHandler extends Handler { public void handle (String className, String fieldName, int access, String fieldType, String signature, Object value); } + + + /** + * MyAnnotationVisitor + * + * ASM Visitor for Annotations + */ public class MyAnnotationVisitor implements AnnotationVisitor { List _annotationValues; @@ -307,10 +389,13 @@ public class AnnotationParser for (String s : interfaces) normalizedInterfaces[i++] = normalize(s); } - - for (ClassHandler h : AnnotationParser.this._classHandlers) + + for (Handler h : AnnotationParser.this._handlers) { - h.handle(_className, _version, _access, _signature, normalize(_superName), normalizedInterfaces); + if (h instanceof ClassHandler) + { + ((ClassHandler)h).handle(_className, _version, _access, _signature, normalize(_superName), normalizedInterfaces); + } } } @@ -323,12 +408,13 @@ public class AnnotationParser super.visitEnd(); //call all AnnotationHandlers with classname, annotation name + values - List handlers = AnnotationParser.this._annotationHandlers.get(_annotationName); - if (handlers != null) + for (Handler h : AnnotationParser.this._handlers) { - for (DiscoverableAnnotationHandler h:handlers) + if (h instanceof DiscoverableAnnotationHandler) { - h.handleClass(_className, _version, _access, _signature, _superName, _interfaces, _annotationName, _annotationValues); + DiscoverableAnnotationHandler dah = (DiscoverableAnnotationHandler)h; + if (_annotationName.equalsIgnoreCase(dah.getAnnotationName())) + dah.handleClass(_className, _version, _access, _signature, _superName, _interfaces, _annotationName, _annotationValues); } } } @@ -354,12 +440,13 @@ public class AnnotationParser { super.visitEnd(); //call all AnnotationHandlers with classname, method, annotation name + values - List handlers = AnnotationParser.this._annotationHandlers.get(_annotationName); - if (handlers != null) + for (Handler h : AnnotationParser.this._handlers) { - for (DiscoverableAnnotationHandler h:handlers) + if (h instanceof DiscoverableAnnotationHandler) { - h.handleMethod(_className, name, access, methodDesc, signature, exceptions, _annotationName, _annotationValues); + DiscoverableAnnotationHandler dah = (DiscoverableAnnotationHandler)h; + if (_annotationName.equalsIgnoreCase(dah.getAnnotationName())) + dah.handleMethod(_className, name, access, methodDesc, signature, exceptions, _annotationName, _annotationValues); } } } @@ -386,12 +473,13 @@ public class AnnotationParser public void visitEnd() { super.visitEnd(); - List handlers = AnnotationParser.this._annotationHandlers.get(_annotationName); - if (handlers != null) + for (Handler h : AnnotationParser.this._handlers) { - for (DiscoverableAnnotationHandler h:handlers) + if (h instanceof DiscoverableAnnotationHandler) { - h.handleField(_className, fieldName, access, fieldType, signature, value, _annotationName, _annotationValues); + DiscoverableAnnotationHandler dah = (DiscoverableAnnotationHandler)h; + if (_annotationName.equalsIgnoreCase(dah.getAnnotationName())) + dah.handleField(_className, fieldName, access, fieldType, signature, value, _annotationName, _annotationValues); } } } @@ -407,46 +495,130 @@ public class AnnotationParser * Register a handler that will be called back when the named annotation is * encountered on a class. * + * @deprecated see registerHandler(Handler) * @param annotationName * @param handler */ public void registerAnnotationHandler (String annotationName, DiscoverableAnnotationHandler handler) { - List handlers = _annotationHandlers.get(annotationName); - if (handlers == null) - { - handlers = new ArrayList(); - _annotationHandlers.put(annotationName, handlers); - } - handlers.add(handler); + _handlers.add(handler); } + + /** + * @deprecated + * @param annotationName + * @return + */ public List getAnnotationHandlers(String annotationName) { - List handlers = _annotationHandlers.get(annotationName); - if (handlers == null) - return Collections.emptyList(); - return new ArrayList(); + List handlers = new ArrayList(); + for (Handler h:_handlers) + { + if (h instanceof DiscoverableAnnotationHandler) + { + DiscoverableAnnotationHandler dah = (DiscoverableAnnotationHandler)h; + if (annotationName.equals(dah.getAnnotationName())) + handlers.add(dah); + } + } + + return handlers; } + /** + * @deprecated + * @return + */ public List getAnnotationHandlers() { - List allHandlers = new ArrayList(); - for (List list:_annotationHandlers.values()) - allHandlers.addAll(list); - return allHandlers; + List allAnnotationHandlers = new ArrayList(); + for (Handler h:_handlers) + { + if (h instanceof DiscoverableAnnotationHandler) + allAnnotationHandlers.add((DiscoverableAnnotationHandler)h); + } + return allAnnotationHandlers; } + /** + * @deprecated see registerHandler(Handler) + * @param handler + */ public void registerClassHandler (ClassHandler handler) { - _classHandlers.add(handler); + _handlers.add(handler); } + + + + /** + * Add a particular handler + * + * @param h + */ + public void registerHandler(Handler h) + { + if (h == null) + return; + + _handlers.add(h); + } + + + /** + * Add a list of handlers + * + * @param handlers + */ + public void registerHandlers(List handlers) + { + if (handlers == null) + return; + _handlers.addAll(handlers); + } + + + /** + * Remove a particular handler + * + * @param h + * @return + */ + public boolean deregisterHandler(Handler h) + { + return _handlers.remove(h); + } + + + /** + * Remove all registered handlers + */ + public void clearHandlers() + { + _handlers.clear(); + } + + /** + * True if the class has already been processed, false otherwise + * @param className + * @return + */ public boolean isParsed (String className) { return _parsedClassNames.contains(className); } + + + /** + * Parse a given class + * + * @param className + * @param resolver + * @throws Exception + */ public void parse (String className, ClassNameResolver resolver) throws Exception { @@ -468,6 +640,16 @@ public class AnnotationParser } } + + + /** + * Parse the given class, optionally walking its inheritance hierarchy + * + * @param clazz + * @param resolver + * @param visitSuperClasses + * @throws Exception + */ public void parse (Class clazz, ClassNameResolver resolver, boolean visitSuperClasses) throws Exception { @@ -494,6 +676,15 @@ public class AnnotationParser } } + + + /** + * Parse the given classes + * + * @param classNames + * @param resolver + * @throws Exception + */ public void parse (String[] classNames, ClassNameResolver resolver) throws Exception { @@ -503,6 +694,14 @@ public class AnnotationParser parse(Arrays.asList(classNames), resolver); } + + /** + * Parse the given classes + * + * @param classNames + * @param resolver + * @throws Exception + */ public void parse (List classNames, ClassNameResolver resolver) throws Exception { @@ -521,6 +720,14 @@ public class AnnotationParser } } + + /** + * Parse all classes in a directory + * + * @param dir + * @param resolver + * @throws Exception + */ public void parse (Resource dir, ClassNameResolver resolver) throws Exception { @@ -556,8 +763,9 @@ public class AnnotationParser /** - * Find annotations on classes in the supplied classloader. + * Parse classes in the supplied classloader. * Only class files in jar files will be scanned. + * * @param loader * @param visitParents * @param nullInclusive @@ -606,7 +814,8 @@ public class AnnotationParser /** - * Find annotations in classes in the supplied url of jar files. + * Parse classes in the supplied url of jar files. + * * @param uris * @param resolver * @throws Exception @@ -648,6 +857,12 @@ public class AnnotationParser scanner.scan(null, uris, true); } + /** + * Parse a particular resource + * @param uri + * @param resolver + * @throws Exception + */ public void parse (URI uri, final ClassNameResolver resolver) throws Exception { @@ -657,6 +872,14 @@ public class AnnotationParser parse(uris, resolver); } + + + /** + * Use ASM on a class + * + * @param is + * @throws IOException + */ protected void scanClass (InputStream is) throws IOException { diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ClassInheritanceHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ClassInheritanceHandler.java index 79f111a0abc..8242b08d74e 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ClassInheritanceHandler.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ClassInheritanceHandler.java @@ -35,10 +35,16 @@ public class ClassInheritanceHandler implements ClassHandler private static final Logger LOG = Log.getLogger(ClassInheritanceHandler.class); - MultiMap _inheritanceMap = new MultiMap(); + MultiMap _inheritanceMap; public ClassInheritanceHandler() { + _inheritanceMap = new MultiMap(); + } + + public ClassInheritanceHandler(MultiMap map) + { + _inheritanceMap = map; } public void handle(String className, int version, int access, String signature, String superName, String[] interfaces) diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ContainerInitializerAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ContainerInitializerAnnotationHandler.java index db728651ae7..e84188e6405 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ContainerInitializerAnnotationHandler.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ContainerInitializerAnnotationHandler.java @@ -69,4 +69,15 @@ public class ContainerInitializerAnnotationHandler implements DiscoverableAnnota _initializer.addAnnotatedTypeName(className); } + @Override + public String getAnnotationName() + { + return _annotation.getName(); + } + + public ContainerInitializer getContainerInitializer() + { + return _initializer; + } + } diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ServletContainerInitializerListener.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ServletContainerInitializerListener.java index 04fe24a1aee..641859a521e 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ServletContainerInitializerListener.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ServletContainerInitializerListener.java @@ -28,6 +28,8 @@ import javax.servlet.ServletContextListener; import org.eclipse.jetty.annotations.AnnotationConfiguration; import org.eclipse.jetty.plus.annotation.ContainerInitializer; import org.eclipse.jetty.util.MultiMap; +import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.webapp.WebAppContext; /** @@ -37,7 +39,8 @@ import org.eclipse.jetty.webapp.WebAppContext; */ public class ServletContainerInitializerListener implements ServletContextListener { - WebAppContext _context = null; + private static final Logger LOG = Log.getLogger(ServletContainerInitializerListener.class); + protected WebAppContext _context = null; public void setWebAppContext (WebAppContext context) @@ -105,16 +108,11 @@ public class ServletContainerInitializerListener implements ServletContextListen } catch (Exception e) { - //OK, how do I throw an exception such that it really stops the startup sequence? - e.printStackTrace(); + LOG.warn(e); + throw new RuntimeException(e); } } - - //Email from Jan Luehe 18 August: after all ServletContainerInitializers have been - //called, need to check to see if there are any ServletRegistrations remaining - //that are "preliminary" and fail the deployment if so. Implemented in ServletHolder.doStart(). - } - + } } @@ -138,8 +136,7 @@ public class ServletContainerInitializerListener implements ServletContextListen */ public void contextDestroyed(ServletContextEvent sce) { - // TODO Auto-generated method stub - + } } diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebFilterAnnotation.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebFilterAnnotation.java index e61e4992ca1..f3824a9025d 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebFilterAnnotation.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebFilterAnnotation.java @@ -31,6 +31,7 @@ import org.eclipse.jetty.servlet.FilterMapping; import org.eclipse.jetty.servlet.Holder; 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.webapp.DiscoveredAnnotation; import org.eclipse.jetty.webapp.MetaData; import org.eclipse.jetty.webapp.WebAppContext; @@ -53,6 +54,11 @@ public class WebFilterAnnotation extends DiscoveredAnnotation { super(context, className); } + + public WebFilterAnnotation(WebAppContext context, String className, Resource resource) + { + super(context, className, resource); + } /** * @see org.eclipse.jetty.annotations.ClassAnnotation#apply() diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebFilterAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebFilterAnnotationHandler.java index 53956c0a560..1be7b2c9ecf 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebFilterAnnotationHandler.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebFilterAnnotationHandler.java @@ -40,11 +40,16 @@ public class WebFilterAnnotationHandler extends AbstractDiscoverableAnnotationHa { super(context); } - + + public WebFilterAnnotationHandler (WebAppContext context, List list) + { + super(context, list); + } + public void handleClass(String className, int version, int access, String signature, String superName, String[] interfaces, String annotation, List values) { - WebFilterAnnotation wfAnnotation = new WebFilterAnnotation(_context, className); + WebFilterAnnotation wfAnnotation = new WebFilterAnnotation(_context, className, _resource); addAnnotation(wfAnnotation); } @@ -60,4 +65,10 @@ public class WebFilterAnnotationHandler extends AbstractDiscoverableAnnotationHa LOG.warn ("@WebFilter not applicable for methods: "+className+"."+methodName+" "+signature); } + @Override + public String getAnnotationName() + { + return "javax.servlet.annotation.WebFilter"; + } + } diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebListenerAnnotation.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebListenerAnnotation.java index 48a96570297..cb48ba46298 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebListenerAnnotation.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebListenerAnnotation.java @@ -27,6 +27,7 @@ import javax.servlet.http.HttpSessionListener; 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.webapp.DiscoveredAnnotation; import org.eclipse.jetty.webapp.MetaData; import org.eclipse.jetty.webapp.WebAppContext; @@ -49,6 +50,11 @@ public class WebListenerAnnotation extends DiscoveredAnnotation { super(context, className); } + + public WebListenerAnnotation(WebAppContext context, String className, Resource resource) + { + super(context, className, resource); + } /** * @see org.eclipse.jetty.annotations.ClassAnnotation#apply() diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebListenerAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebListenerAnnotationHandler.java index 91fdd9d4712..2dd1c16bd1c 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebListenerAnnotationHandler.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebListenerAnnotationHandler.java @@ -23,6 +23,7 @@ import java.util.List; import org.eclipse.jetty.annotations.AnnotationParser.Value; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.webapp.DiscoveredAnnotation; import org.eclipse.jetty.webapp.WebAppContext; public class WebListenerAnnotationHandler extends AbstractDiscoverableAnnotationHandler @@ -34,13 +35,18 @@ public class WebListenerAnnotationHandler extends AbstractDiscoverableAnnotation super(context); } + public WebListenerAnnotationHandler (WebAppContext context, List list) + { + super(context, list); + } + /** * @see org.eclipse.jetty.annotations.AnnotationParser.DiscoverableAnnotationHandler#handleClass(java.lang.String, int, int, java.lang.String, java.lang.String, java.lang.String[], java.lang.String, java.util.List) */ public void handleClass(String className, int version, int access, String signature, String superName, String[] interfaces, String annotation, List values) { - WebListenerAnnotation wlAnnotation = new WebListenerAnnotation(_context, className); + WebListenerAnnotation wlAnnotation = new WebListenerAnnotation(_context, className, _resource); addAnnotation(wlAnnotation); } @@ -56,4 +62,10 @@ public class WebListenerAnnotationHandler extends AbstractDiscoverableAnnotation LOG.warn ("@WebListener is not applicable to methods: "+className+"."+methodName+" "+signature); } + @Override + public String getAnnotationName() + { + return "javax.servlet.annotation.WebListener"; + } + } diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebServletAnnotation.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebServletAnnotation.java index 9a4ff749291..62965baeedd 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebServletAnnotation.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebServletAnnotation.java @@ -30,6 +30,7 @@ import org.eclipse.jetty.servlet.ServletMapping; import org.eclipse.jetty.util.LazyList; 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.webapp.DiscoveredAnnotation; import org.eclipse.jetty.webapp.MetaData; import org.eclipse.jetty.webapp.WebAppContext; @@ -48,7 +49,13 @@ public class WebServletAnnotation extends DiscoveredAnnotation { super(context, className); } - + + + public WebServletAnnotation (WebAppContext context, String className, Resource resource) + { + super(context, className, resource); + } + /** * @see org.eclipse.jetty.annotations.ClassAnnotation#apply() */ diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebServletAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebServletAnnotationHandler.java index f9f640962c8..0f74eb906f1 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebServletAnnotationHandler.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/WebServletAnnotationHandler.java @@ -42,6 +42,11 @@ public class WebServletAnnotationHandler extends AbstractDiscoverableAnnotationH super(context); } + public WebServletAnnotationHandler (WebAppContext context, List list) + { + super(context, list); + } + /** * Handle discovering a WebServlet annotation. @@ -55,7 +60,7 @@ public class WebServletAnnotationHandler extends AbstractDiscoverableAnnotationH if (!"javax.servlet.annotation.WebServlet".equals(annotationName)) return; - WebServletAnnotation annotation = new WebServletAnnotation (_context, className); + WebServletAnnotation annotation = new WebServletAnnotation (_context, className, _resource); addAnnotation(annotation); } @@ -69,5 +74,12 @@ public class WebServletAnnotationHandler extends AbstractDiscoverableAnnotationH List values) { LOG.warn ("@WebServlet annotation not supported for methods"); + } + + + @Override + public String getAnnotationName() + { + return "javax.servlet.annotation.WebServlet"; } } diff --git a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationInheritance.java b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationInheritance.java index cd8c4b791bb..4deb5408f5e 100644 --- a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationInheritance.java +++ b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationInheritance.java @@ -66,6 +66,12 @@ public class TestAnnotationInheritance { annotatedMethods.add(className+"."+methodName); } + + @Override + public String getAnnotationName() + { + return "org.eclipse.jetty.annotations.Sample"; + } } @After @@ -85,7 +91,7 @@ public class TestAnnotationInheritance SampleHandler handler = new SampleHandler(); AnnotationParser parser = new AnnotationParser(); - parser.registerAnnotationHandler("org.eclipse.jetty.annotations.Sample", handler); + parser.registerHandler(handler); parser.parse(classNames, new ClassNameResolver () { public boolean isExcluded(String name) diff --git a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationParser.java b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationParser.java index ec740051706..ec00c9b905f 100644 --- a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationParser.java +++ b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationParser.java @@ -41,6 +41,9 @@ public class TestAnnotationParser { private List methods = Arrays.asList("a", "b", "c", "d", "l"); + + + public void handleClass(String className, int version, int access, String signature, String superName, String[] interfaces, String annotation, List values) { @@ -81,9 +84,15 @@ public class TestAnnotationParser assertTrue(methods.contains(methodName)); assertEquals("org.eclipse.jetty.annotations.Sample", annotation); } + + @Override + public String getAnnotationName() + { + return "org.eclipse.jetty.annotations.Sample"; + } } - parser.registerAnnotationHandler("org.eclipse.jetty.annotations.Sample", new SampleAnnotationHandler()); + parser.registerHandler(new SampleAnnotationHandler()); long start = System.currentTimeMillis(); parser.parse(classNames, new ClassNameResolver () @@ -140,9 +149,17 @@ public class TestAnnotationParser System.err.println(anv.toString()); } } + + @Override + public String getAnnotationName() + { + return "org.eclipse.jetty.annotations.Multi"; + } + + } - parser.registerAnnotationHandler("org.eclipse.jetty.annotations.Multi", new MultiAnnotationHandler()); + parser.registerHandler(new MultiAnnotationHandler()); parser.parse(classNames, null); } } diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationConfiguration.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationConfiguration.java index 55be1dbf55a..4005f9a3974 100644 --- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationConfiguration.java +++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationConfiguration.java @@ -21,6 +21,8 @@ package org.eclipse.jetty.osgi.annotations; import java.util.ArrayList; import java.util.List; +import org.eclipse.jetty.annotations.AbstractDiscoverableAnnotationHandler; +import org.eclipse.jetty.annotations.AnnotationParser.DiscoverableAnnotationHandler; import org.eclipse.jetty.annotations.ClassNameResolver; import org.eclipse.jetty.osgi.boot.OSGiWebappConstants; import org.eclipse.jetty.osgi.boot.utils.internal.PackageAdminServiceTracker; @@ -151,20 +153,25 @@ public class AnnotationConfiguration extends org.eclipse.jetty.annotations.Annot protected void parseBundle(WebAppContext context, AnnotationParser parser, Bundle webbundle, Bundle bundle) throws Exception { + Resource bundleRes = parser.getResource(bundle); + + parser.clearHandlers(); + for (DiscoverableAnnotationHandler h:_discoverableAnnotationHandlers) + { + if (h instanceof AbstractDiscoverableAnnotationHandler) + { + if (webbundle == bundle) + ((AbstractDiscoverableAnnotationHandler)h).setResource(null); + else + ((AbstractDiscoverableAnnotationHandler)h).setResource(bundleRes); + } + } + parser.registerHandlers(_discoverableAnnotationHandlers); + parser.registerHandler(_classInheritanceHandler); + parser.registerHandlers(_containerInitializerAnnotationHandlers); + parser.parse(bundle,createClassNameResolver(context)); - List annotations = new ArrayList(); - gatherAnnotations(annotations, parser.getAnnotationHandlers()); - if (webbundle == bundle) - { - //just like the super with its question about annotations in WEB-INF/classes: - //"TODO - where to set the annotations discovered from WEB-INF/classes?" - context.getMetaData().addDiscoveredAnnotations(annotations); - } - else - { - context.getMetaData().addDiscoveredAnnotations(bundleRes, annotations); - } } /** diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/DiscoveredAnnotation.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/DiscoveredAnnotation.java index 8df641817d0..988414b85f2 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/DiscoveredAnnotation.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/DiscoveredAnnotation.java @@ -21,6 +21,7 @@ package org.eclipse.jetty.webapp; import org.eclipse.jetty.util.Loader; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.util.resource.Resource; /** * DiscoveredAnnotation @@ -36,16 +37,28 @@ public abstract class DiscoveredAnnotation protected WebAppContext _context; protected String _className; protected Class _clazz; + protected Resource _resource; //resource it was discovered on, can be null (eg from WEB-INF/classes) public abstract void apply(); public DiscoveredAnnotation (WebAppContext context, String className) { - _context = context; - _className = className; + this(context,className, null); } + public DiscoveredAnnotation(WebAppContext context, String className, Resource resource) + { + _context = context; + _className = className; + _resource = resource; + } + + public Resource getResource () + { + return _resource; + } + public Class getTargetClass() { if (_clazz != null) diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java index 4434a8dd82d..284a1cdd063 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java @@ -271,12 +271,42 @@ public class MetaData */ public void addDiscoveredAnnotations(List annotations) { - _annotations.addAll(annotations); + if (annotations == null) + return; + for (DiscoveredAnnotation a:annotations) + { + Resource r = a.getResource(); + if (r == null || !_webInfJars.contains(r)) + _annotations.add(a); + else + addDiscoveredAnnotation(a.getResource(), a); + + } } + + + public void addDiscoveredAnnotation(Resource resource, DiscoveredAnnotation annotation) + { + List list = _webFragmentAnnotations.get(resource); + if (list == null) + { + list = new ArrayList(); + _webFragmentAnnotations.put(resource, list); + } + list.add(annotation); + } + public void addDiscoveredAnnotations(Resource resource, List annotations) { - _webFragmentAnnotations.put(resource, new ArrayList(annotations)); + List list = _webFragmentAnnotations.get(resource); + if (list == null) + { + list = new ArrayList(); + _webFragmentAnnotations.put(resource, list); + } + + list.addAll(annotations); } public void addDescriptorProcessor(DescriptorProcessor p) From c5395cff858b1c5acc9380618d478401d6369332 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 17 Sep 2012 17:13:20 +1000 Subject: [PATCH 11/56] 389452 if web-fragment metadata-complete==true still scan its related jar if there there is a ServletContainerInitializer, ensure webapp restarts work --- .../eclipse/jetty/annotations/AnnotationConfiguration.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java index 489c08b24b1..e927dd02942 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java @@ -129,16 +129,19 @@ public class AnnotationConfiguration extends AbstractConfiguration MultiMap map = (MultiMap)context.getAttribute(CLASS_INHERITANCE_MAP); if (map != null) map.clear(); + + context.removeAttribute(CLASS_INHERITANCE_MAP); + List initializers = (List)context.getAttribute(CONTAINER_INITIALIZERS); if (initializers != null) initializers.clear(); if (_discoverableAnnotationHandlers != null) _discoverableAnnotationHandlers.clear(); - _discoverableAnnotationHandlers = null; + _classInheritanceHandler = null; if (_containerInitializerAnnotationHandlers != null) _containerInitializerAnnotationHandlers.clear(); - _containerInitializerAnnotationHandlers = null; + super.postConfigure(context); } From 04d8dc664fbc231f69cc6e75b7ceac024249db9c Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 20 Sep 2012 16:47:00 +1000 Subject: [PATCH 12/56] 389956 Bad __context set in WebAppContext.start sequence with respect to ENC setup --- .../eclipse/jetty/jndi/ContextFactory.java | 73 ++++---------- .../org/eclipse/jetty/jndi/java/TestJNDI.java | 96 +++++++++++++++++-- 2 files changed, 106 insertions(+), 63 deletions(-) diff --git a/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/ContextFactory.java b/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/ContextFactory.java index 498a3510254..75ce5b4efb9 100644 --- a/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/ContextFactory.java +++ b/jetty-jndi/src/main/java/org/eclipse/jetty/jndi/ContextFactory.java @@ -99,74 +99,41 @@ public class ContextFactory implements ObjectFactory return ctx; } - // Next, see if we are in a webapp context, if we are, use - // the classloader of the webapp to find the right jndi comp context ClassLoader loader = null; - if (ContextHandler.getCurrentContext() != null) + + loader = Thread.currentThread().getContextClassLoader(); + if (__log.isDebugEnabled() && loader != null) __log.debug("Using thread context classloader"); + + if (loader == null && ContextHandler.getCurrentContext() != null) { loader = ContextHandler.getCurrentContext().getContextHandler().getClassLoader(); + if (__log.isDebugEnabled() && loader != null) __log.debug("Using classloader of current org.eclipse.jetty.server.handler.ContextHandler"); } - - - if (loader != null) - { - if (__log.isDebugEnabled()) __log.debug("Using classloader of current org.eclipse.jetty.server.handler.ContextHandler"); - } - else - { - //Not already in a webapp context, in that case, we try the - //curren't thread's classloader instead - loader = Thread.currentThread().getContextClassLoader(); - if (__log.isDebugEnabled()) __log.debug("Using thread context classloader"); - } - + //Get the context matching the classloader ctx = (Context)__contextMap.get(loader); - + //The map does not contain an entry for this classloader if (ctx == null) { - //Check if a parent classloader has created the context - ctx = getParentClassLoaderContext(loader); + //Didn't find a context to match, make one + Reference ref = (Reference)obj; + StringRefAddr parserAddr = (StringRefAddr)ref.get("parser"); + String parserClassName = (parserAddr==null?null:(String)parserAddr.getContent()); + NameParser parser = (NameParser)(parserClassName==null?null:loader.loadClass(parserClassName).newInstance()); - //Didn't find a context to match any of the ancestors - //of the classloader, so make a context - if (ctx == null) - { - Reference ref = (Reference)obj; - StringRefAddr parserAddr = (StringRefAddr)ref.get("parser"); - String parserClassName = (parserAddr==null?null:(String)parserAddr.getContent()); - NameParser parser = (NameParser)(parserClassName==null?null:loader.loadClass(parserClassName).newInstance()); - - ctx = new NamingContext (env, - name.get(0), - (NamingContext)nameCtx, - parser); - if(__log.isDebugEnabled())__log.debug("No entry for classloader: "+loader); - __contextMap.put (loader, ctx); - } + ctx = new NamingContext (env, + name.get(0), + (NamingContext)nameCtx, + parser); + if(__log.isDebugEnabled())__log.debug("Made context "+name.get(0)+" for classloader: "+loader); + __contextMap.put (loader, ctx); } return ctx; } - /** - * Keep trying ancestors of the given classloader to find one to which - * the context is bound. - * @param loader - * @return the context from the parent class loader - */ - public Context getParentClassLoaderContext (ClassLoader loader) - { - Context ctx = null; - ClassLoader cl = loader; - for (cl = cl.getParent(); (cl != null) && (ctx == null); cl = cl.getParent()) - { - ctx = (Context)__contextMap.get(cl); - } - - return ctx; - } + /** diff --git a/jetty-jndi/src/test/java/org/eclipse/jetty/jndi/java/TestJNDI.java b/jetty-jndi/src/test/java/org/eclipse/jetty/jndi/java/TestJNDI.java index b30f076b765..6cbfb065a5f 100644 --- a/jetty-jndi/src/test/java/org/eclipse/jetty/jndi/java/TestJNDI.java +++ b/jetty-jndi/src/test/java/org/eclipse/jetty/jndi/java/TestJNDI.java @@ -37,6 +37,7 @@ import javax.naming.Reference; import javax.naming.StringRefAddr; import javax.naming.spi.ObjectFactory; +import org.eclipse.jetty.jndi.ContextFactory; import org.eclipse.jetty.jndi.NamingContext; import org.eclipse.jetty.jndi.NamingUtil; import org.eclipse.jetty.jndi.local.localContextRoot; @@ -47,7 +48,8 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; - +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; /** * */ @@ -74,14 +76,16 @@ public class TestJNDI @Test public void testIt() throws Exception { + //set up some classloaders + Thread currentThread = Thread.currentThread(); + ClassLoader currentLoader = currentThread.getContextClassLoader(); + ClassLoader childLoader1 = new URLClassLoader(new URL[0], currentLoader); + ClassLoader childLoader2 = new URLClassLoader(new URL[0], currentLoader); + try { - //set up some classloaders - Thread currentThread = Thread.currentThread(); - ClassLoader currentLoader = currentThread.getContextClassLoader(); - ClassLoader childLoader1 = new URLClassLoader(new URL[0], currentLoader); - ClassLoader childLoader2 = new URLClassLoader(new URL[0], currentLoader); + //Uncomment to aid with debug /* javaRootURLContext.getRoot().addListener(new NamingContext.Listener() { @@ -119,7 +123,19 @@ public class TestJNDI InitialContext initCtxA = new InitialContext(); initCtxA.bind ("blah", "123"); assertEquals ("123", initCtxA.lookup("blah")); - + + initCtxA.destroySubcontext("blah"); + try + { + initCtxA.lookup("blah"); + fail("context blah was not destroyed"); + } + catch (NameNotFoundException e) + { + //expected + } + + InitialContext initCtx = new InitialContext(); Context sub0 = (Context)initCtx.lookup("java:"); @@ -219,6 +235,7 @@ public class TestJNDI try { initCtx.lookup("java:comp/env/rubbish"); + fail("env should not exist for this classloader"); } catch (NameNotFoundException e) { @@ -287,18 +304,77 @@ public class TestJNDI { //expected failure to modify immutable context } - - System.err.println("java:"+javaRootURLContext.getRoot().dump()); - System.err.println("local:"+localContextRoot.getRoot().dump()); //test what happens when you close an initial context that was used initCtx.close(); } finally { + //make some effort to clean up InitialContext ic = new InitialContext(); + Context java = (Context)ic.lookup("java:"); + java.destroySubcontext("zero"); + java.destroySubcontext("fee"); + currentThread.setContextClassLoader(childLoader1); Context comp = (Context)ic.lookup("java:comp"); comp.destroySubcontext("env"); + comp.unbind("crud"); + comp.unbind("crud2"); + } + } + + + @Test + public void testParent() + throws Exception + { + //set up some classloaders + Thread currentThread = Thread.currentThread(); + ClassLoader parentLoader = currentThread.getContextClassLoader(); + ClassLoader childLoader1 = new URLClassLoader(new URL[0], parentLoader); + + try + { + //Test creating a comp for the parent loader does not leak to child + InitialContext initCtx = new InitialContext(); + Context comp = (Context)initCtx.lookup("java:comp"); + assertNotNull(comp); + + Context env = (Context)comp.createSubcontext("env"); + assertNotNull(env); + + env.bind("foo", "aaabbbcccddd"); + assertEquals("aaabbbcccddd", (String)initCtx.lookup("java:comp/env/foo")); + + //Change to child loader + currentThread.setContextClassLoader(childLoader1); + comp = (Context)initCtx.lookup("java:comp"); + + Context childEnv = (Context)comp.createSubcontext("env"); + assertNotSame(env, childEnv); + + childEnv.bind("foo", "eeefffggghhh"); + assertEquals("eeefffggghhh", (String)initCtx.lookup("java:comp/env/foo")); + + //Change back to parent + currentThread.setContextClassLoader(parentLoader); + assertEquals("aaabbbcccddd", (String)initCtx.lookup("java:comp/env/foo")); + + + } + finally + { + //make some effort to clean up + InitialContext ic = new InitialContext(); + currentThread.setContextClassLoader(parentLoader); + Context comp = (Context)ic.lookup("java:comp"); + comp.destroySubcontext("env"); + + currentThread.setContextClassLoader(childLoader1); + comp = (Context)ic.lookup("java:comp"); + comp.destroySubcontext("env"); + + } } } From 1c5d00738409955d9164b0288e38136ad59e9141 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 20 Sep 2012 17:02:18 +1000 Subject: [PATCH 13/56] 389965 OPTIONS should allow spaces in comma separated list --- jetty-start/src/main/java/org/eclipse/jetty/start/Main.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java index cd97f11d3bf..6126fbb624b 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java @@ -288,7 +288,7 @@ public class Main { String opts[] = assign[1].split(","); for (String opt : opts) - _config.addActiveOption(opt); + _config.addActiveOption(opt.trim()); } else { From af233a8a37581aa7805378a378d191c290731490 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Fri, 21 Sep 2012 11:25:58 +1000 Subject: [PATCH 14/56] 389686 Fix reference to org.eclipse.jetty.util.log.stderr.LONG system property in javadoc for StdErrLog --- .../main/java/org/eclipse/jetty/util/log/StdErrLog.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java index c641fd682de..39f0fa918ec 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java @@ -31,12 +31,11 @@ import org.eclipse.jetty.util.DateCache; * the eclipse jetty root level logger level to that specified level. (Default level is INFO) *

* If the system property "org.eclipse.jetty.util.log.SOURCE" is set, then the source method/file of a log is logged. - * For named debuggers, the system property name+".SOURCE" is checked. If it is not not set, then - * "org.eclipse.jetty.util.log.SOURCE" is used as the default. + * For named debuggers, the system property name+".SOURCE" is checked, eg "org.eclipse.jetty.util.log.stderr.SOURCE". + * If it is not not set, then "org.eclipse.jetty.util.log.SOURCE" is used as the default. *

- * If the system property "org.eclipse.jetty.util.log.LONG" is set, then the full, unabbreviated name of the logger is - * used for logging. For named debuggers, the system property name+".LONG" is checked. If it is not not set, then - * "org.eclipse.jetty.util.log.LONG" is used as the default. + * If the system property "org.eclipse.jetty.util.log.stderr.LONG" is set, then the full, unabbreviated name of the logger is + * used for logging. */ public class StdErrLog extends AbstractLogger { From 494f7e48fcc20c51066cd91a6dac1d738cacb54e Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Tue, 25 Sep 2012 08:18:06 -0500 Subject: [PATCH 15/56] add websocket test for http keyword in response message from reported issue --- .../websocket/WebSocketServletRFCTest.java | 42 +++++++++++++++++++ .../jetty/websocket/helper/MessageSender.java | 24 ++++++++++- 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketServletRFCTest.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketServletRFCTest.java index 5ef50cafad6..8296b1a9b2c 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketServletRFCTest.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketServletRFCTest.java @@ -80,6 +80,8 @@ public class WebSocketServletRFCTest try { conn.sendMessage(data); + + conn.close(1000, data); } catch (IOException e) { @@ -240,4 +242,44 @@ public class WebSocketServletRFCTest sender.close(); } } + + /** + * Test the requirement of responding with server terminated close code 1011 when there is an unhandled (internal + * server error) being produced by the extended WebSocketServlet. + */ + @Test + public void testResponseOfHttpKeyword() throws Exception + { + WebSocketClientFactory clientFactory = new WebSocketClientFactory(); + clientFactory.start(); + + WebSocketClient wsc = clientFactory.newWebSocketClient(); + MessageSender sender = new MessageSender(); + wsc.open(serverUri,sender); + + String message = "GET"; + + try + { + sender.awaitConnect(); + + // echo back a http keyword + sender.sendMessage(message); + + // Give servlet 500 millisecond to process messages + TimeUnit.MILLISECONDS.sleep(500); + + sender.awaitMessage(); + + Assert.assertEquals("Message should match",message, sender.getMessage()); + Assert.assertThat("WebSocket should be closed",sender.isConnected(),is(false)); + Assert.assertThat("WebSocket close clode",sender.getCloseCode(),is(1000)); + Assert.assertEquals("WebSocket close message",message, sender.getCloseMessage()); + + } + finally + { + sender.close(); + } + } } diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/MessageSender.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/MessageSender.java index 8b3e5779911..ecff608bc23 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/MessageSender.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/MessageSender.java @@ -24,13 +24,17 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jetty.websocket.WebSocket; -public class MessageSender implements WebSocket +public class MessageSender implements WebSocket, WebSocket.OnTextMessage { private Connection conn; private CountDownLatch connectLatch = new CountDownLatch(1); + private CountDownLatch messageLatch = new CountDownLatch(1); + private int closeCode = -1; private String closeMessage = null; - + private String message = null; + + public void onOpen(Connection connection) { this.conn = connection; @@ -43,6 +47,12 @@ public class MessageSender implements WebSocket this.closeCode = closeCode; this.closeMessage = message; } + + + public void onMessage(String data) + { + message = data; + } public boolean isConnected() { @@ -62,6 +72,11 @@ public class MessageSender implements WebSocket { return closeMessage; } + + public String getMessage() + { + return message; + } public void sendMessage(String format, Object... args) throws IOException { @@ -72,6 +87,11 @@ public class MessageSender implements WebSocket { connectLatch.await(1,TimeUnit.SECONDS); } + + public void awaitMessage() throws InterruptedException + { + messageLatch.await(1,TimeUnit.SECONDS); + } public void close() { From 95298f27c755479d65d14152db5e7a087a4d173a Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 27 Sep 2012 07:25:34 +1000 Subject: [PATCH 16/56] JETTY-1547 Jetty does not honor web.xml web-app/jsp-config/jsp-property-group/default-content-type --- .../org/eclipse/jetty/webapp/StandardDescriptorProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a4c6c3e7d54..6944f6d65c4 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 @@ -1308,7 +1308,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor jpg.setIsXml(group.getString("is-xml", false, true)); jpg.setDeferredSyntaxAllowedAsLiteral(group.getString("deferred-syntax-allowed-as-literal", false, true)); jpg.setTrimDirectiveWhitespaces(group.getString("trim-directive-whitespaces", false, true)); - jpg.setDefaultContentType(group.getString("defaultContentType", false, true)); + jpg.setDefaultContentType(group.getString("default-content-type", false, true)); jpg.setBuffer(group.getString("buffer", false, true)); jpg.setErrorOnUndeclaredNamespace(group.getString("error-on-undeclared-namespace", false, true)); From eacd75bbfdb4dc58eea5053f80c7c9177211db28 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 27 Sep 2012 10:13:23 +1000 Subject: [PATCH 17/56] 390161 jetty-9 do not share DeferredAuthentication --- .../jetty/security/SecurityHandler.java | 3 - .../authentication/BasicAuthenticator.java | 6 +- .../ClientCertAuthenticator.java | 8 +-- .../DeferredAuthentication.java | 70 +++++-------------- .../authentication/DigestAuthenticator.java | 6 +- .../authentication/FormAuthenticator.java | 17 +++-- .../authentication/LoginAuthenticator.java | 1 - .../authentication/SpnegoAuthenticator.java | 4 +- 8 files changed, 40 insertions(+), 75 deletions(-) diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java b/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java index d2009310d51..95bcbde8949 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java @@ -525,8 +525,6 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti else if (authentication instanceof Authentication.Deferred) { DeferredAuthentication deferred= (DeferredAuthentication)authentication; - deferred.setIdentityService(_identityService); - deferred.setLoginService(_loginService); baseRequest.setAuthentication(authentication); try @@ -536,7 +534,6 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti finally { previousIdentity = deferred.getPreviousAssociation(); - deferred.setIdentityService(null); } if (authenticator!=null) diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/BasicAuthenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/BasicAuthenticator.java index ec0bda78da8..ec2fb04b0d7 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/BasicAuthenticator.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/BasicAuthenticator.java @@ -67,8 +67,8 @@ public class BasicAuthenticator extends LoginAuthenticator try { if (!mandatory) - return _deferred; - + return new DeferredAuthentication(this); + if (credentials != null) { int space=credentials.indexOf(' '); @@ -96,7 +96,7 @@ public class BasicAuthenticator extends LoginAuthenticator } } - if (_deferred.isDeferred(response)) + if (DeferredAuthentication.isDeferred(response)) return Authentication.UNAUTHENTICATED; response.setHeader(HttpHeaders.WWW_AUTHENTICATE, "basic realm=\"" + _loginService.getName() + '"'); diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/ClientCertAuthenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/ClientCertAuthenticator.java index 5a509448923..a4bef236a3e 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/ClientCertAuthenticator.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/ClientCertAuthenticator.java @@ -88,8 +88,8 @@ public class ClientCertAuthenticator extends LoginAuthenticator public Authentication validateRequest(ServletRequest req, ServletResponse res, boolean mandatory) throws ServerAuthException { if (!mandatory) - return _deferred; - + return new DeferredAuthentication(this); + HttpServletRequest request = (HttpServletRequest)req; HttpServletResponse response = (HttpServletResponse)res; X509Certificate[] certs = (X509Certificate[]) request.getAttribute("javax.servlet.request.X509Certificate"); @@ -129,8 +129,8 @@ public class ClientCertAuthenticator extends LoginAuthenticator } } } - - if (!_deferred.isDeferred(response)) + + if (!DeferredAuthentication.isDeferred(response)) { response.sendError(HttpServletResponse.SC_FORBIDDEN); return Authentication.SEND_FAILURE; diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java index c4f72f8f7e9..158058c94fd 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java @@ -43,22 +43,9 @@ import org.eclipse.jetty.util.log.Logger; public class DeferredAuthentication implements Authentication.Deferred { private static final Logger LOG = Log.getLogger(DeferredAuthentication.class); - - protected final Authenticator _authenticator; - - private LoginService _loginService; - private IdentityService _identityService; + protected final LoginAuthenticator _authenticator; private Object _previousAssociation; - - /* ------------------------------------------------------------ */ - public DeferredAuthentication(Authenticator authenticator) - { - if (authenticator == null) - throw new NullPointerException("No Authenticator"); - this._authenticator = authenticator; - } - /* ------------------------------------------------------------ */ public DeferredAuthentication(LoginAuthenticator authenticator) { @@ -66,36 +53,6 @@ public class DeferredAuthentication implements Authentication.Deferred throw new NullPointerException("No Authenticator"); this._authenticator = authenticator; } - - /* ------------------------------------------------------------ */ - /** Get the identityService. - * @return the identityService - */ - public IdentityService getIdentityService() - { - return _identityService; - } - - /* ------------------------------------------------------------ */ - /** Set the identityService. - * @param identityService the identityService to set - */ - public void setIdentityService(IdentityService identityService) - { - _identityService = identityService; - } - - /* ------------------------------------------------------------ */ - public LoginService getLoginService() - { - return _loginService; - } - - /* ------------------------------------------------------------ */ - public void setLoginService(LoginService loginService) - { - _loginService = loginService; - } /* ------------------------------------------------------------ */ /** @@ -109,8 +66,11 @@ public class DeferredAuthentication implements Authentication.Deferred if (authentication!=null && (authentication instanceof Authentication.User) && !(authentication instanceof Authentication.ResponseSent)) { - if (_identityService!=null) - _previousAssociation=_identityService.associate(((Authentication.User)authentication).getUserIdentity()); + LoginService login_service= _authenticator.getLoginService(); + IdentityService identity_service=login_service.getIdentityService(); + + if (identity_service!=null) + _previousAssociation=identity_service.associate(((Authentication.User)authentication).getUserIdentity()); return authentication; } } @@ -129,9 +89,12 @@ public class DeferredAuthentication implements Authentication.Deferred { try { + LoginService login_service= _authenticator.getLoginService(); + IdentityService identity_service=login_service.getIdentityService(); + Authentication authentication = _authenticator.validateRequest(request,response,true); - if (authentication instanceof Authentication.User && _identityService!=null) - _previousAssociation=_identityService.associate(((Authentication.User)authentication).getUserIdentity()); + if (authentication instanceof Authentication.User && identity_service!=null) + _previousAssociation=identity_service.associate(((Authentication.User)authentication).getUserIdentity()); return authentication; } catch (ServerAuthException e) @@ -147,14 +110,17 @@ public class DeferredAuthentication implements Authentication.Deferred */ public Authentication login(String username, String password) { - if (_loginService!=null) + LoginService login_service= _authenticator.getLoginService(); + IdentityService identity_service=login_service.getIdentityService(); + + if (login_service!=null) { - UserIdentity user = _loginService.login(username,password); + UserIdentity user = login_service.login(username,password); if (user!=null) { UserAuthentication authentication = new UserAuthentication("API",user); - if (_identityService!=null) - _previousAssociation=_identityService.associate(user); + if (identity_service!=null) + _previousAssociation=identity_service.associate(user); return authentication; } } diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java index b95f9253a27..c42c26c8719 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java @@ -121,8 +121,8 @@ public class DigestAuthenticator extends LoginAuthenticator public Authentication validateRequest(ServletRequest req, ServletResponse res, boolean mandatory) throws ServerAuthException { if (!mandatory) - return _deferred; - + return new DeferredAuthentication(this); + HttpServletRequest request = (HttpServletRequest)req; HttpServletResponse response = (HttpServletResponse)res; String credentials = request.getHeader(HttpHeaders.AUTHORIZATION); @@ -197,7 +197,7 @@ public class DigestAuthenticator extends LoginAuthenticator } - if (!_deferred.isDeferred(response)) + if (!DeferredAuthentication.isDeferred(response)) { String domain = request.getContextPath(); if (domain == null) diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/FormAuthenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/FormAuthenticator.java index ccb00a200d6..829a9d595b0 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/FormAuthenticator.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/FormAuthenticator.java @@ -191,11 +191,11 @@ public class FormAuthenticator extends LoginAuthenticator mandatory|=isJSecurityCheck(uri); if (!mandatory) - return _deferred; - + return new DeferredAuthentication(this); + if (isLoginOrErrorPage(URIUtil.addPaths(request.getServletPath(),request.getPathInfo())) &&!DeferredAuthentication.isDeferred(response)) - return _deferred; - + return new DeferredAuthentication(this); + HttpSession session = request.getSession(true); try @@ -300,9 +300,12 @@ public class FormAuthenticator extends LoginAuthenticator } // if we can't send challenge - if (_deferred.isDeferred(response)) - return Authentication.UNAUTHENTICATED; - + if (DeferredAuthentication.isDeferred(response)) + { + LOG.debug("auth deferred {}",session.getId()); + return Authentication.UNAUTHENTICATED; + } + // remember the current URI synchronized (session) { diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/LoginAuthenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/LoginAuthenticator.java index f7e30647a9a..17e86574b6c 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/LoginAuthenticator.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/LoginAuthenticator.java @@ -29,7 +29,6 @@ import org.eclipse.jetty.server.session.AbstractSessionManager; public abstract class LoginAuthenticator implements Authenticator { - protected final DeferredAuthentication _deferred=new DeferredAuthentication(this); protected LoginService _loginService; protected IdentityService _identityService; private boolean _renewSession; diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/SpnegoAuthenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/SpnegoAuthenticator.java index 4bce3993d68..ca5563f4e50 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/SpnegoAuthenticator.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/SpnegoAuthenticator.java @@ -69,7 +69,7 @@ public class SpnegoAuthenticator extends LoginAuthenticator if (!mandatory) { - return _deferred; + return new DeferredAuthentication(this); } // check to see if we have authorization headers required to continue @@ -77,7 +77,7 @@ public class SpnegoAuthenticator extends LoginAuthenticator { try { - if (_deferred.isDeferred(res)) + if (DeferredAuthentication.isDeferred(res)) { return Authentication.UNAUTHENTICATED; } From 0ab5773963f51e785e7beb1631e1c8e8ac05e8a2 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Fri, 28 Sep 2012 00:26:22 +1000 Subject: [PATCH 18/56] 390560 The method AnnotationParser.getAnnotationHandlers(String) always returns a empty collection. --- .../java/org/eclipse/jetty/annotations/AnnotationParser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java index c3b65ac156c..781cac429f4 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java @@ -426,7 +426,7 @@ public class AnnotationParser List handlers = _annotationHandlers.get(annotationName); if (handlers == null) return Collections.emptyList(); - return new ArrayList(); + return new ArrayList(handlers); } public List getAnnotationHandlers() From f3e151467d5d93d86619cebfb60bbf73f4f933e9 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Fri, 28 Sep 2012 18:34:00 +1000 Subject: [PATCH 19/56] 390161 Apply DeferredAuthentication fix to jaspi --- .../eclipse/jetty/security/jaspi/JaspiAuthenticator.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java index c69e1904166..c93bafa7705 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java @@ -37,6 +37,7 @@ import org.eclipse.jetty.security.IdentityService; import org.eclipse.jetty.security.ServerAuthException; import org.eclipse.jetty.security.UserAuthentication; import org.eclipse.jetty.security.authentication.DeferredAuthentication; +import org.eclipse.jetty.security.authentication.LoginAuthenticator; import org.eclipse.jetty.server.Authentication; import org.eclipse.jetty.server.UserIdentity; import org.eclipse.jetty.server.Authentication.User; @@ -44,7 +45,7 @@ import org.eclipse.jetty.server.Authentication.User; /** * @version $Rev: 4793 $ $Date: 2009-03-19 00:00:01 +0100 (Thu, 19 Mar 2009) $ */ -public class JaspiAuthenticator implements Authenticator +public class JaspiAuthenticator extends LoginAuthenticator { private final ServerAuthConfig _authConfig; @@ -58,7 +59,7 @@ public class JaspiAuthenticator implements Authenticator private final IdentityService _identityService; - private final DeferredAuthentication _deferred; + public JaspiAuthenticator(ServerAuthConfig authConfig, Map authProperties, ServletCallbackHandler callbackHandler, Subject serviceSubject, boolean allowLazyAuthentication, IdentityService identityService) @@ -72,11 +73,11 @@ public class JaspiAuthenticator implements Authenticator this._serviceSubject = serviceSubject; this._allowLazyAuthentication = allowLazyAuthentication; this._identityService = identityService; - this._deferred = new DeferredAuthentication(this); } public void setConfiguration(AuthConfiguration configuration) { + super.setConfiguration(configuration); } public String getAuthMethod() @@ -93,7 +94,7 @@ public class JaspiAuthenticator implements Authenticator //if its not mandatory to authenticate, and the authenticator returned UNAUTHENTICATED, we treat it as authentication deferred if (_allowLazyAuthentication && !info.isAuthMandatory() && a == Authentication.UNAUTHENTICATED) - a =_deferred; + a = new DeferredAuthentication(this); return a; } From c7e36470c528904119893b27b559e07f66e30bbe Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Fri, 28 Sep 2012 20:16:52 +1000 Subject: [PATCH 20/56] 390503 http-method-omission element not being processed --- .../security/ConstraintSecurityHandler.java | 429 ++++++++++++++++-- .../jetty/security/ConstraintTest.java | 82 +++- .../security/SpecExampleConstraintTest.java | 311 +++++++++++++ .../webapp/StandardDescriptorProcessor.java | 47 +- 4 files changed, 811 insertions(+), 58 deletions(-) create mode 100644 jetty-security/src/test/java/org/eclipse/jetty/security/SpecExampleConstraintTest.java diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/ConstraintSecurityHandler.java b/jetty-security/src/main/java/org/eclipse/jetty/security/ConstraintSecurityHandler.java index 0ca83b19625..94f70f565cd 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/ConstraintSecurityHandler.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/ConstraintSecurityHandler.java @@ -19,16 +19,25 @@ package org.eclipse.jetty.security; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArraySet; +import javax.servlet.HttpConstraintElement; +import javax.servlet.HttpMethodConstraintElement; +import javax.servlet.ServletSecurityElement; +import javax.servlet.annotation.ServletSecurity.EmptyRoleSemantic; +import javax.servlet.annotation.ServletSecurity.TransportGuarantee; + import org.eclipse.jetty.http.PathMap; import org.eclipse.jetty.server.AbstractHttpConnection; import org.eclipse.jetty.server.Connector; @@ -48,11 +57,217 @@ import org.eclipse.jetty.util.security.Constraint; */ public class ConstraintSecurityHandler extends SecurityHandler implements ConstraintAware { + private static final String OMISSION_SUFFIX = ".omission"; + private final List _constraintMappings= new CopyOnWriteArrayList(); private final Set _roles = new CopyOnWriteArraySet(); private final PathMap _constraintMap = new PathMap(); private boolean _strict = true; + + + /* ------------------------------------------------------------ */ + /** + * @return + */ + public static Constraint createConstraint() + { + return new Constraint(); + } + + /* ------------------------------------------------------------ */ + /** + * @param constraint + * @return + */ + public static Constraint createConstraint(Constraint constraint) + { + try + { + return (Constraint)constraint.clone(); + } + catch (CloneNotSupportedException e) + { + throw new IllegalStateException (e); + } + } + + /* ------------------------------------------------------------ */ + /** + * Create a security constraint + * + * @param name + * @param authenticate + * @param roles + * @param dataConstraint + * @return + */ + public static Constraint createConstraint (String name, boolean authenticate, String[] roles, int dataConstraint) + { + Constraint constraint = createConstraint(); + if (name != null) + constraint.setName(name); + constraint.setAuthenticate(authenticate); + constraint.setRoles(roles); + constraint.setDataConstraint(dataConstraint); + return constraint; + } + + /* ------------------------------------------------------------ */ + /** + * @param name + * @param element + * @return + */ + public static Constraint createConstraint (String name, HttpConstraintElement element) + { + return createConstraint(name, element.getRolesAllowed(), element.getEmptyRoleSemantic(), element.getTransportGuarantee()); + } + + + /* ------------------------------------------------------------ */ + /** + * @param name + * @param rolesAllowed + * @param permitOrDeny + * @param transport + * @return + */ + public static Constraint createConstraint (String name, String[] rolesAllowed, EmptyRoleSemantic permitOrDeny, TransportGuarantee transport) + { + Constraint constraint = createConstraint(); + + if (rolesAllowed == null || rolesAllowed.length==0) + { + if (permitOrDeny.equals(EmptyRoleSemantic.DENY)) + { + //Equivalent to with no roles + constraint.setName(name+"-Deny"); + constraint.setAuthenticate(true); + } + else + { + //Equivalent to no + constraint.setName(name+"-Permit"); + constraint.setAuthenticate(false); + } + } + else + { + //Equivalent to with list of s + constraint.setAuthenticate(true); + constraint.setRoles(rolesAllowed); + constraint.setName(name+"-RolesAllowed"); + } + + //Equivalent to //CONFIDENTIAL + constraint.setDataConstraint((transport.equals(TransportGuarantee.CONFIDENTIAL)?Constraint.DC_CONFIDENTIAL:Constraint.DC_NONE)); + return constraint; + } + + + + /* ------------------------------------------------------------ */ + /** + * @param pathSpec + * @param constraintMappings + * @return + */ + public static List getConstraintMappingsForPath(String pathSpec, List constraintMappings) + { + if (pathSpec == null || "".equals(pathSpec.trim()) || constraintMappings == null || constraintMappings.size() == 0) + return Collections.emptyList(); + + List mappings = new ArrayList(); + for (ConstraintMapping mapping:constraintMappings) + { + if (pathSpec.equals(mapping.getPathSpec())) + { + mappings.add(mapping); + } + } + return mappings; + } + + + /* ------------------------------------------------------------ */ + /** + * @param pathSpec + * @param constraintMappings + * @return + */ + public static List removeConstraintMappingsForPath(String pathSpec, List constraintMappings) + { + if (pathSpec == null || "".equals(pathSpec.trim()) || constraintMappings == null || constraintMappings.size() == 0) + return Collections.emptyList(); + + List mappings = new ArrayList(); + for (ConstraintMapping mapping:constraintMappings) + { + //Remove the matching mappings by only copying in non-matching mappings + if (!pathSpec.equals(mapping.getPathSpec())) + { + mappings.add(mapping); + } + } + return mappings; + } + + + + /* ------------------------------------------------------------ */ + /** Generate Constraints and ContraintMappings for the given url pattern and ServletSecurityElement + * + * @param name + * @param pathSpec + * @param securityElement + * @return + */ + public static List createConstraintsWithMappingsForPath (String name, String pathSpec, ServletSecurityElement securityElement) + { + List mappings = new ArrayList(); + + //Create a constraint that will describe the default case (ie if not overridden by specific HttpMethodConstraints) + Constraint constraint = ConstraintSecurityHandler.createConstraint(name, securityElement); + + //Create a mapping for the pathSpec for the default case + ConstraintMapping defaultMapping = new ConstraintMapping(); + defaultMapping.setPathSpec(pathSpec); + defaultMapping.setConstraint(constraint); + mappings.add(defaultMapping); + + + //See Spec 13.4.1.2 p127 + List methodOmissions = new ArrayList(); + + //make constraint mappings for this url for each of the HttpMethodConstraintElements + Collection methodConstraints = securityElement.getHttpMethodConstraints(); + if (methodConstraints != null) + { + for (HttpMethodConstraintElement methodConstraint:methodConstraints) + { + //Make a Constraint that captures the and elements supplied for the HttpMethodConstraintElement + Constraint mconstraint = ConstraintSecurityHandler.createConstraint(name, methodConstraint); + ConstraintMapping mapping = new ConstraintMapping(); + mapping.setConstraint(mconstraint); + mapping.setPathSpec(pathSpec); + if (methodConstraint.getMethodName() != null) + { + mapping.setMethod(methodConstraint.getMethodName()); + //See spec 13.4.1.2 p127 - add an omission for every method name to the default constraint + methodOmissions.add(methodConstraint.getMethodName()); + } + mappings.add(mapping); + } + } + //See spec 13.4.1.2 p127 - add an omission for every method name to the default constraint + if (methodOmissions.size() > 0) + defaultMapping.setMethodOmissions(methodOmissions.toArray(new String[methodOmissions.size()])); + + return mappings; + } + + /* ------------------------------------------------------------ */ /** Get the strict mode. * @return true if the security handler is running in strict mode. @@ -232,7 +447,9 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr } super.doStart(); } - + + + /* ------------------------------------------------------------ */ @Override protected void doStop() throws Exception { @@ -241,7 +458,15 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr _roles.clear(); super.doStop(); } - + + + /* ------------------------------------------------------------ */ + /** + * Create and combine the constraint with the existing processed + * constraints. + * + * @param mapping + */ protected void processConstraintMapping(ConstraintMapping mapping) { Map mappings = (Map)_constraintMap.get(mapping.getPathSpec()); @@ -253,8 +478,15 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr RoleInfo allMethodsRoleInfo = mappings.get(null); if (allMethodsRoleInfo != null && allMethodsRoleInfo.isForbidden()) return; + + if (mapping.getMethodOmissions() != null && mapping.getMethodOmissions().length > 0) + { + + processConstraintMappingWithMethodOmissions(mapping, mappings); + return; + } - String httpMethod = mapping.getMethod(); + String httpMethod = mapping.getMethod(); RoleInfo roleInfo = mappings.get(httpMethod); if (roleInfo == null) { @@ -268,10 +500,10 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr if (roleInfo.isForbidden()) return; - Constraint constraint = mapping.getConstraint(); - boolean forbidden = constraint.isForbidden(); - roleInfo.setForbidden(forbidden); - if (forbidden) + //add in info from the constraint + configureRoleInfo(roleInfo, mapping); + + if (roleInfo.isForbidden()) { if (httpMethod == null) { @@ -281,36 +513,7 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr } else { - UserDataConstraint userDataConstraint = UserDataConstraint.get(constraint.getDataConstraint()); - roleInfo.setUserDataConstraint(userDataConstraint); - - boolean checked = constraint.getAuthenticate(); - roleInfo.setChecked(checked); - if (roleInfo.isChecked()) - { - if (constraint.isAnyRole()) - { - if (_strict) - { - // * means "all defined roles" - for (String role : _roles) - roleInfo.addRole(role); - } - else - // * means any role - roleInfo.setAnyRole(true); - } - else - { - String[] newRoles = constraint.getRoles(); - for (String role : newRoles) - { - if (_strict &&!_roles.contains(role)) - throw new IllegalArgumentException("Attempt to use undeclared role: " + role + ", known roles: " + _roles); - roleInfo.addRole(role); - } - } - } + //combine with any entry that covers all methods if (httpMethod == null) { for (Map.Entry entry : mappings.entrySet()) @@ -325,6 +528,105 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr } } + /* ------------------------------------------------------------ */ + /** Constraints that name method omissions are dealt with differently. + * We create an entry in the mappings with key "method.omission". This entry + * is only ever combined with other omissions for the same method to produce a + * consolidated RoleInfo. Then, when we wish to find the relevant constraints for + * a given Request (in prepareConstraintInfo()), we consult 3 types of entries in + * the mappings: an entry that names the method of the Request specifically, an + * entry that names constraints that apply to all methods, entries of the form + * method.omission, where the method of the Request is not named in the omission. + * @param mapping + * @param mappings + */ + protected void processConstraintMappingWithMethodOmissions (ConstraintMapping mapping, Map mappings) + { + String[] omissions = mapping.getMethodOmissions(); + + for (String omission:omissions) + { + //for each method omission, see if there is already a RoleInfo for it in mappings + RoleInfo ri = mappings.get(omission+OMISSION_SUFFIX); + if (ri == null) + { + //if not, make one + ri = new RoleInfo(); + mappings.put(omission+OMISSION_SUFFIX, ri); + } + + //initialize RoleInfo or combine from ConstraintMapping + configureRoleInfo(ri, mapping); + } + } + + + /* ------------------------------------------------------------ */ + /** + * Initialize or update the RoleInfo from the constraint + * @param ri + * @param mapping + */ + protected void configureRoleInfo (RoleInfo ri, ConstraintMapping mapping) + { + Constraint constraint = mapping.getConstraint(); + boolean forbidden = constraint.isForbidden(); + ri.setForbidden(forbidden); + + //set up the data constraint (NOTE: must be done after setForbidden, as it nulls out the data constraint + //which we need in order to do combining of omissions in prepareConstraintInfo + UserDataConstraint userDataConstraint = UserDataConstraint.get(mapping.getConstraint().getDataConstraint()); + ri.setUserDataConstraint(userDataConstraint); + + + //if forbidden, no point setting up roles + if (!ri.isForbidden()) + { + //add in the roles + boolean checked = mapping.getConstraint().getAuthenticate(); + ri.setChecked(checked); + if (ri.isChecked()) + { + if (mapping.getConstraint().isAnyRole()) + { + if (_strict) + { + // * means "all defined roles" + for (String role : _roles) + ri.addRole(role); + } + else + // * means any role + ri.setAnyRole(true); + } + else + { + String[] newRoles = mapping.getConstraint().getRoles(); + for (String role : newRoles) + { + if (_strict &&!_roles.contains(role)) + throw new IllegalArgumentException("Attempt to use undeclared role: " + role + ", known roles: " + _roles); + ri.addRole(role); + } + } + } + } + } + + + /* ------------------------------------------------------------ */ + /** + * Find constraints that apply to the given path. + * In order to do this, we consult 3 different types of information stored in the mappings for each path - each mapping + * represents a merged set of user data constraints, roles etc -: + *

    + *
  1. A mapping of an exact method name
  2. + *
  3. A mapping will null key that matches every method name
  4. + *
  5. Mappings with keys of the form "method.omission" that indicates it will match every method name EXCEPT that given
  6. + *
+ * + * @see org.eclipse.jetty.security.SecurityHandler#prepareConstraintInfo(java.lang.String, org.eclipse.jetty.server.Request) + */ protected Object prepareConstraintInfo(String pathInContext, Request request) { Map mappings = (Map)_constraintMap.match(pathInContext); @@ -334,13 +636,46 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr String httpMethod = request.getMethod(); RoleInfo roleInfo = mappings.get(httpMethod); if (roleInfo == null) - roleInfo = mappings.get(null); + { + //No specific http-method names matched + List applicableConstraints = new ArrayList(); + + //Get info for constraint that matches all methods if it exists + RoleInfo all = mappings.get(null); + if (all != null) + applicableConstraints.add(all); + + + //Get info for constraints that name method omissions where target method name is not omitted + //(ie matches because target method is not omitted, hence considered covered by the constraint) + for (Entry entry: mappings.entrySet()) + { + if (entry.getKey() != null && entry.getKey().contains(OMISSION_SUFFIX) && !(httpMethod+OMISSION_SUFFIX).equals(entry.getKey())) + applicableConstraints.add(entry.getValue()); + } + + if (applicableConstraints.size() == 1) + roleInfo = applicableConstraints.get(0); + else + { + roleInfo = new RoleInfo(); + roleInfo.setUserDataConstraint(UserDataConstraint.None); + + for (RoleInfo r:applicableConstraints) + roleInfo.combine(r); + } + + } return roleInfo; } - return null; } - + + + /* ------------------------------------------------------------ */ + /** + * @see org.eclipse.jetty.security.SecurityHandler#checkUserDataPermissions(java.lang.String, org.eclipse.jetty.server.Request, org.eclipse.jetty.server.Response, java.lang.Object) + */ protected boolean checkUserDataPermissions(String pathInContext, Request request, Response response, Object constraintInfo) throws IOException { if (constraintInfo == null) @@ -404,7 +739,11 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr } } - + + /* ------------------------------------------------------------ */ + /** + * @see org.eclipse.jetty.security.SecurityHandler#isAuthMandatory(org.eclipse.jetty.server.Request, org.eclipse.jetty.server.Response, java.lang.Object) + */ protected boolean isAuthMandatory(Request baseRequest, Response base_response, Object constraintInfo) { if (constraintInfo == null) @@ -413,7 +752,12 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr } return ((RoleInfo)constraintInfo).isChecked(); } - + + + /* ------------------------------------------------------------ */ + /** + * @see org.eclipse.jetty.security.SecurityHandler#checkWebResourcePermissions(java.lang.String, org.eclipse.jetty.server.Request, org.eclipse.jetty.server.Response, java.lang.Object, org.eclipse.jetty.server.UserIdentity) + */ @Override protected boolean checkWebResourcePermissions(String pathInContext, Request request, Response response, Object constraintInfo, UserIdentity userIdentity) throws IOException @@ -454,4 +798,5 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr getBeans(), TypeUtil.asList(getHandlers())); } + } diff --git a/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java b/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java index a400db3a93e..cab25b10e5a 100644 --- a/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java +++ b/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java @@ -22,9 +22,11 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; @@ -76,6 +78,8 @@ public class ConstraintTest _loginService.putUser("user",new Password("password")); _loginService.putUser("user2",new Password("password"), new String[] {"user"}); _loginService.putUser("admin",new Password("password"), new String[] {"user","administrator"}); + _loginService.putUser("user3", new Password("password"), new String[] {"foo"}); + _context.setContextPath("/ctx"); _server.setHandler(_context); @@ -189,17 +193,59 @@ public class ConstraintTest @Test public void testBasic() throws Exception { + + List list = new ArrayList(_security.getConstraintMappings()); + + Constraint constraint6 = new Constraint(); + constraint6.setAuthenticate(true); + constraint6.setName("omit POST and GET"); + constraint6.setRoles(new String[]{"user"}); + ConstraintMapping mapping6 = new ConstraintMapping(); + mapping6.setPathSpec("/omit/*"); + mapping6.setConstraint(constraint6); + mapping6.setMethodOmissions(new String[]{"GET", "HEAD"}); //requests for every method except GET and HEAD must be in role "user" + list.add(mapping6); + + Constraint constraint7 = new Constraint(); + constraint7.setAuthenticate(true); + constraint7.setName("non-omitted GET"); + constraint7.setRoles(new String[]{"administrator"}); + ConstraintMapping mapping7 = new ConstraintMapping(); + mapping7.setPathSpec("/omit/*"); + mapping7.setConstraint(constraint7); + mapping7.setMethod("GET"); //requests for GET must be in role "admin" + list.add(mapping7); + + Constraint constraint8 = new Constraint(); + constraint8.setAuthenticate(true); + constraint8.setName("non specific"); + constraint8.setRoles(new String[]{"foo"}); + ConstraintMapping mapping8 = new ConstraintMapping(); + mapping8.setPathSpec("/omit/*"); + mapping8.setConstraint(constraint8);//requests for all methods must be in role "foo" + list.add(mapping8); + + Set knownRoles=new HashSet(); + knownRoles.add("user"); + knownRoles.add("administrator"); + knownRoles.add("foo"); + + _security.setConstraintMappings(list, knownRoles); + + _security.setAuthenticator(new BasicAuthenticator()); _security.setStrict(false); _server.start(); String response; + /* response = _connector.getResponses("GET /ctx/noauth/info HTTP/1.0\r\n\r\n"); assertTrue(response.startsWith("HTTP/1.1 200 OK")); - +*/ + response = _connector.getResponses("GET /ctx/forbid/info HTTP/1.0\r\n\r\n"); assertTrue(response.startsWith("HTTP/1.1 403 Forbidden")); - + /* response = _connector.getResponses("GET /ctx/auth/info HTTP/1.0\r\n\r\n"); assertTrue(response.startsWith("HTTP/1.1 401 Unauthorized")); assertTrue(response.indexOf("WWW-Authenticate: basic realm=\"TestRealm\"") > 0); @@ -214,8 +260,8 @@ public class ConstraintTest "Authorization: Basic " + B64Code.encode("user:password") + "\r\n" + "\r\n"); assertTrue(response.startsWith("HTTP/1.1 200 OK")); - - +*/ +/* // test admin response = _connector.getResponses("GET /ctx/admin/info HTTP/1.0\r\n\r\n"); assertTrue(response.startsWith("HTTP/1.1 401 Unauthorized")); @@ -241,7 +287,33 @@ public class ConstraintTest response = _connector.getResponses("GET /ctx/admin/relax/info HTTP/1.0\r\n\r\n"); assertTrue(response.startsWith("HTTP/1.1 200 OK")); + + //check GET is in role administrator + response = _connector.getResponses("GET /ctx/omit/x HTTP/1.0\r\n" + + "Authorization: Basic " + B64Code.encode("admin:password") + "\r\n" + + "\r\n"); + assertTrue(response.startsWith("HTTP/1.1 200 OK")); + + //check POST is in role user + response = _connector.getResponses("POST /ctx/omit/x HTTP/1.0\r\n" + + "Authorization: Basic " + B64Code.encode("user2:password") + "\r\n" + + "\r\n"); + assertTrue(response.startsWith("HTTP/1.1 200 OK")); + + //check POST can be in role foo too + response = _connector.getResponses("POST /ctx/omit/x HTTP/1.0\r\n" + + "Authorization: Basic " + B64Code.encode("user3:password") + "\r\n" + + "\r\n"); + assertTrue(response.startsWith("HTTP/1.1 200 OK")); + + //check HEAD cannot be in role user + response = _connector.getResponses("HEAD /ctx/omit/x HTTP/1.0\r\n" + + "Authorization: Basic " + B64Code.encode("user2:password") + "\r\n" + + "\r\n"); + assertTrue(response.startsWith("HTTP/1.1 200 OK"));*/ } + + @Test public void testFormDispatch() throws Exception @@ -847,7 +919,7 @@ public class ConstraintTest public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { baseRequest.setHandled(true); - if (request.getAuthType()==null || "user".equals(request.getRemoteUser()) || request.isUserInRole("user")) + if (request.getAuthType()==null || "user".equals(request.getRemoteUser()) || request.isUserInRole("user") || request.isUserInRole("foo")) { response.setStatus(200); response.setContentType("text/plain; charset=UTF-8"); diff --git a/jetty-security/src/test/java/org/eclipse/jetty/security/SpecExampleConstraintTest.java b/jetty-security/src/test/java/org/eclipse/jetty/security/SpecExampleConstraintTest.java new file mode 100644 index 00000000000..743effadddb --- /dev/null +++ b/jetty-security/src/test/java/org/eclipse/jetty/security/SpecExampleConstraintTest.java @@ -0,0 +1,311 @@ +// +// ======================================================================== +// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// 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.security; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.eclipse.jetty.security.authentication.BasicAuthenticator; +import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.LocalConnector; +import org.eclipse.jetty.server.Request; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.handler.AbstractHandler; +import org.eclipse.jetty.server.handler.ContextHandler; +import org.eclipse.jetty.server.session.SessionHandler; +import org.eclipse.jetty.util.B64Code; +import org.eclipse.jetty.util.security.Constraint; +import org.eclipse.jetty.util.security.Password; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * @version $Revision: 1441 $ $Date: 2010-04-02 12:28:17 +0200 (Fri, 02 Apr 2010) $ + */ +public class SpecExampleConstraintTest +{ + private static final String TEST_REALM = "TestRealm"; + private static Server _server; + private static LocalConnector _connector; + private static SessionHandler _session; + private ConstraintSecurityHandler _security; + + @BeforeClass + public static void startServer() + { + _server = new Server(); + _connector = new LocalConnector(); + _server.setConnectors(new Connector[]{_connector}); + + ContextHandler _context = new ContextHandler(); + _session = new SessionHandler(); + + HashLoginService _loginService = new HashLoginService(TEST_REALM); + _loginService.putUser("fred",new Password("password")); + _loginService.putUser("harry",new Password("password"), new String[] {"HOMEOWNER"}); + _loginService.putUser("chris",new Password("password"), new String[] {"CONTRACTOR"}); + _loginService.putUser("steven", new Password("password"), new String[] {"SALESCLERK"}); + + + _context.setContextPath("/ctx"); + _server.setHandler(_context); + _context.setHandler(_session); + + _server.addBean(_loginService); + } + + @Before + public void setupSecurity() + { + _security = new ConstraintSecurityHandler(); + _session.setHandler(_security); + RequestHandler _handler = new RequestHandler(); + _security.setHandler(_handler); + + + /* + + + + precluded methods + /* + /acme/wholesale/* + /acme/retail/* + GET + POST + + + + */ + + Constraint constraint0 = new Constraint(); + constraint0.setAuthenticate(true); + constraint0.setName("precluded methods"); + ConstraintMapping mapping0 = new ConstraintMapping(); + mapping0.setPathSpec("/*"); + mapping0.setConstraint(constraint0); + mapping0.setMethodOmissions(new String[]{"GET", "POST"}); + + ConstraintMapping mapping1 = new ConstraintMapping(); + mapping1.setPathSpec("/acme/wholesale/*"); + mapping1.setConstraint(constraint0); + mapping1.setMethodOmissions(new String[]{"GET", "POST"}); + + ConstraintMapping mapping2 = new ConstraintMapping(); + mapping2.setPathSpec("/acme/retail/*"); + mapping2.setConstraint(constraint0); + mapping2.setMethodOmissions(new String[]{"GET", "POST"}); + + /* + + + + wholesale + /acme/wholesale/* + GET + PUT + + + SALESCLERK + + + */ + Constraint constraint1 = new Constraint(); + constraint1.setAuthenticate(true); + constraint1.setName("wholesale"); + constraint1.setRoles(new String[]{"SALESCLERK"}); + ConstraintMapping mapping3 = new ConstraintMapping(); + mapping3.setPathSpec("/acme/wholesale/*"); + mapping3.setConstraint(constraint1); + mapping3.setMethod("GET"); + ConstraintMapping mapping4 = new ConstraintMapping(); + mapping4.setPathSpec("/acme/wholesale/*"); + mapping4.setConstraint(constraint1); + mapping4.setMethod("PUT"); + + /* + + + wholesale 2 + /acme/wholesale/* + GET + POST + + + CONTRACTOR + + + CONFIDENTIAL + + + */ + Constraint constraint2 = new Constraint(); + constraint2.setAuthenticate(true); + constraint2.setName("wholesale 2"); + constraint2.setRoles(new String[]{"CONTRACTOR"}); + constraint2.setDataConstraint(Constraint.DC_CONFIDENTIAL); + ConstraintMapping mapping5 = new ConstraintMapping(); + mapping5.setPathSpec("/acme/wholesale/*"); + mapping5.setMethod("GET"); + mapping5.setConstraint(constraint2); + ConstraintMapping mapping6 = new ConstraintMapping(); + mapping6.setPathSpec("/acme/wholesale/*"); + mapping6.setMethod("POST"); + mapping6.setConstraint(constraint2); + + /* + + +retail +/acme/retail/* +GET +POST + + +CONTRACTOR +HOMEOWNER + + +*/ + Constraint constraint4 = new Constraint(); + constraint4.setName("retail"); + constraint4.setAuthenticate(true); + constraint4.setRoles(new String[]{"CONTRACTOR", "HOMEOWNER"}); + ConstraintMapping mapping7 = new ConstraintMapping(); + mapping7.setPathSpec("/acme/retail/*"); + mapping7.setMethod("GET"); + mapping7.setConstraint(constraint4); + ConstraintMapping mapping8 = new ConstraintMapping(); + mapping8.setPathSpec("/acme/retail/*"); + mapping8.setMethod("POST"); + mapping8.setConstraint(constraint4); + + + + + Set knownRoles=new HashSet(); + knownRoles.add("CONTRACTOR"); + knownRoles.add("HOMEOWNER"); + knownRoles.add("SALESCLERK"); + + _security.setConstraintMappings(Arrays.asList(new ConstraintMapping[] + { + mapping0, mapping1, mapping2, mapping3, mapping4, mapping5, mapping6, mapping7, mapping8 + }), knownRoles); + } + + @After + public void stopServer() throws Exception + { + if (_server.isRunning()) + { + _server.stop(); + _server.join(); + } + } + + + + @Test + public void testBasic() throws Exception + { + + _security.setAuthenticator(new BasicAuthenticator()); + _security.setStrict(false); + _server.start(); + + String response; + /* + /star all methods except GET/POST forbidden + /acme/wholesale/star all methods except GET/POST forbidden + /acme/retail/star all methods except GET/POST forbidden + /acme/wholesale/star GET must be in role CONTRACTOR or SALESCLERK + /acme/wholesale/star POST must be in role CONTRACTOR and confidential transport + /acme/retail/star GET must be in role CONTRACTOR or HOMEOWNER + /acme/retail/star POST must be in role CONTRACTOR or HOMEOWNER + */ + + //a user in role HOMEOWNER is forbidden HEAD request + response = _connector.getResponses("HEAD /ctx/index.html HTTP/1.0\r\n\r\n"); + assertTrue(response.startsWith("HTTP/1.1 403 Forbidden")); + + response = _connector.getResponses("HEAD /ctx/index.html HTTP/1.0\r\n" + + "Authorization: Basic " + B64Code.encode("harry:password") + "\r\n" + + "\r\n"); + assertTrue(response.startsWith("HTTP/1.1 403 Forbidden")); + + response = _connector.getResponses("HEAD /ctx/acme/wholesale/index.html HTTP/1.0\r\n" + + "Authorization: Basic " + B64Code.encode("harry:password") + "\r\n" + + "\r\n"); + assertTrue(response.startsWith("HTTP/1.1 403 Forbidden")); + + response = _connector.getResponses("HEAD /ctx/acme/retail/index.html HTTP/1.0\r\n" + + "Authorization: Basic " + B64Code.encode("harry:password") + "\r\n" + + "\r\n"); + assertTrue(response.startsWith("HTTP/1.1 403 Forbidden")); + + //a user in role CONTRACTOR can do a GET + response = _connector.getResponses("GET /ctx/acme/wholesale/index.html HTTP/1.0\r\n" + + "Authorization: Basic " + B64Code.encode("chris:password") + "\r\n" + + "\r\n"); + + assertTrue(response.startsWith("HTTP/1.1 200 OK")); + + //a user in role CONTRACTOR can only do a post if confidential + response = _connector.getResponses("POST /ctx/acme/wholesale/index.html HTTP/1.0\r\n" + + "Authorization: Basic " + B64Code.encode("chris:password") + "\r\n" + + "\r\n"); + assertTrue(response.startsWith("HTTP/1.1 403 !Confidential")); + + + //a user in role HOMEOWNER can do a GET + response = _connector.getResponses("GET /ctx/acme/retail/index.html HTTP/1.0\r\n" + + "Authorization: Basic " + B64Code.encode("harry:password") + "\r\n" + + "\r\n"); + assertTrue(response.startsWith("HTTP/1.1 200 OK")); + } + + + private class RequestHandler extends AbstractHandler + { + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException + { + baseRequest.setHandled(true); + + response.setStatus(200); + response.setContentType("text/plain; charset=UTF-8"); + response.getWriter().println("URI="+request.getRequestURI()); + String user = request.getRemoteUser(); + response.getWriter().println("user="+user); + if (request.getParameter("test_parameter")!=null) + response.getWriter().println(request.getParameter("test_parameter")); + } + } + +} 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 6944f6d65c4..5850f003520 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 @@ -626,7 +626,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor { //no servlet mappings context.getMetaData().setOrigin(servlet_name+".servlet.mappings", descriptor); - ServletMapping mapping = addServletMapping(servlet_name, node, context); + ServletMapping mapping = addServletMapping(servlet_name, node, context, descriptor); mapping.setDefault(context.getMetaData().getOrigin(servlet_name+".servlet.mappings") == Origin.WebDefaults); break; } @@ -638,14 +638,14 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor //otherwise just ignore it if (!(descriptor instanceof FragmentDescriptor)) { - addServletMapping(servlet_name, node, context); + addServletMapping(servlet_name, node, context, descriptor); } break; } case WebFragment: { //mappings previously set by another web-fragment, so merge in this web-fragment's mappings - addServletMapping(servlet_name, node, context); + addServletMapping(servlet_name, node, context, descriptor); break; } } @@ -1170,7 +1170,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param node * @param context */ - protected ServletMapping addServletMapping (String servletName, XmlParser.Node node, WebAppContext context) + protected ServletMapping addServletMapping (String servletName, XmlParser.Node node, WebAppContext context, Descriptor descriptor) { ServletMapping mapping = new ServletMapping(); mapping.setServletName(servletName); @@ -1182,6 +1182,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor String p = iter.next().toString(false, true); p = normalizePattern(p); paths.add(p); + context.getMetaData().setOrigin(servletName+".servlet.mapping."+p, descriptor); } mapping.setPathSpecs((String[]) paths.toArray(new String[paths.size()])); context.getServletHandler().addServletMapping(mapping); @@ -1193,7 +1194,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param node * @param context */ - protected void addFilterMapping (String filterName, XmlParser.Node node, WebAppContext context) + protected void addFilterMapping (String filterName, XmlParser.Node node, WebAppContext context, Descriptor descriptor) { FilterMapping mapping = new FilterMapping(); mapping.setFilterName(filterName); @@ -1205,6 +1206,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor String p = iter.next().toString(false, true); p = normalizePattern(p); paths.add(p); + context.getMetaData().setOrigin(filterName+".filter.mapping."+p, descriptor); } mapping.setPathSpecs((String[]) paths.toArray(new String[paths.size()])); @@ -1361,6 +1363,8 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor //ServletSpec 3.0, p74 security-constraints, as minOccurs > 1, are additive //across fragments + + //TODO: need to remember origin of the constraints try { XmlParser.Node auths = node.get("auth-constraint"); @@ -1409,29 +1413,50 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor { String url = iter2.next().toString(false, true); url = normalizePattern(url); - + //remember origin so we can process ServletRegistration.Dynamic.setServletSecurityElement() correctly + context.getMetaData().setOrigin("constraint.url."+url, descriptor); + Iterator iter3 = collection.iterator("http-method"); + Iterator iter4 = collection.iterator("http-method-omission"); + if (iter3.hasNext()) { + if (iter4.hasNext()) + throw new IllegalStateException ("web-resource-collection cannot contain both http-method and http-method-omission"); + + //configure all the http-method elements for each url while (iter3.hasNext()) { String method = ((XmlParser.Node) iter3.next()).toString(false, true); ConstraintMapping mapping = new ConstraintMapping(); mapping.setMethod(method); mapping.setPathSpec(url); + mapping.setConstraint(sc); + ((ConstraintAware)context.getSecurityHandler()).addConstraintMapping(mapping); + } + } + else if (iter4.hasNext()) + { + //configure all the http-method-omission elements for each url + while (iter4.hasNext()) + { + String method = ((XmlParser.Node)iter4.next()).toString(false, true); + ConstraintMapping mapping = new ConstraintMapping(); + mapping.setMethodOmissions(new String[]{method}); + mapping.setPathSpec(url); mapping.setConstraint(sc); - ((ConstraintAware)context.getSecurityHandler()).addConstraintMapping(mapping); } } else { + //No http-methods or http-method-omissions specified, the constraint applies to all ConstraintMapping mapping = new ConstraintMapping(); mapping.setPathSpec(url); mapping.setConstraint(sc); ((ConstraintAware)context.getSecurityHandler()).addConstraintMapping(mapping); } - } + } } } catch (CloneNotSupportedException e) @@ -1777,7 +1802,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor { //no filtermappings for this filter yet defined context.getMetaData().setOrigin(filter_name+".filter.mappings", descriptor); - addFilterMapping(filter_name, node, context); + addFilterMapping(filter_name, node, context, descriptor); break; } case WebDefaults: @@ -1787,14 +1812,14 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor //filter mappings defined in a web xml file. If we're processing a fragment, we ignore filter mappings. if (!(descriptor instanceof FragmentDescriptor)) { - addFilterMapping(filter_name, node, context); + addFilterMapping(filter_name, node, context, descriptor); } break; } case WebFragment: { //filter mappings first defined in a web-fragment, allow other fragments to add - addFilterMapping(filter_name, node, context); + addFilterMapping(filter_name, node, context, descriptor); break; } } From ce3ba5888718ce131265bffd6823a234fdbbc1c2 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Sat, 29 Sep 2012 16:15:55 +1000 Subject: [PATCH 21/56] 390163 Implement ServletRegistration.Dynamic.setServletSecurity --- .../ServletSecurityAnnotationHandler.java | 132 ++---------- .../security/ConstraintSecurityHandler.java | 22 +- .../jetty/servlet/ServletContextHandler.java | 15 +- .../org/eclipse/jetty/webapp/MetaData.java | 9 + .../java/org/eclipse/jetty/webapp/Origin.java | 2 +- .../eclipse/jetty/webapp/WebAppContext.java | 87 ++++++++ .../config/contexts/test.d/override-web.xml | 9 - .../src/main/java/com/acme/RegTest.java | 194 ++++++++++++++++++ .../src/main/java/com/acme/TestListener.java | 36 +++- .../src/main/webapp/WEB-INF/web.xml | 27 ++- test-jetty-webapp/src/main/webapp/auth.html | 2 + 11 files changed, 377 insertions(+), 158 deletions(-) create mode 100644 test-jetty-webapp/src/main/java/com/acme/RegTest.java diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ServletSecurityAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ServletSecurityAnnotationHandler.java index ee2c45c66ae..bfbef9bf9c9 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ServletSecurityAnnotationHandler.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ServletSecurityAnnotationHandler.java @@ -21,6 +21,7 @@ package org.eclipse.jetty.annotations; import java.util.ArrayList; import java.util.List; +import javax.servlet.ServletSecurityElement; import javax.servlet.annotation.HttpConstraint; import javax.servlet.annotation.HttpMethodConstraint; import javax.servlet.annotation.ServletSecurity; @@ -30,12 +31,13 @@ import javax.servlet.annotation.ServletSecurity.TransportGuarantee; import org.eclipse.jetty.annotations.AnnotationIntrospector.AbstractIntrospectableAnnotationHandler; import org.eclipse.jetty.security.ConstraintAware; import org.eclipse.jetty.security.ConstraintMapping; +import org.eclipse.jetty.security.ConstraintSecurityHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.servlet.ServletMapping; -import org.eclipse.jetty.util.LazyList; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.security.Constraint; +import org.eclipse.jetty.webapp.Origin; import org.eclipse.jetty.webapp.WebAppContext; /** @@ -82,7 +84,7 @@ public class ServletSecurityAnnotationHandler extends AbstractIntrospectableAnno if (servletSecurity == null) return; - //If there are already constraints defined (ie from web.xml or programmatically(?)) that match any + //If there are already constraints defined (ie from web.xml) that match any //of the url patterns defined for this servlet, then skip the security annotation. List servletMappings = getServletMappings(clazz.getCanonicalName()); @@ -97,19 +99,15 @@ public class ServletSecurityAnnotationHandler extends AbstractIntrospectableAnno //Make a fresh list constraintMappings = new ArrayList(); - //Get the values that form the constraints that will apply unless there are HttpMethodConstraints to augment them - HttpConstraint defaults = servletSecurity.value(); - - //Make a Constraint for the and specified by the HttpConstraint - Constraint defaultConstraint = makeConstraint (clazz, - defaults.rolesAllowed(), - defaults.value(), - defaults.transportGuarantee()); - - constraintMappings.addAll(makeMethodMappings(clazz, - defaultConstraint, - servletMappings, - servletSecurity.httpMethodConstraints())); + ServletSecurityElement securityElement = new ServletSecurityElement(servletSecurity); + for (ServletMapping sm : servletMappings) + { + for (String url : sm.getPathSpecs()) + { + _context.getMetaData().setOrigin("constraint.url."+url, Origin.Annotation); + constraintMappings.addAll(ConstraintSecurityHandler.createConstraintsWithMappingsForPath(clazz.getName(), url, securityElement)); + } + } //set up the security constraints produced by the annotation ConstraintAware securityHandler = (ConstraintAware)_context.getSecurityHandler(); @@ -131,111 +129,10 @@ public class ServletSecurityAnnotationHandler extends AbstractIntrospectableAnno */ protected Constraint makeConstraint (Class servlet, String[] rolesAllowed, EmptyRoleSemantic permitOrDeny, TransportGuarantee transport) { - Constraint constraint = new Constraint(); - if (rolesAllowed == null || rolesAllowed.length==0) - { - if (permitOrDeny.equals(EmptyRoleSemantic.DENY)) - { - //Equivalent to with no roles - constraint.setName(servlet.getName()+"-Deny"); - constraint.setAuthenticate(true); - } - else - { - //Equivalent to no - constraint.setAuthenticate(false); - constraint.setName(servlet.getName()+"-Permit"); - } - } - else - { - //Equivalent to with list of s - constraint.setAuthenticate(true); - constraint.setRoles(rolesAllowed); - constraint.setName(servlet.getName()+"-RolesAllowed"); - } - - //Equivalent to //CONFIDENTIAL - constraint.setDataConstraint((transport.equals(TransportGuarantee.CONFIDENTIAL)?Constraint.DC_CONFIDENTIAL:Constraint.DC_NONE)); - return constraint; + return ConstraintSecurityHandler.createConstraint(servlet.getName(), rolesAllowed, permitOrDeny, transport); } - /** - * Make a ConstraintMapping which captures the or elements for a particular url pattern, - * and relates it to a Constraint object ( and ). - * @param constraint - * @param url - * @param method - * @param omissions - * @return - */ - protected ConstraintMapping makeConstraintMapping (Constraint constraint, String url, String method, String[] omissions) - { - ConstraintMapping mapping = new ConstraintMapping(); - mapping.setConstraint(constraint); - mapping.setPathSpec(url); - if (method != null) - mapping.setMethod(method); - if (omissions != null) - mapping.setMethodOmissions(omissions); - return mapping; - } - - /** - * Make the Jetty Constraints and ConstraintMapping objects that correspond to the HttpMethodConstraint - * annotations for each url pattern for the servlet. - * @param servlet - * @param defaultConstraint - * @param servletMappings - * @param annotations - * @return - */ - protected List makeMethodMappings (Class servlet, Constraint defaultConstraint, List servletMappings, HttpMethodConstraint[] annotations) - { - List mappings = new ArrayList(); - - //for each url-pattern existing for the servlet make a ConstraintMapping for the HttpConstraint, and ConstraintMappings for - //each HttpMethodConstraint - for (ServletMapping sm : servletMappings) - { - for (String url : sm.getPathSpecs()) - { - //Make a ConstraintMapping that matches the defaultConstraint - ConstraintMapping defaultMapping = makeConstraintMapping(defaultConstraint, url, null, null); - - //If there are HttpMethodConstraint annotations, make a Constraint and a ConstraintMapping for it - if (annotations != null && annotations.length>0) - { - List omissions = new ArrayList(); - - //for each HttpMethodConstraint annotation, make a new Constraint and ConstraintMappings for this url - for (int i=0; i < annotations.length;i++) - { - //Make a Constraint that captures the and elements - Constraint methodConstraint = makeConstraint(servlet, - annotations[i].rolesAllowed(), - annotations[i].emptyRoleSemantic(), - annotations[i].transportGuarantee()); - - //Make ConstraintMapping that captures the elements - ConstraintMapping methodConstraintMapping = makeConstraintMapping (methodConstraint, - url,annotations[i].value(), - null); - mappings.add(methodConstraintMapping); - omissions.add(annotations[i].value()); - } - defaultMapping.setMethodOmissions(omissions.toArray(new String[0])); - } - - //add the constraint mapping containing the http-method-omissions, if there are any - mappings.add(defaultMapping); - } - } - return mappings; - } - - /** * Get the ServletMappings for the servlet's class. @@ -284,6 +181,7 @@ public class ServletSecurityAnnotationHandler extends AbstractIntrospectableAnno { for (int j=0; j < pathSpecs.length; j++) { + //TODO decide if we need to check the origin if (pathSpecs[j].equals(constraintMappings.get(i).getPathSpec())) { exists = true; diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/ConstraintSecurityHandler.java b/jetty-security/src/main/java/org/eclipse/jetty/security/ConstraintSecurityHandler.java index 94f70f565cd..5712c1df929 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/ConstraintSecurityHandler.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/ConstraintSecurityHandler.java @@ -24,7 +24,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -51,7 +50,7 @@ import org.eclipse.jetty.util.security.Constraint; /* ------------------------------------------------------------ */ /** * Handler to enforce SecurityConstraints. This implementation is servlet spec - * 2.4 compliant and precomputes the constraint combinations for runtime + * 3.0 compliant and precomputes the constraint combinations for runtime * efficiency. * */ @@ -191,9 +190,11 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr /* ------------------------------------------------------------ */ - /** + /** Take out of the constraint mappings those that match the + * given path. + * * @param pathSpec - * @param constraintMappings + * @param constraintMappings a new list minus the matching constraints * @return */ public static List removeConstraintMappingsForPath(String pathSpec, List constraintMappings) @@ -351,8 +352,6 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr */ public void setConstraintMappings(List constraintMappings, Set roles) { - if (isStarted()) - throw new IllegalStateException("Started"); _constraintMappings.clear(); _constraintMappings.addAll(constraintMappings); @@ -371,6 +370,14 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr } } setRoles(roles); + + if (isStarted()) + { + for (ConstraintMapping mapping : _constraintMappings) + { + processConstraintMapping(mapping); + } + } } /* ------------------------------------------------------------ */ @@ -383,9 +390,6 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr */ public void setRoles(Set roles) { - if (isStarted()) - throw new IllegalStateException("Started"); - _roles.clear(); _roles.addAll(roles); } diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletContextHandler.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletContextHandler.java index 1c713637187..055060ae919 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletContextHandler.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletContextHandler.java @@ -48,6 +48,7 @@ import javax.servlet.descriptor.JspPropertyGroupDescriptor; import javax.servlet.descriptor.TaglibDescriptor; import org.eclipse.jetty.security.ConstraintAware; +import org.eclipse.jetty.security.ConstraintMapping; import org.eclipse.jetty.security.ConstraintSecurityHandler; import org.eclipse.jetty.security.SecurityHandler; import org.eclipse.jetty.server.Dispatcher; @@ -59,6 +60,7 @@ import org.eclipse.jetty.server.handler.HandlerCollection; import org.eclipse.jetty.server.handler.HandlerWrapper; import org.eclipse.jetty.server.session.SessionHandler; import org.eclipse.jetty.util.LazyList; +import org.eclipse.jetty.util.security.Constraint; /* ------------------------------------------------------------ */ @@ -377,10 +379,21 @@ public class ServletContextHandler extends ContextHandler * @param registration ServletRegistration.Dynamic instance that setServletSecurity was called on * @param servletSecurityElement new security info * @return the set of exact URL mappings currently associated with the registration that are also present in the web.xml - * security constratins and thus will be unaffected by this call. + * security constraints and thus will be unaffected by this call. */ public Set setServletSecurity(ServletRegistration.Dynamic registration, ServletSecurityElement servletSecurityElement) { + //Default implementation is to just accept them all. If using a webapp, then this behaviour is overridden in WebAppContext.setServletSecurity + Collection pathSpecs = registration.getMappings(); + if (pathSpecs != null) + { + for (String pathSpec:pathSpecs) + { + List mappings = ConstraintSecurityHandler.createConstraintsWithMappingsForPath(registration.getName(), pathSpec, servletSecurityElement); + for (ConstraintMapping m:mappings) + ((ConstraintAware)getSecurityHandler()).addConstraintMapping(m); + } + } return Collections.emptySet(); } diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java index 284a1cdd063..cdd84b705de 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java @@ -538,6 +538,15 @@ public class MetaData OriginInfo x = new OriginInfo (name, Origin.Annotation); _origins.put(name, x); } + + public void setOrigin(String name, Origin origin) + { + if (name == null) + return; + + OriginInfo x = new OriginInfo (name, origin); + _origins.put(name, x); + } public boolean isMetaDataComplete() { diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Origin.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Origin.java index 1481b3804f7..f2f941c478b 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Origin.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Origin.java @@ -18,4 +18,4 @@ package org.eclipse.jetty.webapp; -public enum Origin {NotSet, WebXml, WebDefaults, WebOverride, WebFragment, Annotation} \ No newline at end of file +public enum Origin {NotSet, WebXml, WebDefaults, WebOverride, WebFragment, Annotation, API} \ No newline at end of file diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java index ed0d8f2384e..45ffa3ad590 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java @@ -25,18 +25,29 @@ import java.net.URL; import java.security.PermissionCollection; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.Collections; import java.util.EventListener; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; +import javax.servlet.HttpMethodConstraintElement; import javax.servlet.ServletContext; +import javax.servlet.ServletRegistration.Dynamic; +import javax.servlet.ServletSecurityElement; +import javax.servlet.annotation.ServletSecurity.EmptyRoleSemantic; +import javax.servlet.annotation.ServletSecurity.TransportGuarantee; import javax.servlet.http.HttpSessionActivationListener; import javax.servlet.http.HttpSessionAttributeListener; import javax.servlet.http.HttpSessionBindingListener; import javax.servlet.http.HttpSessionListener; +import org.eclipse.jetty.security.ConstraintAware; +import org.eclipse.jetty.security.ConstraintMapping; +import org.eclipse.jetty.security.ConstraintSecurityHandler; import org.eclipse.jetty.security.SecurityHandler; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.HandlerContainer; @@ -56,6 +67,7 @@ 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.util.resource.ResourceCollection; +import org.eclipse.jetty.util.security.Constraint; /* ------------------------------------------------------------ */ /** Web Application Context Handler. @@ -1237,6 +1249,79 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL super.startContext(); } + + /* ------------------------------------------------------------ */ + @Override + public Set setServletSecurity(Dynamic registration, ServletSecurityElement servletSecurityElement) + { + + Set unchangedURLMappings = new HashSet(); + //From javadoc for ServletSecurityElement: + /* + If a URL pattern of this ServletRegistration is an exact target of a security-constraint that + was established via the portable deployment descriptor, then this method does not change the + security-constraint for that pattern, and the pattern will be included in the return value. + + If a URL pattern of this ServletRegistration is an exact target of a security constraint + that was established via the ServletSecurity annotation or a previous call to this method, + then this method replaces the security constraint for that pattern. + + If a URL pattern of this ServletRegistration is neither the exact target of a security constraint + that was established via the ServletSecurity annotation or a previous call to this method, + nor the exact target of a security-constraint in the portable deployment descriptor, then + this method establishes the security constraint for that pattern from the argument ServletSecurityElement. + */ + + Collection pathMappings = registration.getMappings(); + if (pathMappings != null) + { + Constraint constraint = ConstraintSecurityHandler.createConstraint(registration.getName(), servletSecurityElement); + + for (String pathSpec:pathMappings) + { + Origin origin = getMetaData().getOrigin("constraint.url."+pathSpec); + + switch (origin) + { + case NotSet: + { + //No mapping for this url already established + List mappings = ConstraintSecurityHandler.createConstraintsWithMappingsForPath(registration.getName(), pathSpec, servletSecurityElement); + for (ConstraintMapping m:mappings) + ((ConstraintAware)getSecurityHandler()).addConstraintMapping(m); + getMetaData().setOrigin("constraint.url."+pathSpec, Origin.API); + break; + } + case WebXml: + case WebDefaults: + case WebOverride: + case WebFragment: + { + //a mapping for this url was created in a descriptor, which overrides everything + unchangedURLMappings.add(pathSpec); + break; + } + case Annotation: + case API: + { + //mapping established via an annotation or by previous call to this method, + //replace the security constraint for this pattern + List constraintMappings = ConstraintSecurityHandler.removeConstraintMappingsForPath(pathSpec, ((ConstraintAware)getSecurityHandler()).getConstraintMappings()); + + List freshMappings = ConstraintSecurityHandler.createConstraintsWithMappingsForPath(registration.getName(), pathSpec, servletSecurityElement); + constraintMappings.addAll(freshMappings); + + ((ConstraintSecurityHandler)getSecurityHandler()).setConstraintMappings(constraintMappings); + break; + } + } + } + } + + return unchangedURLMappings; + } + + /* ------------------------------------------------------------ */ public class Context extends ServletContextHandler.Context @@ -1287,6 +1372,8 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL } } + + } /* ------------------------------------------------------------ */ diff --git a/test-jetty-webapp/src/main/config/contexts/test.d/override-web.xml b/test-jetty-webapp/src/main/config/contexts/test.d/override-web.xml index 9e42d6d5ef9..7b7f9e43126 100644 --- a/test-jetty-webapp/src/main/config/contexts/test.d/override-web.xml +++ b/test-jetty-webapp/src/main/config/contexts/test.d/override-web.xml @@ -15,15 +15,6 @@ a context value - - - TestFilter - com.acme.TestFilter - - remote - false - - diff --git a/test-jetty-webapp/src/main/java/com/acme/RegTest.java b/test-jetty-webapp/src/main/java/com/acme/RegTest.java new file mode 100644 index 00000000000..8d99cd11a59 --- /dev/null +++ b/test-jetty-webapp/src/main/java/com/acme/RegTest.java @@ -0,0 +1,194 @@ +// +// ======================================================================== +// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// 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 com.acme; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.eclipse.jetty.util.StringUtil; + + + + +/* ------------------------------------------------------------ */ +/** Rego Servlet - tests being accessed from servlet 3.0 programmatic + * configuration. + * + */ +public class RegTest extends HttpServlet +{ + + /* ------------------------------------------------------------ */ + @Override + public void init(ServletConfig config) throws ServletException + { + super.init(config); + } + + /* ------------------------------------------------------------ */ + @Override + public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException + { + doGet(request, response); + } + + /* ------------------------------------------------------------ */ + @Override + public void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException + { + request.setCharacterEncoding("UTF-8"); + PrintWriter pout=null; + + try + { + pout =response.getWriter(); + } + catch(IllegalStateException e) + { + pout=new PrintWriter(new OutputStreamWriter(response.getOutputStream(),"UTF-8")); + } + + try + { + pout.write("\n\n"); + pout.write("

Rego Servlet

\n"); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + pout.write("\n"); + pout.write(""); + pout.write(""); + + pout.write("\n"); + pout.write(""); + pout.write(""); + + pout.write("
getMethod: " + notag(request.getMethod())+"
getContentLength: "+Integer.toString(request.getContentLength())+"
getContentType: "+notag(request.getContentType())+"
getRequestURI: "+notag(request.getRequestURI())+"
getRequestURL: "+notag(request.getRequestURL().toString())+"
getContextPath: "+request.getContextPath()+"
getServletPath: "+notag(request.getServletPath())+"
getPathInfo: "+notag(request.getPathInfo())+"
getPathTranslated: "+notag(request.getPathTranslated())+"
getQueryString: "+notag(request.getQueryString())+"
getProtocol: "+request.getProtocol()+"
getScheme: "+request.getScheme()+"
getServerName: "+notag(request.getServerName())+"
getServerPort: "+Integer.toString(request.getServerPort())+"
getLocalName: "+request.getLocalName()+"
getLocalAddr: "+request.getLocalAddr()+"
getLocalPort: "+Integer.toString(request.getLocalPort())+"
getRemoteUser: "+request.getRemoteUser()+"
getUserPrincipal: "+request.getUserPrincipal()+"
getRemoteAddr: "+request.getRemoteAddr()+"
getRemoteHost: "+request.getRemoteHost()+"
getRemotePort: "+request.getRemotePort()+"
getRequestedSessionId: "+request.getRequestedSessionId()+"
isSecure(): "+request.isSecure()+"
isUserInRole(admin): "+request.isUserInRole("admin")+"
"); + + } + catch (Exception e) + { + getServletContext().log("dump "+e); + } + + + pout.write("\n\n"); + + pout.close(); + } + + + /* ------------------------------------------------------------ */ + @Override + public String getServletInfo() + { + return "Rego Servlet"; + } + + /* ------------------------------------------------------------ */ + @Override + public synchronized void destroy() + { + } + + + private String notag(String s) + { + if (s==null) + return "null"; + s=StringUtil.replace(s,"&","&"); + s=StringUtil.replace(s,"<","<"); + s=StringUtil.replace(s,">",">"); + return s; + } +} diff --git a/test-jetty-webapp/src/main/java/com/acme/TestListener.java b/test-jetty-webapp/src/main/java/com/acme/TestListener.java index faaa76085b9..cf950edb7da 100644 --- a/test-jetty-webapp/src/main/java/com/acme/TestListener.java +++ b/test-jetty-webapp/src/main/java/com/acme/TestListener.java @@ -18,6 +18,7 @@ package com.acme; +import javax.servlet.DispatcherType; import javax.servlet.ServletContextAttributeEvent; import javax.servlet.ServletContextAttributeListener; import javax.servlet.ServletContextEvent; @@ -26,6 +27,12 @@ import javax.servlet.ServletRequestAttributeEvent; import javax.servlet.ServletRequestAttributeListener; import javax.servlet.ServletRequestEvent; import javax.servlet.ServletRequestListener; +import javax.servlet.ServletRegistration; +import javax.servlet.FilterRegistration; +import javax.servlet.ServletSecurityElement; +import javax.servlet.HttpConstraintElement; +import javax.servlet.HttpMethodConstraintElement; +import javax.servlet.annotation.ServletSecurity; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSessionActivationListener; import javax.servlet.http.HttpSessionAttributeListener; @@ -33,6 +40,9 @@ import javax.servlet.http.HttpSessionBindingEvent; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; +import java.util.EnumSet; +import java.util.Set; + public class TestListener implements HttpSessionListener, HttpSessionAttributeListener, HttpSessionActivationListener, ServletContextListener, ServletContextAttributeListener, ServletRequestListener, ServletRequestAttributeListener { public void attributeAdded(HttpSessionBindingEvent se) @@ -62,16 +72,30 @@ public class TestListener implements HttpSessionListener, HttpSessionAttributeL public void contextInitialized(ServletContextEvent sce) { - /* TODO for servlet 3.0 - * FilterRegistration registration=context.addFilter("TestFilter",TestFilter.class.getName()); - - + //configure programmatic security + ServletRegistration.Dynamic rego = sce.getServletContext().addServlet("RegoTest", RegTest.class.getName()); + rego.addMapping("/rego/*"); + HttpConstraintElement constraintElement = new HttpConstraintElement(ServletSecurity.EmptyRoleSemantic.PERMIT, + ServletSecurity.TransportGuarantee.NONE, new String[]{"admin"}); + ServletSecurityElement securityElement = new ServletSecurityElement(constraintElement, null); + Set unchanged = rego.setServletSecurity(securityElement); + System.err.println("Security constraints registered: "+unchanged.isEmpty()); + + //Test that a security constraint from web.xml can't be overridden programmatically + ServletRegistration.Dynamic rego2 = sce.getServletContext().addServlet("RegoTest2", RegTest.class.getName()); + rego2.addMapping("/rego2/*"); + securityElement = new ServletSecurityElement(constraintElement, null); + unchanged = rego2.setServletSecurity(securityElement); + System.err.println("Overridding web.xml constraints not possible:" +!unchanged.isEmpty()); + + /* For servlet 3.0 */ + FilterRegistration.Dynamic registration = sce.getServletContext().addFilter("TestFilter",TestFilter.class.getName()); + registration.setInitParameter("remote", "false"); registration.setAsyncSupported(true); registration.addMappingForUrlPatterns( EnumSet.of(DispatcherType.ERROR,DispatcherType.ASYNC,DispatcherType.FORWARD,DispatcherType.INCLUDE,DispatcherType.REQUEST), true, - new String[]{"/dump/*","/dispatch/*","*.dump"}); - */ + new String[]{"/*"}); } public void contextDestroyed(ServletContextEvent sce) diff --git a/test-jetty-webapp/src/main/webapp/WEB-INF/web.xml b/test-jetty-webapp/src/main/webapp/WEB-INF/web.xml index a0c2bb329af..9fc7003d2fa 100644 --- a/test-jetty-webapp/src/main/webapp/WEB-INF/web.xml +++ b/test-jetty-webapp/src/main/webapp/WEB-INF/web.xml @@ -18,20 +18,6 @@ com.acme.TestListener - - TestFilter - com.acme.TestFilter - true - - remote - false - - - - TestFilter - /* - - QoSFilter @@ -120,7 +106,6 @@ --> - Hello com.acme.HelloWorld @@ -275,6 +260,18 @@ /error404.html + + + + + Rego2 + /rego2/* + + + server-administrator + + + Auth2 diff --git a/test-jetty-webapp/src/main/webapp/auth.html b/test-jetty-webapp/src/main/webapp/auth.html index 1b1de1157c3..0bce2d555f6 100644 --- a/test-jetty-webapp/src/main/webapp/auth.html +++ b/test-jetty-webapp/src/main/webapp/auth.html @@ -18,6 +18,8 @@ This page contains several links to test the authentication constraints:
  • dump/auth/* - Authenticated any user
  • dump/auth/admin/* - Authenticated admin role (click to invalidate session)
  • dump/auth/ssl/* - Confidential
  • +
  • rego/info/* - Authenticated admin role from programmatic security (click to invalidate session)
  • +
  • rego2/info/* - Authenticated servlet-administrator role from programmatic security (login as admin/admin, click to invalidate session)
  • From 23fe83a689e17d3a1941bc02bde5c96c605b82d8 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 4 Oct 2012 14:51:13 +1000 Subject: [PATCH 22/56] 391082 No exception if multipart input stream incomplete --- .../main/java/org/eclipse/jetty/util/MultiPartInputStream.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java b/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java index d4d22391357..1807bdde7b5 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java @@ -589,6 +589,8 @@ public class MultiPartInputStream part.close(); } } + if (!lastPart) + throw new IOException("Incomplete parts"); } From 25cdef966ce4082856b3c4e0d65120f4ccac3242 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 4 Oct 2012 15:24:23 +1000 Subject: [PATCH 23/56] 391080 Multipart temp files can be left on disk with MultiPartFilter --- .../org/eclipse/jetty/server/Request.java | 18 +++++ .../jetty/servlets/MultiPartFilter.java | 33 +++----- .../jetty/servlets/MultipartFilterTest.java | 2 +- .../jetty/util/MultiPartInputStream.java | 39 ++++++++- .../jetty/util/MultiPartInputStreamTest.java | 80 +++++++++++++++---- 5 files changed, 131 insertions(+), 41 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index 47b5d3acd41..db32fdc258a 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -1433,6 +1433,24 @@ public class Request implements HttpServletRequest if (_savedNewSessions != null) _savedNewSessions.clear(); _savedNewSessions=null; + if (_multiPartInputStream != null) + { + Collection parts = _multiPartInputStream.getParsedParts(); + if (parts != null) + { + for (Part p:parts) + { + try + { + p.delete(); + } + catch (IOException e) + { + LOG.warn("Error deleting multipart file", e); + } + } + } + } _multiPartInputStream = null; } diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/MultiPartFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/MultiPartFilter.java index c6f34a16ebe..15c1faaa17b 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/MultiPartFilter.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/MultiPartFilter.java @@ -84,7 +84,7 @@ import org.eclipse.jetty.util.TypeUtil; public class MultiPartFilter implements Filter { public final static String CONTENT_TYPE_SUFFIX=".org.eclipse.jetty.servlet.contentType"; - private final static String FILES ="org.eclipse.jetty.servlet.MultiPartFilter.files"; + private final static String MULTIPART = "org.eclipse.jetty.servlet.MultiPartInputStream"; private File tempdir; private boolean _deleteFiles; private ServletContext _context; @@ -149,7 +149,8 @@ public class MultiPartFilter implements Filter MultipartConfigElement config = new MultipartConfigElement(tempdir.getCanonicalPath(), _maxFileSize, _maxRequestSize, _fileOutputBuffer); MultiPartInputStream mpis = new MultiPartInputStream(in, content_type, config, tempdir); - + mpis.setDeleteOnExit(_deleteFiles); + request.setAttribute(MULTIPART, mpis); try { @@ -170,18 +171,6 @@ public class MultiPartFilter implements Filter if (mp.getContentType() != null) params.add(mp.getName()+CONTENT_TYPE_SUFFIX, mp.getContentType()); } - if (_deleteFiles) - { - mp.getFile().deleteOnExit(); - - ArrayList files = (ArrayList)request.getAttribute(FILES); - if (files==null) - { - files=new ArrayList(); - request.setAttribute(FILES,files); - } - files.add(mp.getFile()); - } } else { @@ -205,23 +194,23 @@ public class MultiPartFilter implements Filter private void deleteFiles(ServletRequest request) { - ArrayList files = (ArrayList)request.getAttribute(FILES); - if (files!=null) + MultiPartInputStream mpis = (MultiPartInputStream)request.getAttribute(MULTIPART); + if (mpis != null) { - Iterator iter = files.iterator(); - while (iter.hasNext()) + Collection parts = mpis.getParsedParts(); + for (Part p:parts) { - File file=(File)iter.next(); try { - file.delete(); - } + p.delete(); + } catch(Exception e) { - _context.log("failed to delete "+file,e); + _context.log("Failed to delete "+p.getName(),e); } } } + request.removeAttribute(MULTIPART); } /* ------------------------------------------------------------ */ diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/MultipartFilterTest.java b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/MultipartFilterTest.java index 11bab2c3963..38e2c8bbdca 100644 --- a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/MultipartFilterTest.java +++ b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/MultipartFilterTest.java @@ -121,7 +121,7 @@ public class MultipartFilterTest response.parse(tester.getResponses(request.generate())); assertTrue(response.getMethod()==null); - assertEquals(HttpServletResponse.SC_OK,response.getStatus()); + assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,response.getStatus()); } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java b/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java index 1807bdde7b5..48069f38115 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java @@ -34,6 +34,7 @@ import java.io.InputStreamReader; import java.io.OutputStream; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -59,7 +60,7 @@ public class MultiPartInputStream protected MultiMap _parts; protected File _tmpDir; protected File _contextTmpDir; - + protected boolean _deleteOnExit; @@ -141,6 +142,9 @@ public class MultiPartInputStream throws IOException { _file = File.createTempFile("MultiPart", "", MultiPartInputStream.this._tmpDir); + if (_deleteOnExit) + _file.deleteOnExit(); + FileOutputStream fos = new FileOutputStream(_file); BufferedOutputStream bos = new BufferedOutputStream(fos); @@ -244,6 +248,8 @@ public class MultiPartInputStream { //part data is only in the ByteArrayOutputStream and never been written to disk _file = new File (_tmpDir, fileName); + if (_deleteOnExit) + _file.deleteOnExit(); BufferedOutputStream bos = null; try { @@ -262,6 +268,8 @@ public class MultiPartInputStream { //the part data is already written to a temporary file, just rename it File f = new File(_tmpDir, fileName); + if (_deleteOnExit) + f.deleteOnExit(); if (_file.renameTo(f)) _file = f; } @@ -318,7 +326,21 @@ public class MultiPartInputStream _config = new MultipartConfigElement(_contextTmpDir.getAbsolutePath()); } - + public Collection getParsedParts() + { + if (_parts == null) + return Collections.emptyList(); + + Collection values = _parts.values(); + List parts = new ArrayList(); + for (Object o: values) + { + List asList = LazyList.getList(o, false); + parts.addAll(asList); + } + return parts; + } + public Collection getParts() throws IOException, ServletException @@ -593,7 +615,18 @@ public class MultiPartInputStream throw new IOException("Incomplete parts"); } - + public void setDeleteOnExit(boolean deleteOnExit) + { + _deleteOnExit = deleteOnExit; + } + + + public boolean isDeleteOnExit() + { + return _deleteOnExit; + } + + /* ------------------------------------------------------------ */ private String value(String nameEqualsValue, boolean splitAfterSpace) { diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/MultiPartInputStreamTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/MultiPartInputStreamTest.java index ec8a95b02d4..0407ccae964 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/MultiPartInputStreamTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/MultiPartInputStreamTest.java @@ -50,8 +50,42 @@ public class MultiPartInputStreamTest extends TestCase protected String _contentType = "multipart/form-data, boundary=AaB03x"; protected String _multi = createMultipartRequestString(FILENAME); protected String _dirname = System.getProperty("java.io.tmpdir")+File.separator+"myfiles-"+System.currentTimeMillis(); + protected File _tmpDir = new File(_dirname); + public MultiPartInputStreamTest () + { + _tmpDir.deleteOnExit(); + } + public void testBadMultiPartRequest() + throws Exception + { + String boundary = "X0Y0"; + String str = "--" + boundary + "\r\n"+ + "Content-Disposition: form-data; name=\"fileup\"; filename=\"test.upload\"\r\n"+ + "Content-Type: application/octet-stream\r\n\r\n"+ + "How now brown cow."+ + "\r\n--" + boundary + "-\r\n\r\n"; + + MultipartConfigElement config = new MultipartConfigElement(_dirname, 1024, 3072, 50); + MultiPartInputStream mpis = new MultiPartInputStream(new ByteArrayInputStream(str.getBytes()), + "multipart/form-data, boundary="+boundary, + config, + _tmpDir); + mpis.setDeleteOnExit(true); + try + { + mpis.getParts(); + fail ("Multipart incomplete"); + } + catch (IOException e) + { + assertTrue(e.getMessage().startsWith("Incomplete")); + } + } + + + public void testNonMultiPartRequest() throws Exception { @@ -59,7 +93,8 @@ public class MultiPartInputStreamTest extends TestCase MultiPartInputStream mpis = new MultiPartInputStream(new ByteArrayInputStream(_multi.getBytes()), "Content-type: text/plain", config, - new File(_dirname)); + _tmpDir); + mpis.setDeleteOnExit(true); assertTrue(mpis.getParts().isEmpty()); } @@ -70,7 +105,8 @@ public class MultiPartInputStreamTest extends TestCase MultiPartInputStream mpis = new MultiPartInputStream(new ByteArrayInputStream(_multi.getBytes()), _contentType, config, - new File(_dirname)); + _tmpDir); + mpis.setDeleteOnExit(true); Collection parts = mpis.getParts(); assertFalse(parts.isEmpty()); } @@ -82,11 +118,12 @@ public class MultiPartInputStreamTest extends TestCase MultiPartInputStream mpis = new MultiPartInputStream(new ByteArrayInputStream(_multi.getBytes()), _contentType, config, - new File(_dirname)); - + _tmpDir); + mpis.setDeleteOnExit(true); + Collection parts = null; try { - mpis.getParts(); + parts = mpis.getParts(); fail("Request should have exceeded maxRequestSize"); } catch (IllegalStateException e) @@ -102,11 +139,12 @@ public class MultiPartInputStreamTest extends TestCase MultiPartInputStream mpis = new MultiPartInputStream(new ByteArrayInputStream(_multi.getBytes()), _contentType, config, - new File(_dirname)); - + _tmpDir); + mpis.setDeleteOnExit(true); + Collection parts = null; try { - mpis.getParts(); + parts = mpis.getParts(); fail("stuff.txt should have been larger than maxFileSize"); } catch (IllegalStateException e) @@ -133,8 +171,8 @@ public class MultiPartInputStreamTest extends TestCase MultiPartInputStream mpis = new MultiPartInputStream(new ByteArrayInputStream(createMultipartRequestString(filename).getBytes()), _contentType, config, - new File(_dirname)); - + _tmpDir); + mpis.setDeleteOnExit(true); Collection parts = mpis.getParts(); assertThat(parts.size(), is(2)); Part field1 = mpis.getPart("field1"); @@ -188,15 +226,15 @@ public class MultiPartInputStreamTest extends TestCase "content-disposition: form-data; name=\"stuff\"; filename=\"stuff2.txt\"\r\n"+ "Content-Type: text/plain\r\n"+ "\r\n"+ - "000000000000000000000000000000000000000000000000000\r\n"+ + "110000000000000000000000000000000000000000000000000\r\n"+ "--AaB03x--\r\n"; MultipartConfigElement config = new MultipartConfigElement(_dirname, 1024, 3072, 50); MultiPartInputStream mpis = new MultiPartInputStream(new ByteArrayInputStream(sameNames.getBytes()), _contentType, config, - new File(_dirname)); - + _tmpDir); + mpis.setDeleteOnExit(true); Collection parts = mpis.getParts(); assertEquals(2, parts.size()); for (Part p:parts) @@ -210,6 +248,18 @@ public class MultiPartInputStreamTest extends TestCase private String createMultipartRequestString(String filename) { + int length = filename.length(); + String name = filename; + if (length > 10) + name = filename.substring(0,10); + StringBuffer filler = new StringBuffer(); + int i = name.length(); + while (i < 51) + { + filler.append("0"); + i++; + } + return "--AaB03x\r\n"+ "content-disposition: form-data; name=\"field1\"\r\n"+ "\r\n"+ @@ -217,8 +267,8 @@ public class MultiPartInputStreamTest extends TestCase "--AaB03x\r\n"+ "content-disposition: form-data; name=\"stuff\"; filename=\"" + filename + "\"\r\n"+ "Content-Type: text/plain\r\n"+ - "\r\n"+ - "000000000000000000000000000000000000000000000000000\r\n"+ + "\r\n"+name+ + filler.toString()+"\r\n" + "--AaB03x--\r\n"; } } From 36a2ed10beb3fb2aaaae28155566f7f0b9fdea70 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 4 Oct 2012 18:31:09 +1000 Subject: [PATCH 24/56] 391080 Multipart temp files can be left on disk from Request.getPart and getParts --- .../org/eclipse/jetty/server/Request.java | 37 +++++++++++++++++++ .../eclipse/jetty/servlet/ServletHolder.java | 21 +++++++++++ .../jetty/servlets/MultiPartFilter.java | 25 +++++++------ .../jetty/util/MultiPartInputStream.java | 22 ++++++++++- 4 files changed, 92 insertions(+), 13 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index db32fdc258a..ef57580220f 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -50,6 +50,8 @@ import javax.servlet.ServletInputStream; import javax.servlet.ServletRequest; import javax.servlet.ServletRequestAttributeEvent; import javax.servlet.ServletRequestAttributeListener; +import javax.servlet.ServletRequestEvent; +import javax.servlet.ServletRequestListener; import javax.servlet.ServletResponse; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; @@ -80,6 +82,7 @@ import org.eclipse.jetty.server.handler.ContextHandler.Context; import org.eclipse.jetty.util.Attributes; import org.eclipse.jetty.util.AttributesMap; import org.eclipse.jetty.util.LazyList; +import org.eclipse.jetty.util.MultiException; import org.eclipse.jetty.util.MultiMap; import org.eclipse.jetty.util.MultiPartInputStream; import org.eclipse.jetty.util.StringUtil; @@ -123,12 +126,44 @@ import org.eclipse.jetty.util.log.Logger; public class Request implements HttpServletRequest { public static final String __MULTIPART_CONFIG_ELEMENT = "org.eclipse.multipartConfig"; + public static final String __MULTIPART_INPUT_STREAM = "org.eclipse.multiPartInputStream"; + private static final Logger LOG = Log.getLogger(Request.class); private static final String __ASYNC_FWD = "org.eclipse.asyncfwd"; private static final Collection __defaultLocale = Collections.singleton(Locale.getDefault()); private static final int __NONE = 0, _STREAM = 1, __READER = 2; + public static class MultiPartCleanerListener implements ServletRequestListener + { + + @Override + public void requestDestroyed(ServletRequestEvent sre) + { + //Clean up any tmp files created by MultiPartInputStream + MultiPartInputStream mpis = (MultiPartInputStream)sre.getServletRequest().getAttribute(__MULTIPART_INPUT_STREAM); + if (mpis != null) + { + try + { + mpis.deleteParts(); + } + catch (MultiException e) + { + sre.getServletContext().log("Errors deleting multipart tmp files", e); + } + } + } + + @Override + public void requestInitialized(ServletRequestEvent sre) + { + //nothing to do, multipart config set up by ServletHolder.handle() + } + + } + + /* ------------------------------------------------------------ */ public static Request getRequest(HttpServletRequest request) { @@ -1975,6 +2010,7 @@ public class Request implements HttpServletRequest _multiPartInputStream = new MultiPartInputStream(getInputStream(), getContentType(),(MultipartConfigElement)getAttribute(__MULTIPART_CONFIG_ELEMENT), (_context != null?(File)_context.getAttribute("javax.servlet.context.tempdir"):null)); + setAttribute(__MULTIPART_INPUT_STREAM, _multiPartInputStream); Collection parts = _multiPartInputStream.getParts(); //causes parsing for (Part p:parts) { @@ -2006,6 +2042,7 @@ public class Request implements HttpServletRequest _multiPartInputStream = new MultiPartInputStream(getInputStream(), getContentType(),(MultipartConfigElement)getAttribute(__MULTIPART_CONFIG_ELEMENT), (_context != null?(File)_context.getAttribute("javax.servlet.context.tempdir"):null)); + setAttribute(__MULTIPART_INPUT_STREAM, _multiPartInputStream); Collection parts = _multiPartInputStream.getParts(); //causes parsing for (Part p:parts) { 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 5e4357bf290..d3499f62c13 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 @@ -514,6 +514,8 @@ public class ServletHolder extends Holder implements UserIdentity.Scope initJspServlet(); } + initMultiPart(); + _servlet.init(_config); } catch (UnavailableException e) @@ -570,6 +572,25 @@ public class ServletHolder extends Holder implements UserIdentity.Scope } } + /* ------------------------------------------------------------ */ + /** + * Register a ServletRequestListener that will ensure tmp multipart + * files are deleted when the request goes out of scope. + * + * @throws Exception + */ + protected void initMultiPart () throws Exception + { + //if this servlet can handle multipart requests, ensure tmp files will be + //cleaned up correctly + if (((Registration)getRegistration()).getMultipartConfig() != null) + { + //Register a listener to delete tmp files that are created as a result of this + //servlet calling Request.getPart() or Request.getParts() + ContextHandler ch = ((ContextHandler.Context)getServletHandler().getServletContext()).getContextHandler(); + ch.addEventListener(new Request.MultiPartCleanerListener()); + } + } /* ------------------------------------------------------------ */ /** diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/MultiPartFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/MultiPartFilter.java index 15c1faaa17b..db1d1a47825 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/MultiPartFilter.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/MultiPartFilter.java @@ -84,7 +84,7 @@ import org.eclipse.jetty.util.TypeUtil; public class MultiPartFilter implements Filter { public final static String CONTENT_TYPE_SUFFIX=".org.eclipse.jetty.servlet.contentType"; - private final static String MULTIPART = "org.eclipse.jetty.servlet.MultiPartInputStream"; + private final static String MULTIPART = "org.eclipse.jetty.servlet.MultiPartFile.multiPartInputStream"; private File tempdir; private boolean _deleteFiles; private ServletContext _context; @@ -191,23 +191,24 @@ public class MultiPartFilter implements Filter deleteFiles(request); } } - + + + /* ------------------------------------------------------------ */ private void deleteFiles(ServletRequest request) { + if (!_deleteFiles) + return; + MultiPartInputStream mpis = (MultiPartInputStream)request.getAttribute(MULTIPART); if (mpis != null) { - Collection parts = mpis.getParsedParts(); - for (Part p:parts) + try { - try - { - p.delete(); - } - catch(Exception e) - { - _context.log("Failed to delete "+p.getName(),e); - } + mpis.deleteParts(); + } + catch (Exception e) + { + _context.log("Error deleting multipart tmp files", e); } } request.removeAttribute(MULTIPART); diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java b/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java index 48069f38115..a201a2d10bd 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java @@ -236,7 +236,7 @@ public class MultiPartInputStream */ public long getSize() { - return _size; + return _size; } /** @@ -322,6 +322,7 @@ public class MultiPartInputStream _contextTmpDir = contextTmpDir; if (_contextTmpDir == null) _contextTmpDir = new File (System.getProperty("java.io.tmpdir")); + if (_config == null) _config = new MultipartConfigElement(_contextTmpDir.getAbsolutePath()); } @@ -340,6 +341,25 @@ public class MultiPartInputStream } return parts; } + + public void deleteParts () + throws MultiException + { + Collection parts = getParsedParts(); + MultiException err = new MultiException(); + for (Part p:parts) + { + try + { + p.delete(); + } + catch(Exception e) + { + err.add(e); + } + } + err.ifExceptionThrowMulti(); + } public Collection getParts() From 31807b7892ea4a37e4dcdb2e101b7c6a89a0a2e8 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 8 Oct 2012 11:09:41 +1100 Subject: [PATCH 25/56] 391188 Files written with Request.getPart().write(filename) should not be auto-deleted --- .../org/eclipse/jetty/server/Request.java | 59 ++++----- .../org/eclipse/jetty/server/RequestTest.java | 116 +++++++++++++++++- .../jetty/util/MultiPartInputStream.java | 64 ++++++++-- .../jetty/util/MultiPartInputStreamTest.java | 74 +++++++++-- 4 files changed, 260 insertions(+), 53 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index ef57580220f..d0ca3771e06 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -127,7 +127,7 @@ public class Request implements HttpServletRequest { public static final String __MULTIPART_CONFIG_ELEMENT = "org.eclipse.multipartConfig"; public static final String __MULTIPART_INPUT_STREAM = "org.eclipse.multiPartInputStream"; - + public static final String __MULTIPART_CONTEXT = "org.eclipse.multiPartContext"; private static final Logger LOG = Log.getLogger(Request.class); private static final String __ASYNC_FWD = "org.eclipse.asyncfwd"; @@ -144,14 +144,20 @@ public class Request implements HttpServletRequest MultiPartInputStream mpis = (MultiPartInputStream)sre.getServletRequest().getAttribute(__MULTIPART_INPUT_STREAM); if (mpis != null) { - try - { - mpis.deleteParts(); - } - catch (MultiException e) - { - sre.getServletContext().log("Errors deleting multipart tmp files", e); - } + ContextHandler.Context context = (ContextHandler.Context)sre.getServletRequest().getAttribute(__MULTIPART_CONTEXT); + + //Only do the cleanup if we are exiting from the context in which a servlet parsed the multipart files + if (context == sre.getServletContext()) + { + try + { + mpis.deleteParts(); + } + catch (MultiException e) + { + sre.getServletContext().log("Errors deleting multipart tmp files", e); + } + } } } @@ -1468,24 +1474,6 @@ public class Request implements HttpServletRequest if (_savedNewSessions != null) _savedNewSessions.clear(); _savedNewSessions=null; - if (_multiPartInputStream != null) - { - Collection parts = _multiPartInputStream.getParsedParts(); - if (parts != null) - { - for (Part p:parts) - { - try - { - p.delete(); - } - catch (IOException e) - { - LOG.warn("Error deleting multipart file", e); - } - } - } - } _multiPartInputStream = null; } @@ -2007,10 +1995,16 @@ public class Request implements HttpServletRequest if (_multiPartInputStream == null) { + MultipartConfigElement config = (MultipartConfigElement)getAttribute(__MULTIPART_CONFIG_ELEMENT); + + if (config == null) + throw new IllegalStateException("No multipart config for servlet"); + _multiPartInputStream = new MultiPartInputStream(getInputStream(), - getContentType(),(MultipartConfigElement)getAttribute(__MULTIPART_CONFIG_ELEMENT), + getContentType(),config, (_context != null?(File)_context.getAttribute("javax.servlet.context.tempdir"):null)); setAttribute(__MULTIPART_INPUT_STREAM, _multiPartInputStream); + setAttribute(__MULTIPART_CONTEXT, _context); Collection parts = _multiPartInputStream.getParts(); //causes parsing for (Part p:parts) { @@ -2039,10 +2033,17 @@ public class Request implements HttpServletRequest if (_multiPartInputStream == null) { + MultipartConfigElement config = (MultipartConfigElement)getAttribute(__MULTIPART_CONFIG_ELEMENT); + + if (config == null) + throw new IllegalStateException("No multipart config for servlet"); + _multiPartInputStream = new MultiPartInputStream(getInputStream(), - getContentType(),(MultipartConfigElement)getAttribute(__MULTIPART_CONFIG_ELEMENT), + getContentType(), config, (_context != null?(File)_context.getAttribute("javax.servlet.context.tempdir"):null)); + setAttribute(__MULTIPART_INPUT_STREAM, _multiPartInputStream); + setAttribute(__MULTIPART_CONTEXT, _context); Collection parts = _multiPartInputStream.getParts(); //causes parsing for (Part p:parts) { diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java index 355264fab66..408feefa628 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java @@ -37,7 +37,9 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.Map; +import javax.servlet.MultipartConfigElement; import javax.servlet.ServletException; +import javax.servlet.ServletRequestEvent; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -49,6 +51,7 @@ import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.util.IO; +import org.eclipse.jetty.util.MultiPartInputStream; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.Log; import org.junit.After; @@ -131,7 +134,7 @@ public class RequestTest } @Test - public void testMultiPart() throws Exception + public void testMultiPartNoConfig() throws Exception { _handler._checker = new RequestTester() { @@ -140,14 +143,16 @@ public class RequestTest try { Part foo = request.getPart("stuff"); - assertNotNull(foo); - String value = request.getParameter("stuff"); - byte[] expected = "000000000000000000000000000000000000000000000000000".getBytes("ISO-8859-1"); - return value.equals(new String(expected, "ISO-8859-1")); + return false; + } + catch (IllegalStateException e) + { + //expected exception because no multipart config is set up + assertTrue(e.getMessage().startsWith("No multipart config")); + return true; } catch (Exception e) { - e.printStackTrace(); return false; } } @@ -174,6 +179,66 @@ public class RequestTest String responses=_connector.getResponses(request); assertTrue(responses.startsWith("HTTP/1.1 200")); } + + + @Test + public void testMultiPart() throws Exception + { + final File tmpDir = new File (System.getProperty("java.io.tmpdir")); + final File testTmpDir = new File (tmpDir, "reqtest"); + testTmpDir.deleteOnExit(); + assertTrue(testTmpDir.mkdirs()); + assertTrue(testTmpDir.list().length == 0); + + ContextHandler contextHandler = new ContextHandler(); + contextHandler.setContextPath("/foo"); + contextHandler.setResourceBase("."); + contextHandler.setHandler(new MultiPartRequestHandler(testTmpDir)); + contextHandler.addEventListener(new Request.MultiPartCleanerListener() + { + + @Override + public void requestDestroyed(ServletRequestEvent sre) + { + MultiPartInputStream m = (MultiPartInputStream)sre.getServletRequest().getAttribute(Request.__MULTIPART_INPUT_STREAM); + ContextHandler.Context c = (ContextHandler.Context)sre.getServletRequest().getAttribute(Request.__MULTIPART_CONTEXT); + assertNotNull (m); + assertNotNull (c); + assertTrue(c == sre.getServletContext()); + assertTrue(!m.getParsedParts().isEmpty()); + assertTrue(testTmpDir.list().length == 2); + super.requestDestroyed(sre); + String[] files = testTmpDir.list(); + assertTrue(files.length == 0); + } + + }); + _server.stop(); + _server.setHandler(contextHandler); + _server.start(); + + String multipart = "--AaB03x\r\n"+ + "content-disposition: form-data; name=\"field1\"\r\n"+ + "\r\n"+ + "Joe Blow\r\n"+ + "--AaB03x\r\n"+ + "content-disposition: form-data; name=\"stuff\"; filename=\"foo.upload\"\r\n"+ + "Content-Type: text/plain;charset=ISO-8859-1\r\n"+ + "\r\n"+ + "000000000000000000000000000000000000000000000000000\r\n"+ + "--AaB03x--\r\n"; + + String request="GET /foo/x.html HTTP/1.1\r\n"+ + "Host: whatever\r\n"+ + "Content-Type: multipart/form-data; boundary=\"AaB03x\"\r\n"+ + "Content-Length: "+multipart.getBytes().length+"\r\n"+ + "\r\n"+ + multipart; + + String responses=_connector.getResponses(request); + System.err.println(responses); + assertTrue(responses.startsWith("HTTP/1.1 200")); + } @Test public void testBadUtf8ParamExtraction() throws Exception @@ -912,4 +977,43 @@ public class RequestTest } } + + private class MultiPartRequestHandler extends AbstractHandler + { + File tmpDir; + + public MultiPartRequestHandler(File tmpDir) + { + this.tmpDir = tmpDir; + } + + + @Override + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + { + ((Request)request).setHandled(true); + try + { + + MultipartConfigElement mpce = new MultipartConfigElement(tmpDir.getAbsolutePath(),-1, -1, 2); + request.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, mpce); + + Part foo = request.getPart("stuff"); + assertNotNull(foo); + assertTrue(foo.getSize() > 0); + + response.setStatus(200); + } + catch (IllegalStateException e) + { + //expected exception because no multipart config is set up + assertTrue(e.getMessage().startsWith("No multipart config")); + response.setStatus(200); + } + catch (Exception e) + { + response.sendError(500); + } + } + } } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java b/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java index a201a2d10bd..4077ed28528 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java @@ -74,6 +74,7 @@ public class MultiPartInputStream protected String _contentType; protected MultiMap _headers; protected long _size = 0; + protected boolean _temporary = true; public MultiPart (String name, String filename) throws IOException @@ -144,7 +145,6 @@ public class MultiPartInputStream _file = File.createTempFile("MultiPart", "", MultiPartInputStream.this._tmpDir); if (_deleteOnExit) _file.deleteOnExit(); - FileOutputStream fos = new FileOutputStream(_file); BufferedOutputStream bos = new BufferedOutputStream(fos); @@ -207,11 +207,12 @@ public class MultiPartInputStream { if (_file != null) { + //written to a file, whether temporary or not return new BufferedInputStream (new FileInputStream(_file)); } else { - //part content is in a ByteArrayOutputStream + //part content is in memory return new ByteArrayInputStream(_bout.getBuf(),0,_bout.size()); } } @@ -246,10 +247,11 @@ public class MultiPartInputStream { if (_file == null) { + _temporary = false; + //part data is only in the ByteArrayOutputStream and never been written to disk _file = new File (_tmpDir, fileName); - if (_deleteOnExit) - _file.deleteOnExit(); + BufferedOutputStream bos = null; try { @@ -267,23 +269,36 @@ public class MultiPartInputStream else { //the part data is already written to a temporary file, just rename it + _temporary = false; + File f = new File(_tmpDir, fileName); - if (_deleteOnExit) - f.deleteOnExit(); if (_file.renameTo(f)) _file = f; } } /** + * Remove the file, whether or not Part.write() was called on it + * (ie no longer temporary) * @see javax.servlet.http.Part#delete() */ public void delete() throws IOException { - if (_file != null) + if (_file != null && _file.exists()) _file.delete(); } + /** + * Only remove tmp files. + * + * @throws IOException + */ + public void cleanUp() throws IOException + { + if (_temporary && _file != null && _file.exists()) + _file.delete(); + } + /** * Get the file, if any, the data has been written to. @@ -327,6 +342,11 @@ public class MultiPartInputStream _config = new MultipartConfigElement(_contextTmpDir.getAbsolutePath()); } + /** + * Get the already parsed parts. + * + * @return + */ public Collection getParsedParts() { if (_parts == null) @@ -342,6 +362,11 @@ public class MultiPartInputStream return parts; } + /** + * Delete any tmp storage for parts, and clear out the parts list. + * + * @throws MultiException + */ public void deleteParts () throws MultiException { @@ -351,17 +376,26 @@ public class MultiPartInputStream { try { - p.delete(); + ((MultiPartInputStream.MultiPart)p).cleanUp(); } catch(Exception e) { err.add(e); } } + _parts.clear(); + err.ifExceptionThrowMulti(); } + /** + * Parse, if necessary, the multipart data and return the list of Parts. + * + * @return + * @throws IOException + * @throws ServletException + */ public Collection getParts() throws IOException, ServletException { @@ -377,6 +411,14 @@ public class MultiPartInputStream } + /** + * Get the named Part. + * + * @param name + * @return + * @throws IOException + * @throws ServletException + */ public Part getPart(String name) throws IOException, ServletException { @@ -385,6 +427,12 @@ public class MultiPartInputStream } + /** + * Parse, if necessary, the multipart stream. + * + * @throws IOException + * @throws ServletException + */ protected void parse () throws IOException, ServletException { diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/MultiPartInputStreamTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/MultiPartInputStreamTest.java index 0407ccae964..fffda46b325 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/MultiPartInputStreamTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/MultiPartInputStreamTest.java @@ -27,6 +27,7 @@ import static org.junit.Assert.assertThat; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Collection; @@ -153,6 +154,48 @@ public class MultiPartInputStreamTest extends TestCase } } + public void testPartFileNotDeleted () throws Exception + { + MultipartConfigElement config = new MultipartConfigElement(_dirname, 1024, 3072, 50); + MultiPartInputStream mpis = new MultiPartInputStream(new ByteArrayInputStream(createMultipartRequestString("tptfd").getBytes()), + _contentType, + config, + _tmpDir); + mpis.setDeleteOnExit(true); + Collection parts = mpis.getParts(); + + MultiPart part = (MultiPart)mpis.getPart("stuff"); + File stuff = ((MultiPartInputStream.MultiPart)part).getFile(); + assertThat(stuff,notNullValue()); // longer than 100 bytes, should already be a tmp file + part.write("tptfd.txt"); + File tptfd = new File (_dirname+File.separator+"tptfd.txt"); + assertThat(tptfd.exists(), is(true)); + assertThat(stuff.exists(), is(false)); //got renamed + part.cleanUp(); + assertThat(tptfd.exists(), is(true)); //explicitly written file did not get removed after cleanup + tptfd.deleteOnExit(); //clean up test + } + + + public void testPartTmpFileDeletion () throws Exception + { + MultipartConfigElement config = new MultipartConfigElement(_dirname, 1024, 3072, 50); + MultiPartInputStream mpis = new MultiPartInputStream(new ByteArrayInputStream(createMultipartRequestString("tptfd").getBytes()), + _contentType, + config, + _tmpDir); + mpis.setDeleteOnExit(true); + Collection parts = mpis.getParts(); + + MultiPart part = (MultiPart)mpis.getPart("stuff"); + File stuff = ((MultiPartInputStream.MultiPart)part).getFile(); + assertThat(stuff,notNullValue()); // longer than 100 bytes, should already be a tmp file + assertThat (stuff.exists(), is(true)); + part.cleanUp(); + assertThat(stuff.exists(), is(false)); //tmp file was removed after cleanup + } + + public void testMulti () throws Exception @@ -175,7 +218,7 @@ public class MultiPartInputStreamTest extends TestCase mpis.setDeleteOnExit(true); Collection parts = mpis.getParts(); assertThat(parts.size(), is(2)); - Part field1 = mpis.getPart("field1"); + Part field1 = mpis.getPart("field1"); //field 1 too small to go into tmp file, should be in internal buffer assertThat(field1,notNullValue()); assertThat(field1.getName(),is("field1")); InputStream is = field1.getInputStream(); @@ -184,17 +227,18 @@ public class MultiPartInputStreamTest extends TestCase assertEquals("Joe Blow", new String(os.toByteArray())); assertEquals(8, field1.getSize()); - assertNotNull(((MultiPartInputStream.MultiPart)field1).getBytes()); //in internal buffer + assertNotNull(((MultiPartInputStream.MultiPart)field1).getBytes());//in internal buffer field1.write("field1.txt"); - assertNull(((MultiPartInputStream.MultiPart)field1).getBytes()); //no longer in internal buffer + assertNull(((MultiPartInputStream.MultiPart)field1).getBytes());//no longer in internal buffer File f = new File (_dirname+File.separator+"field1.txt"); assertTrue(f.exists()); - field1.write("another_field1.txt"); + field1.write("another_field1.txt"); //write after having already written File f2 = new File(_dirname+File.separator+"another_field1.txt"); assertTrue(f2.exists()); assertFalse(f.exists()); //should have been renamed field1.delete(); //file should be deleted - assertFalse(f2.exists()); + assertFalse(f.exists()); //original file was renamed + assertFalse(f2.exists()); //2nd written file was explicitly deleted MultiPart stuff = (MultiPart)mpis.getPart("stuff"); assertThat(stuff.getContentDispositionFilename(), is(filename)); @@ -204,14 +248,24 @@ public class MultiPartInputStreamTest extends TestCase assertThat(stuff.getHeader("content-disposition"),is("form-data; name=\"stuff\"; filename=\"" + filename + "\"")); assertThat(stuff.getHeaderNames().size(),is(2)); assertThat(stuff.getSize(),is(51L)); - f = ((MultiPartInputStream.MultiPart)stuff).getFile(); - assertThat(f,notNullValue()); // longer than 100 bytes, should already be a file - assertThat(((MultiPartInputStream.MultiPart)stuff).getBytes(),nullValue()); //not in internal buffer any more - assertThat(f.exists(),is(true)); - assertThat(f.getName(),is(not("stuff with space.txt"))); + File tmpfile = ((MultiPartInputStream.MultiPart)stuff).getFile(); + assertThat(tmpfile,notNullValue()); // longer than 100 bytes, should already be a tmp file + assertThat(((MultiPartInputStream.MultiPart)stuff).getBytes(),nullValue()); //not in an internal buffer + assertThat(tmpfile.exists(),is(true)); + assertThat(tmpfile.getName(),is(not("stuff with space.txt"))); stuff.write(filename); f = new File(_dirname+File.separator+filename); assertThat(f.exists(),is(true)); + assertThat(tmpfile.exists(), is(false)); + try + { + stuff.getInputStream(); + } + catch (Exception e) + { + fail("Part.getInputStream() after file rename operation"); + } + f.deleteOnExit(); //clean up after test } public void testMultiSameNames () From f26b792782340067fca4cc977839ebf757f16015 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Tue, 9 Oct 2012 15:23:01 -0500 Subject: [PATCH 26/56] [Bug 391483] fix bad javadoc example in shutdown handler --- .../java/org/eclipse/jetty/server/handler/ShutdownHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ShutdownHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ShutdownHandler.java index 00b9bae1122..b884887189f 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ShutdownHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ShutdownHandler.java @@ -50,7 +50,7 @@ import org.eclipse.jetty.util.log.Logger;
        public static void attemptShutdown(int port, String shutdownCookie) {
             try {
    -            URL url = new URL("http://localhost:" + port + "/shutdown?cookie=" + shutdownCookie);
    +            URL url = new URL("http://localhost:" + port + "/shutdown?token=" + shutdownCookie);
                 HttpURLConnection connection = (HttpURLConnection)url.openConnection();
                 connection.setRequestMethod("POST");
                 connection.getResponseCode();
    
    From 86b51e608f5dccf34ea0263f4c4d65f171f3979a Mon Sep 17 00:00:00 2001
    From: Jan Bartel 
    Date: Thu, 11 Oct 2012 13:40:33 +1100
    Subject: [PATCH 27/56] 391623 Add option to --stop to wait for target jetty to
     stop
    
    ---
     .../java/org/eclipse/jetty/start/Main.java    | 25 ++++++++++++++++++-
     .../java/org/eclipse/jetty/start/Monitor.java | 11 +++++---
     .../org/eclipse/jetty/start/usage.txt         |  5 +++-
     3 files changed, 35 insertions(+), 6 deletions(-)
    
    diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
    index 6126fbb624b..96207821bc7 100644
    --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
    +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
    @@ -30,6 +30,7 @@ import java.io.FilenameFilter;
     import java.io.IOException;
     import java.io.InputStream;
     import java.io.InputStreamReader;
    +import java.io.LineNumberReader;
     import java.io.OutputStream;
     import java.io.PrintStream;
     import java.lang.reflect.InvocationTargetException;
    @@ -181,9 +182,17 @@ public class Main
                 {
                     int port = Integer.parseInt(Config.getProperty("STOP.PORT","-1"));
                     String key = Config.getProperty("STOP.KEY",null);
    -                stop(port,key);
    +                stop(port,key, false);
                     return null;
                 }
    +            
    +            if ("--stop-wait".equals(arg))
    +            {
    +                int port = Integer.parseInt(Config.getProperty("STOP.PORT","-1"));
    +                String key = Config.getProperty("STOP.KEY",null);
    +                stop(port,key, true);
    +                return null;  
    +            }
     
                 if ("--version".equals(arg) || "-v".equals(arg) || "--info".equals(arg))
                 {
    @@ -1002,6 +1011,12 @@ public class Main
          * Stop a running jetty instance.
          */
         public void stop(int port, String key)
    +    {
    +        stop (port,key,false);
    +    }
    +    
    +    
    +    public void stop (int port, String key, boolean wait)
         {
             int _port = port;
             String _key = key;
    @@ -1025,6 +1040,14 @@ public class Main
                     OutputStream out = s.getOutputStream();
                     out.write((_key + "\r\nstop\r\n").getBytes());
                     out.flush();
    +
    +                if (wait)
    +                {
    +                    LineNumberReader lin = new LineNumberReader(new InputStreamReader(s.getInputStream()));
    +                    String response=lin.readLine();
    +                    if ("Stopped".equals(response))
    +                        System.err.println("Stopped");
    +                }
                 }
                 finally
                 {
    diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Monitor.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Monitor.java
    index 3bc79cb8931..ff29f11df94 100644
    --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Monitor.java
    +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Monitor.java
    @@ -17,6 +17,7 @@
     //
     
     package org.eclipse.jetty.start;
    +import java.io.IOException;
     import java.io.InputStreamReader;
     import java.io.LineNumberReader;
     import java.net.InetAddress;
    @@ -113,21 +114,23 @@ public class Monitor extends Thread
                     Config.debug("command=" + cmd);
                     if ("stop".equals(cmd))
                     {
    -                    try {socket.close();}catch(Exception e){e.printStackTrace();}
    -                    try {_socket.close();}catch(Exception e){e.printStackTrace();}
                         if (_process!=null)
                         {
                             //if we have a child process, wait for it to finish before we stop
                             try
                             {
    -                        _process.destroy();
    -                        _process.waitFor();
    +                            _process.destroy();
    +                            _process.waitFor();
    +
                             }
                             catch (InterruptedException e)
                             {
                                 System.err.println("Interrupted waiting for child to terminate");
                             }
                         }
    +                    socket.getOutputStream().write("Stopped\r\n".getBytes());
    +                    try {socket.close();}catch(Exception e){e.printStackTrace();}
    +                    try {_socket.close();}catch(Exception e){e.printStackTrace();}
                         System.exit(0);
                     }
                     else if ("status".equals(cmd))
    diff --git a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt
    index 41b0107580e..db8e8d22c87 100644
    --- a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt
    +++ b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt
    @@ -24,7 +24,10 @@ Command Line Options:
                        contains -X or -D arguments, but creates an extra
                        JVM instance.
                          
    -  --stop           Stop the running Jetty instance.
    +  --stop           Send a stop signal to the running Jetty instance.
    +  
    +  --stop-wait      Send a stop signal to the running Jetty instance, waiting for
    +                   confirmation that it is stopping.
       
       --daemon         Start in daemon mode with stderr and stdout 
                        redirected to ${jetty.log}/start.log
    
    From 5277122dd832f5a2833e530e33a51a58bccbfed4 Mon Sep 17 00:00:00 2001
    From: Jan Bartel 
    Date: Thu, 11 Oct 2012 16:09:35 +1100
    Subject: [PATCH 28/56] 391622 Be lenient on RFC6265 restriction on duplicate
     cookie names in same response
    
    ---
     .../org/eclipse/jetty/http/HttpFields.java    | 25 +++++---
     .../eclipse/jetty/http/HttpFieldsTest.java    | 58 ++++++++++++++++++-
     2 files changed, 75 insertions(+), 8 deletions(-)
    
    diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java
    index f14e1f2189f..89a004f7107 100644
    --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java
    +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java
    @@ -934,6 +934,9 @@ public class HttpFields
             QuotedStringTokenizer.quoteIfNeeded(buf, name, delim);
             buf.append('=');
             String start=buf.toString();
    +        boolean hasDomain = false;
    +        boolean hasPath = false;
    +        
             if (value != null && value.length() > 0)
                 QuotedStringTokenizer.quoteIfNeeded(buf, value, delim);        
     
    @@ -945,6 +948,7 @@ public class HttpFields
     
             if (path != null && path.length() > 0)
             {
    +            hasPath = true;
                 buf.append(";Path=");
                 if (path.trim().startsWith("\""))
                     buf.append(path);
    @@ -953,6 +957,7 @@ public class HttpFields
             }
             if (domain != null && domain.length() > 0)
             {
    +            hasDomain = true;
                 buf.append(";Domain=");
                 QuotedStringTokenizer.quoteIfNeeded(buf,domain.toLowerCase(),delim);
             }
    @@ -985,14 +990,20 @@ public class HttpFields
             Field last=null;
             while (field!=null)
             {
    -            if (field._value!=null && field._value.toString().startsWith(start))
    +            String val = (field._value == null ? null : field._value.toString());
    +            if (val!=null && val.startsWith(start))
                 {
    -                _fields.remove(field);
    -                if (last==null)
    -                    _names.put(HttpHeaders.SET_COOKIE_BUFFER,field._next);
    -                else
    -                    last._next=field._next;
    -                break;
    +                //existing cookie has same name, does it also match domain and path?
    +                if (((!hasDomain && !val.contains("Domain")) || (hasDomain && val.contains("Domain="+domain))) &&
    +                    ((!hasPath && !val.contains("Path")) || (hasPath && val.contains("Path="+path))))
    +                {
    +                    _fields.remove(field);
    +                    if (last==null)
    +                        _names.put(HttpHeaders.SET_COOKIE_BUFFER,field._next);
    +                    else
    +                        last._next=field._next;
    +                    break;
    +                }
                 }
                 last=field;
                 field=field._next;
    diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java
    index 770ffb42de4..3e26687ec4a 100644
    --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java
    +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java
    @@ -364,7 +364,8 @@ public class HttpFieldsTest
             assertEquals("minimal=value",fields.getStringField("Set-Cookie"));
     
             fields.clear();
    -        fields.addSetCookie("everything","wrong","wrong","wrong",0,"to be replaced",true,true,0);
    +        //test cookies with same name, domain and path, only 1 allowed
    +        fields.addSetCookie("everything","wrong","domain","path",0,"to be replaced",true,true,0);
             fields.addSetCookie("everything","value","domain","path",0,"comment",true,true,0);
             assertEquals("everything=value;Comment=comment;Path=path;Domain=domain;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Secure;HttpOnly",fields.getStringField("Set-Cookie"));
             Enumeration e =fields.getValues("Set-Cookie");
    @@ -372,6 +373,61 @@ public class HttpFieldsTest
             assertEquals("everything=value;Comment=comment;Path=path;Domain=domain;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Secure;HttpOnly",e.nextElement());
             assertFalse(e.hasMoreElements());
             assertEquals("Thu, 01 Jan 1970 00:00:00 GMT",fields.getStringField("Expires")); 
    +        assertFalse(e.hasMoreElements());
    +        
    +        //test cookies with same name, different domain
    +        fields.clear();
    +        fields.addSetCookie("everything","other","domain1","path",0,"blah",true,true,0);
    +        fields.addSetCookie("everything","value","domain2","path",0,"comment",true,true,0);
    +        e =fields.getValues("Set-Cookie");
    +        assertTrue(e.hasMoreElements());
    +        assertEquals("everything=other;Comment=blah;Path=path;Domain=domain1;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Secure;HttpOnly",e.nextElement());
    +        assertTrue(e.hasMoreElements());
    +        assertEquals("everything=value;Comment=comment;Path=path;Domain=domain2;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Secure;HttpOnly",e.nextElement());
    +        assertFalse(e.hasMoreElements());
    +        
    +        //test cookies with same name, same path, one with domain, one without
    +        fields.clear();
    +        fields.addSetCookie("everything","other","domain1","path",0,"blah",true,true,0);
    +        fields.addSetCookie("everything","value","","path",0,"comment",true,true,0);
    +        e =fields.getValues("Set-Cookie");
    +        assertTrue(e.hasMoreElements());
    +        assertEquals("everything=other;Comment=blah;Path=path;Domain=domain1;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Secure;HttpOnly",e.nextElement());
    +        assertTrue(e.hasMoreElements());
    +        assertEquals("everything=value;Comment=comment;Path=path;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Secure;HttpOnly",e.nextElement());
    +        assertFalse(e.hasMoreElements());
    +        
    +        
    +        //test cookies with same name, different path
    +        fields.clear();
    +        fields.addSetCookie("everything","other","domain1","path1",0,"blah",true,true,0);
    +        fields.addSetCookie("everything","value","domain1","path2",0,"comment",true,true,0);
    +        e =fields.getValues("Set-Cookie");
    +        assertTrue(e.hasMoreElements());
    +        assertEquals("everything=other;Comment=blah;Path=path1;Domain=domain1;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Secure;HttpOnly",e.nextElement());
    +        assertTrue(e.hasMoreElements());
    +        assertEquals("everything=value;Comment=comment;Path=path2;Domain=domain1;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Secure;HttpOnly",e.nextElement());
    +        assertFalse(e.hasMoreElements());
    +        
    +        //test cookies with same name, same domain, one with path, one without
    +        fields.clear();
    +        fields.addSetCookie("everything","other","domain1","path1",0,"blah",true,true,0);
    +        fields.addSetCookie("everything","value","domain1","",0,"comment",true,true,0);
    +        e =fields.getValues("Set-Cookie");
    +        assertTrue(e.hasMoreElements());
    +        assertEquals("everything=other;Comment=blah;Path=path1;Domain=domain1;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Secure;HttpOnly",e.nextElement());
    +        assertTrue(e.hasMoreElements());
    +        assertEquals("everything=value;Comment=comment;Domain=domain1;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Secure;HttpOnly",e.nextElement());
    +        assertFalse(e.hasMoreElements());
    +        
    +        //test cookies same name only, no path, no domain
    +        fields.clear();
    +        fields.addSetCookie("everything","other","","",0,"blah",true,true,0);
    +        fields.addSetCookie("everything","value","","",0,"comment",true,true,0);
    +        e =fields.getValues("Set-Cookie");
    +        assertTrue(e.hasMoreElements());
    +        assertEquals("everything=value;Comment=comment;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Secure;HttpOnly",e.nextElement());
    +        assertFalse(e.hasMoreElements());
             
             fields.clear();
             fields.addSetCookie("ev erything","va lue","do main","pa th",1,"co mment",true,true,2);
    
    From 785e06d347e6b3714b3b44f8a7990b1f174cd714 Mon Sep 17 00:00:00 2001
    From: Jan Bartel 
    Date: Fri, 12 Oct 2012 19:00:28 +1100
    Subject: [PATCH 29/56] 390108 Servlet 3.0 API for programmatic login doesn't
     appear to work
    
    ---
     .../security/jaspi/JaspiAuthenticator.java    | 36 ++++++++
     .../jaspi/modules/FormAuthModule.java         | 81 ++++-------------
     .../authentication/BasicAuthenticator.java    |  5 +-
     .../ClientCertAuthenticator.java              |  5 +-
     .../DeferredAuthentication.java               | 24 +++--
     .../authentication/DigestAuthenticator.java   |  6 +-
     .../authentication/FormAuthenticator.java     | 26 ++++--
     .../authentication/LoginAuthenticator.java    | 17 ++++
     .../authentication/SessionAuthentication.java |  4 +-
     .../authentication/SpnegoAuthenticator.java   |  4 +-
     .../eclipse/jetty/server/Authentication.java  |  2 +-
     .../org/eclipse/jetty/server/Request.java     |  5 +-
     .../src/main/java/com/acme/LoginServlet.java  | 87 +++++++++++++++++++
     .../src/main/webapp/WEB-INF/web.xml           | 11 +++
     test-jetty-webapp/src/main/webapp/auth.html   |  4 +
     15 files changed, 221 insertions(+), 96 deletions(-)
     create mode 100644 test-jetty-webapp/src/main/java/com/acme/LoginServlet.java
    
    diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java
    index c93bafa7705..e28d4a17ccc 100644
    --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java
    +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java
    @@ -31,6 +31,8 @@ import javax.security.auth.message.config.ServerAuthConfig;
     import javax.security.auth.message.config.ServerAuthContext;
     import javax.servlet.ServletRequest;
     import javax.servlet.ServletResponse;
    +import javax.servlet.http.HttpServletRequest;
    +import javax.servlet.http.HttpSession;
     
     import org.eclipse.jetty.security.Authenticator;
     import org.eclipse.jetty.security.IdentityService;
    @@ -38,15 +40,21 @@ import org.eclipse.jetty.security.ServerAuthException;
     import org.eclipse.jetty.security.UserAuthentication;
     import org.eclipse.jetty.security.authentication.DeferredAuthentication;
     import org.eclipse.jetty.security.authentication.LoginAuthenticator;
    +import org.eclipse.jetty.security.authentication.SessionAuthentication;
    +import org.eclipse.jetty.security.jaspi.modules.BaseAuthModule;
     import org.eclipse.jetty.server.Authentication;
     import org.eclipse.jetty.server.UserIdentity;
     import org.eclipse.jetty.server.Authentication.User;
    +import org.eclipse.jetty.util.log.Log;
    +import org.eclipse.jetty.util.log.Logger;
     
     /**
      * @version $Rev: 4793 $ $Date: 2009-03-19 00:00:01 +0100 (Thu, 19 Mar 2009) $
      */
     public class JaspiAuthenticator extends LoginAuthenticator
     {
    +    private static final Logger LOG = Log.getLogger(JaspiAuthenticator.class.getName());
    +    
         private final ServerAuthConfig _authConfig;
     
         private final Map _authProperties;
    @@ -107,6 +115,28 @@ public class JaspiAuthenticator extends LoginAuthenticator
         }
     
     
    +    /** 
    +     * @see org.eclipse.jetty.security.authentication.LoginAuthenticator#login(java.lang.String, java.lang.Object, javax.servlet.ServletRequest)
    +     */
    +    @Override
    +    public UserIdentity login(String username, Object password, ServletRequest request)
    +    { 
    +        UserIdentity user = _loginService.login(username, password);
    +        if (user != null)
    +        {
    +            renewSession((HttpServletRequest)request, null);
    +            HttpSession session = ((HttpServletRequest)request).getSession(true);
    +            if (session != null)
    +            {
    +                SessionAuthentication sessionAuth = new SessionAuthentication(getAuthMethod(), user, password);
    +                session.setAttribute(SessionAuthentication.__J_AUTHENTICATED, sessionAuth);
    +            }
    +        }
    +        return user;
    +    }
    +
    +    
    +
         public Authentication validateRequest(JaspiMessageInfo messageInfo) throws ServerAuthException
         {
             try
    @@ -151,6 +181,12 @@ public class JaspiAuthenticator extends LoginAuthenticator
                         String[] groups = groupPrincipalCallback == null ? null : groupPrincipalCallback.getGroups();
                         userIdentity = _identityService.newUserIdentity(clientSubject, principal, groups);
                     }
    +                
    +                HttpSession session = ((HttpServletRequest)messageInfo.getRequestMessage()).getSession(false);
    +                Authentication cached = (session == null?null:(SessionAuthentication)session.getAttribute(SessionAuthentication.__J_AUTHENTICATED));
    +                if (cached != null)
    +                    return cached;
    +                
                     return new UserAuthentication(getAuthMethod(), userIdentity);
                 }
                 if (authStatus == AuthStatus.SEND_SUCCESS)
    diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java
    index 6c6270280b2..9bea1c50634 100644
    --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java
    +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java
    @@ -43,7 +43,10 @@ import org.eclipse.jetty.util.security.Password;
     import org.eclipse.jetty.security.CrossContextPsuedoSession;
     import org.eclipse.jetty.security.authentication.DeferredAuthentication;
     import org.eclipse.jetty.security.authentication.LoginCallbackImpl;
    +import org.eclipse.jetty.security.authentication.SessionAuthentication;
    +import org.eclipse.jetty.security.jaspi.callback.CredentialValidationCallback;
     import org.eclipse.jetty.server.Authentication;
    +import org.eclipse.jetty.server.UserIdentity;
     import org.eclipse.jetty.util.StringUtil;
     import org.eclipse.jetty.util.URIUtil;
     import org.eclipse.jetty.util.log.Log;
    @@ -214,21 +217,22 @@ public class FormAuthModule extends BaseAuthModule
                 
                 
                 // Check if the session is already authenticated.
    -            FormCredential form_cred = (FormCredential) session.getAttribute(__J_AUTHENTICATED);
    -            if (form_cred != null)
    +            SessionAuthentication sessionAuth = (SessionAuthentication)session.getAttribute(SessionAuthentication.__J_AUTHENTICATED);
    +            if (sessionAuth != null)
                 {                
                     //TODO: ideally we would like the form auth module to be able to invoke the 
                     //loginservice.validate() method to check the previously authed user, but it is not visible
                     //to FormAuthModule
    -                if (form_cred._subject == null)
    +                if (sessionAuth.getUserIdentity().getSubject() == null)
                         return AuthStatus.SEND_FAILURE;
    -                Set credentials = form_cred._subject.getPrivateCredentials();
    +
    +                Set credentials = sessionAuth.getUserIdentity().getSubject().getPrivateCredentials();
                     if (credentials == null || credentials.isEmpty())
                         return AuthStatus.SEND_FAILURE; //if no private credentials, assume it cannot be authenticated
     
                     clientSubject.getPrivateCredentials().addAll(credentials);
    +                clientSubject.getPrivateCredentials().add(sessionAuth.getUserIdentity());
     
    -                //boolean success = tryLogin(messageInfo, clientSubject, response, session, form_cred._jUserName, new Password(new String(form_cred._jPassword)));
                     return AuthStatus.SUCCESS;  
                 }
                 else if (ssoSource != null)
    @@ -300,8 +304,14 @@ public class FormAuthModule extends BaseAuthModule
                 if (!loginCallbacks.isEmpty())
                 {
                     LoginCallbackImpl loginCallback = loginCallbacks.iterator().next();
    -                FormCredential form_cred = new FormCredential(username, pwdChars, loginCallback.getUserPrincipal(), loginCallback.getSubject());
    -                session.setAttribute(__J_AUTHENTICATED, form_cred);
    +                Set userIdentities = clientSubject.getPrivateCredentials(UserIdentity.class);
    +                if (!userIdentities.isEmpty())
    +                {
    +                    UserIdentity userIdentity = userIdentities.iterator().next();
    +                   
    +                SessionAuthentication sessionAuth = new SessionAuthentication(Constraint.__FORM_AUTH, userIdentity, password);
    +                session.setAttribute(SessionAuthentication.__J_AUTHENTICATED, sessionAuth);
    +                }
                 }
     
                 // Sign-on to SSO mechanism
    @@ -320,61 +330,4 @@ public class FormAuthModule extends BaseAuthModule
             return pathInContext != null && (pathInContext.equals(_formErrorPath) || pathInContext.equals(_formLoginPath));
         }
     
    -    /* ------------------------------------------------------------ */
    -    /**
    -     * FORM Authentication credential holder.
    -     */
    -    private static class FormCredential implements Serializable, HttpSessionBindingListener
    -    {
    -        String _jUserName;
    -
    -        char[] _jPassword;
    -
    -        transient Principal _userPrincipal;
    -        
    -        transient Subject _subject;
    -
    -        private FormCredential(String _jUserName, char[] _jPassword, Principal _userPrincipal, Subject subject)
    -        {
    -            this._jUserName = _jUserName;
    -            this._jPassword = _jPassword;
    -            this._userPrincipal = _userPrincipal;
    -            this._subject = subject;
    -        }
    -
    -        public void valueBound(HttpSessionBindingEvent event)
    -        {
    -        }
    -
    -        public void valueUnbound(HttpSessionBindingEvent event)
    -        {
    -            if (LOG.isDebugEnabled()) LOG.debug("Logout " + _jUserName);
    -
    -            // TODO jaspi call cleanSubject()
    -            // if (_realm instanceof SSORealm)
    -            // ((SSORealm) _realm).clearSingleSignOn(_jUserName);
    -            //
    -            // if (_realm != null && _userPrincipal != null)
    -            // _realm.logout(_userPrincipal);
    -        }
    -
    -        public int hashCode()
    -        {
    -            return _jUserName.hashCode() + _jPassword.hashCode();
    -        }
    -
    -        public boolean equals(Object o)
    -        {
    -            if (!(o instanceof FormCredential)) return false;
    -            FormCredential fc = (FormCredential) o;
    -            return _jUserName.equals(fc._jUserName) && Arrays.equals(_jPassword, fc._jPassword);
    -        }
    -
    -        public String toString()
    -        {
    -            return "Cred[" + _jUserName + "]";
    -        }
    -
    -    }
    -
     }
    diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/BasicAuthenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/BasicAuthenticator.java
    index ec2fb04b0d7..3ae194f3fac 100644
    --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/BasicAuthenticator.java
    +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/BasicAuthenticator.java
    @@ -54,6 +54,8 @@ public class BasicAuthenticator extends LoginAuthenticator
             return Constraint.__BASIC_AUTH;
         }
     
    + 
    +
         /* ------------------------------------------------------------ */
         /**
          * @see org.eclipse.jetty.security.Authenticator#validateRequest(javax.servlet.ServletRequest, javax.servlet.ServletResponse, boolean)
    @@ -85,10 +87,9 @@ public class BasicAuthenticator extends LoginAuthenticator
                                 String username = credentials.substring(0,i);
                                 String password = credentials.substring(i+1);
     
    -                            UserIdentity user = _loginService.login(username,password);
    +                            UserIdentity user = login (username, password, request);
                                 if (user!=null)
                                 {
    -                                renewSession(request,response);
                                     return new UserAuthentication(getAuthMethod(),user);
                                 }
                             }
    diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/ClientCertAuthenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/ClientCertAuthenticator.java
    index a4bef236a3e..f34ccf3a0a3 100644
    --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/ClientCertAuthenticator.java
    +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/ClientCertAuthenticator.java
    @@ -81,6 +81,8 @@ public class ClientCertAuthenticator extends LoginAuthenticator
             return Constraint.__CERT_AUTH;
         }
         
    +    
    +
         /**
          * @return Authentication for request
          * @throws ServerAuthException
    @@ -121,10 +123,9 @@ public class ClientCertAuthenticator extends LoginAuthenticator
     
                         final char[] credential = B64Code.encode(cert.getSignature());
     
    -                    UserIdentity user = _loginService.login(username,credential);
    +                    UserIdentity user = login(username, credential, req);
                         if (user!=null)
                         {
    -                        renewSession(request,response);
                             return new UserAuthentication(getAuthMethod(),user);
                         }
                     }
    diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java
    index 26640168dfe..68f3192dfdb 100644
    --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java
    +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java
    @@ -29,6 +29,7 @@ import javax.servlet.ServletOutputStream;
     import javax.servlet.ServletRequest;
     import javax.servlet.ServletResponse;
     import javax.servlet.http.Cookie;
    +import javax.servlet.http.HttpServletRequest;
     import javax.servlet.http.HttpServletResponse;
     
     import org.eclipse.jetty.security.Authenticator;
    @@ -73,6 +74,7 @@ public class DeferredAuthentication implements Authentication.Deferred
                     
                     if (identity_service!=null)
                         _previousAssociation=identity_service.associate(((Authentication.User)authentication).getUserIdentity());
    +                
                     return authentication;
                 }
             }
    @@ -80,6 +82,7 @@ public class DeferredAuthentication implements Authentication.Deferred
             {
                 LOG.debug(e);
             }
    +
             return this;
         }
         
    @@ -110,21 +113,16 @@ public class DeferredAuthentication implements Authentication.Deferred
         /**
          * @see org.eclipse.jetty.server.Authentication.Deferred#login(java.lang.String, java.lang.String)
          */
    -    public Authentication login(String username, String password)
    +    public Authentication login(String username, Object password, ServletRequest request)
         {
    -        LoginService login_service= _authenticator.getLoginService();
    -        IdentityService identity_service=login_service.getIdentityService();
    -        
    -        if (login_service!=null)
    +        UserIdentity identity = _authenticator.login(username, password, request);
    +        if (identity != null)
             {
    -            UserIdentity user = login_service.login(username,password);
    -            if (user!=null)
    -            {
    -                UserAuthentication authentication = new UserAuthentication("API",user);
    -                if (identity_service!=null)
    -                    _previousAssociation=identity_service.associate(user);
    -                return authentication;
    -            }
    +            IdentityService identity_service = _authenticator.getLoginService().getIdentityService();
    +            UserAuthentication authentication = new UserAuthentication("API",identity);
    +            if (identity_service != null)
    +                _previousAssociation=identity_service.associate(identity);
    +            return authentication;
             }
             return null;
         }
    diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
    index c42c26c8719..1e5a417f29d 100644
    --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
    +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java
    @@ -116,6 +116,8 @@ public class DigestAuthenticator extends LoginAuthenticator
         {
             return true;
         }
    +    
    +
     
         /* ------------------------------------------------------------ */
         public Authentication validateRequest(ServletRequest req, ServletResponse res, boolean mandatory) throws ServerAuthException
    @@ -185,10 +187,10 @@ public class DigestAuthenticator extends LoginAuthenticator
     
                     if (n > 0)
                     {
    -                    UserIdentity user = _loginService.login(digest.username,digest);
    +                    //UserIdentity user = _loginService.login(digest.username,digest);
    +                    UserIdentity user = login(digest.username, digest, req);
                         if (user!=null)
                         {
    -                        renewSession(request,response);
                             return new UserAuthentication(getAuthMethod(),user);
                         }
                     }
    diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/FormAuthenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/FormAuthenticator.java
    index 829a9d595b0..b0f8f14c0c1 100644
    --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/FormAuthenticator.java
    +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/FormAuthenticator.java
    @@ -179,6 +179,22 @@ public class FormAuthenticator extends LoginAuthenticator
                     _formErrorPath = _formErrorPath.substring(0, _formErrorPath.indexOf('?'));
             }
         }
    +    
    +    
    +    /* ------------------------------------------------------------ */
    +    @Override
    +    public UserIdentity login(String username, Object password, ServletRequest request)
    +    {
    +        
    +        UserIdentity user = super.login(username,password,request);
    +        if (user!=null)
    +        {
    +            HttpSession session = ((HttpServletRequest)request).getSession(true);
    +            Authentication cached=new SessionAuthentication(getAuthMethod(),user,password);
    +            session.setAttribute(SessionAuthentication.__J_AUTHENTICATED, cached);
    +        }
    +        return user;
    +    }
     
         /* ------------------------------------------------------------ */
         public Authentication validateRequest(ServletRequest req, ServletResponse res, boolean mandatory) throws ServerAuthException
    @@ -206,11 +222,10 @@ public class FormAuthenticator extends LoginAuthenticator
                     final String username = request.getParameter(__J_USERNAME);
                     final String password = request.getParameter(__J_PASSWORD);
                     
    -                UserIdentity user = _loginService.login(username,password);
    +                UserIdentity user = login(username, password, request);
    +                session = request.getSession(true);
                     if (user!=null)
    -                {
    -                    session=renewSession(request,response);
    -                    
    +                {                    
                         // Redirect to original request
                         String nuri;
                         synchronized(session)
    @@ -223,9 +238,6 @@ public class FormAuthenticator extends LoginAuthenticator
                                 if (nuri.length() == 0) 
                                     nuri = URIUtil.SLASH;
                             }
    -
    -                        Authentication cached=new SessionAuthentication(getAuthMethod(),user,password);
    -                        session.setAttribute(SessionAuthentication.__J_AUTHENTICATED, cached);
                         }
                         response.setContentLength(0);   
                         response.sendRedirect(response.encodeRedirectURL(nuri));
    diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/LoginAuthenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/LoginAuthenticator.java
    index 17e86574b6c..322b17c95eb 100644
    --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/LoginAuthenticator.java
    +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/LoginAuthenticator.java
    @@ -18,6 +18,7 @@
     
     package org.eclipse.jetty.security.authentication;
     
    +import javax.servlet.ServletRequest;
     import javax.servlet.http.HttpServletRequest;
     import javax.servlet.http.HttpServletResponse;
     import javax.servlet.http.HttpSession;
    @@ -25,6 +26,8 @@ import javax.servlet.http.HttpSession;
     import org.eclipse.jetty.security.Authenticator;
     import org.eclipse.jetty.security.IdentityService;
     import org.eclipse.jetty.security.LoginService;
    +import org.eclipse.jetty.server.Authentication;
    +import org.eclipse.jetty.server.UserIdentity;
     import org.eclipse.jetty.server.session.AbstractSessionManager;
     
     public abstract class LoginAuthenticator implements Authenticator
    @@ -37,6 +40,20 @@ public abstract class LoginAuthenticator implements Authenticator
         {
         }
     
    +
    +    /* ------------------------------------------------------------ */
    +    public UserIdentity login(String username, Object password, ServletRequest request)
    +    {
    +        UserIdentity user = _loginService.login(username,password);
    +        if (user!=null)
    +        {
    +            renewSession((HttpServletRequest)request, null);
    +            return user;
    +        }
    +        return null;
    +    }
    +
    +
         public void setConfiguration(AuthConfiguration configuration)
         {
             _loginService=configuration.getLoginService();
    diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/SessionAuthentication.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/SessionAuthentication.java
    index 260d5ddd3f5..7c0a56c1ac5 100644
    --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/SessionAuthentication.java
    +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/SessionAuthentication.java
    @@ -98,8 +98,8 @@ public class SessionAuthentication implements Authentication.User, Serializable,
         {
             if (_session!=null && _session.getAttribute(__J_AUTHENTICATED)!=null)
                 _session.removeAttribute(__J_AUTHENTICATED);
    -        else 
    -            doLogout();
    +
    +        doLogout();
         }
         
         private void doLogout()
    diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/SpnegoAuthenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/SpnegoAuthenticator.java
    index ca5563f4e50..303d2f7e303 100644
    --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/SpnegoAuthenticator.java
    +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/SpnegoAuthenticator.java
    @@ -60,6 +60,8 @@ public class SpnegoAuthenticator extends LoginAuthenticator
             return _authMethod;
         }
     
    +
    +
         public Authentication validateRequest(ServletRequest request, ServletResponse response, boolean mandatory) throws ServerAuthException
         {        
             HttpServletRequest req = (HttpServletRequest)request;
    @@ -96,7 +98,7 @@ public class SpnegoAuthenticator extends LoginAuthenticator
             {
                 String spnegoToken = header.substring(10);
                 
    -            UserIdentity user = _loginService.login(null,spnegoToken);
    +            UserIdentity user = login(null,spnegoToken, request);
                 
                 if ( user != null )
                 {
    diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Authentication.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Authentication.java
    index 1c63baf764d..ff281f6d03b 100644
    --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Authentication.java
    +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Authentication.java
    @@ -85,7 +85,7 @@ public interface Authentication
              * @param password
              * @return The new Authentication state
              */
    -        Authentication login(String username,String password);
    +        Authentication login(String username,Object password,ServletRequest request);
         }
     
         
    diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java
    index d0ca3771e06..62dc7ab3b15 100644
    --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java
    +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java
    @@ -1312,6 +1312,7 @@ public class Request implements HttpServletRequest
                 UserIdentity user = ((Authentication.User)_authentication).getUserIdentity();
                 return user.getUserPrincipal();
             }
    +        
             return null;
         }
     
    @@ -1980,7 +1981,7 @@ public class Request implements HttpServletRequest
         {
             if (_authentication instanceof Authentication.Deferred)
             {
    -        	setAuthentication(((Authentication.Deferred)_authentication).authenticate(this,response));
    +            setAuthentication(((Authentication.Deferred)_authentication).authenticate(this,response));
                 return !(_authentication instanceof Authentication.ResponseSent);        
             }
             response.sendError(HttpStatus.UNAUTHORIZED_401);
    @@ -2069,7 +2070,7 @@ public class Request implements HttpServletRequest
         {
             if (_authentication instanceof Authentication.Deferred) 
             {
    -            _authentication=((Authentication.Deferred)_authentication).login(username,password);
    +            _authentication=((Authentication.Deferred)_authentication).login(username,password,this);
                 if (_authentication == null)
                     throw new ServletException();
             } 
    diff --git a/test-jetty-webapp/src/main/java/com/acme/LoginServlet.java b/test-jetty-webapp/src/main/java/com/acme/LoginServlet.java
    new file mode 100644
    index 00000000000..49d9a091683
    --- /dev/null
    +++ b/test-jetty-webapp/src/main/java/com/acme/LoginServlet.java
    @@ -0,0 +1,87 @@
    +// ========================================================================
    +// Copyright (c) 1996-2009 Mort Bay Consulting Pty. Ltd.
    +// ------------------------------------------------------------------------
    +// 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 com.acme;
    +
    +import java.io.File;
    +import java.io.IOException;
    +import java.io.PrintStream;
    +import java.net.URL;
    +import java.net.URLClassLoader;
    +import java.util.Calendar;
    +import java.util.GregorianCalendar;
    +
    +import javax.servlet.ServletConfig;
    +import javax.servlet.ServletException;
    +import javax.servlet.ServletOutputStream;
    +import javax.servlet.http.HttpServlet;
    +import javax.servlet.http.HttpServletRequest;
    +import javax.servlet.http.HttpServletResponse;
    +
    +import org.eclipse.jetty.util.log.Log;
    +import org.eclipse.jetty.util.log.Logger;
    +
    +
    +/* ------------------------------------------------------------ */
    +/** Dump Servlet Request.
    + * 
    + */
    +public class LoginServlet extends HttpServlet
    +{
    +    private static final Logger LOG = Log.getLogger(SecureModeServlet.class);
    +
    +    /* ------------------------------------------------------------ */
    +    @Override
    +    public void init(ServletConfig config) throws ServletException
    +    {
    +    	super.init(config);
    +    }
    +
    +    /* ------------------------------------------------------------ */
    +    @Override
    +    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    +    {
    +        doGet(request, response);
    +    }
    +
    +    /* ------------------------------------------------------------ */
    +    @Override
    +    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    +    {
    +         
    +        response.setContentType("text/html");
    +        ServletOutputStream out = response.getOutputStream();
    +        out.println("");
    +        out.println("
    Before getUserPrincipal="+request.getUserPrincipal()); + out.println("
    Before getRemoteUser="+request.getRemoteUser()); + String param = request.getParameter("action"); + + if ("login".equals(param)) + { + request.login("jetty", "jetty"); + } + else if ("logout".equals(param)) + { + request.logout(); + } + else if ("wrong".equals(param)) + { + request.login("jetty", "123"); + } + + out.println("
    After getUserPrincipal="+request.getUserPrincipal()); + out.println("
    After getRemoteUser="+request.getRemoteUser()); + out.println(""); + out.flush(); + } +} diff --git a/test-jetty-webapp/src/main/webapp/WEB-INF/web.xml b/test-jetty-webapp/src/main/webapp/WEB-INF/web.xml index 9fc7003d2fa..5a5149e53ef 100644 --- a/test-jetty-webapp/src/main/webapp/WEB-INF/web.xml +++ b/test-jetty-webapp/src/main/webapp/WEB-INF/web.xml @@ -105,6 +105,17 @@ REQUEST --> + + Login + com.acme.LoginServlet + 1 + + + + Login + /login/* + + Hello diff --git a/test-jetty-webapp/src/main/webapp/auth.html b/test-jetty-webapp/src/main/webapp/auth.html index 0bce2d555f6..4b67966d265 100644 --- a/test-jetty-webapp/src/main/webapp/auth.html +++ b/test-jetty-webapp/src/main/webapp/auth.html @@ -20,6 +20,10 @@ This page contains several links to test the authentication constraints:
  • dump/auth/ssl/* - Confidential
  • rego/info/* - Authenticated admin role from programmatic security (click to invalidate session)
  • rego2/info/* - Authenticated servlet-administrator role from programmatic security (login as admin/admin, click to invalidate session)
  • +
  • login - Programmatically login as the user jetty/jetty
  • +
  • check login status - Check the request's login status
  • +
  • logout - Programmatically logout the logged in user
  • +
  • incorrect login - Programmatically login with incorrect credentials
  • From 07327cf46d825bc6aa854560a730ee963d023593 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Sat, 13 Oct 2012 21:14:03 +1100 Subject: [PATCH 30/56] Fix license header --- .../src/main/java/com/acme/LoginServlet.java | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/test-jetty-webapp/src/main/java/com/acme/LoginServlet.java b/test-jetty-webapp/src/main/java/com/acme/LoginServlet.java index 49d9a091683..e86598d2811 100644 --- a/test-jetty-webapp/src/main/java/com/acme/LoginServlet.java +++ b/test-jetty-webapp/src/main/java/com/acme/LoginServlet.java @@ -1,15 +1,20 @@ -// ======================================================================== -// Copyright (c) 1996-2009 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// 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. -// ======================================================================== +// +// ======================================================================== +// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// 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 com.acme; From 6d26b45afed18dd5fe1211ccfbac7eb2587aa9a9 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 15 Oct 2012 12:12:53 +1100 Subject: [PATCH 31/56] 391877 org.eclipse.jetty.webapp.FragmentDescriptor incorrectly reporting duplicate others for after ordering --- .../jetty/webapp/FragmentDescriptor.java | 2 +- .../eclipse/jetty/webapp/OrderingTest.java | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/FragmentDescriptor.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/FragmentDescriptor.java index 884301ba132..3f185df4492 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/FragmentDescriptor.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/FragmentDescriptor.java @@ -136,7 +136,7 @@ public class FragmentDescriptor extends WebDescriptor node = (XmlParser.Node) o; if (node.getTag().equalsIgnoreCase("others")) { - if (_otherType != OtherType.After) + if (_otherType != OtherType.None) throw new IllegalStateException("Duplicate clause detected in "+_xml.getURI()); _otherType = OtherType.After; diff --git a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/OrderingTest.java b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/OrderingTest.java index 529cae4a758..fe109c48cee 100644 --- a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/OrderingTest.java +++ b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/OrderingTest.java @@ -852,6 +852,44 @@ public class OrderingTest fail ("No outcome matched "+result); } + @Test + public void testRelativeOrderingWithPlainJars2 () + throws Exception + { + //web.xml has no ordering, jar A has fragment after others, jar B is plain, jar C is plain + List resources = new ArrayList(); + WebAppContext wac = new WebAppContext(); + MetaData metaData = new MetaData(); + metaData._ordering = new RelativeOrdering(metaData); + + //A has after others + TestResource jar1 = new TestResource("A"); + resources.add(jar1); + TestResource r1 = new TestResource("A/web-fragment.xml"); + FragmentDescriptor f1 = new FragmentDescriptor(r1); + f1._name = "A"; + metaData._webFragmentNameMap.put(f1._name, f1); + metaData._webFragmentResourceMap.put(jar1, f1); + f1._otherType = FragmentDescriptor.OtherType.After; + + //No fragment jar B + TestResource r4 = new TestResource("plainB"); + resources.add(r4); + + //No fragment jar C + TestResource r5 = new TestResource("plainC"); + resources.add(r5); + + List orderedList = metaData._ordering.order(resources); + String[] outcomes = {"plainBplainCA"}; + String result = ""; + for (Resource r:orderedList) + result+=(((TestResource)r)._name); + + if (!checkResult(result, outcomes)) + fail ("No outcome matched "+result); + } + @Test public void testAbsoluteOrderingWithPlainJars() throws Exception From 3920146bf0e1ec2323c588a17b05e0e74a4755f6 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 15 Oct 2012 16:06:07 +1100 Subject: [PATCH 32/56] Remove printlns --- test-jetty-webapp/src/main/java/com/acme/TestListener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-jetty-webapp/src/main/java/com/acme/TestListener.java b/test-jetty-webapp/src/main/java/com/acme/TestListener.java index cf950edb7da..02674b48820 100644 --- a/test-jetty-webapp/src/main/java/com/acme/TestListener.java +++ b/test-jetty-webapp/src/main/java/com/acme/TestListener.java @@ -79,14 +79,14 @@ public class TestListener implements HttpSessionListener, HttpSessionAttributeL ServletSecurity.TransportGuarantee.NONE, new String[]{"admin"}); ServletSecurityElement securityElement = new ServletSecurityElement(constraintElement, null); Set unchanged = rego.setServletSecurity(securityElement); - System.err.println("Security constraints registered: "+unchanged.isEmpty()); + //System.err.println("Security constraints registered: "+unchanged.isEmpty()); //Test that a security constraint from web.xml can't be overridden programmatically ServletRegistration.Dynamic rego2 = sce.getServletContext().addServlet("RegoTest2", RegTest.class.getName()); rego2.addMapping("/rego2/*"); securityElement = new ServletSecurityElement(constraintElement, null); unchanged = rego2.setServletSecurity(securityElement); - System.err.println("Overridding web.xml constraints not possible:" +!unchanged.isEmpty()); + //System.err.println("Overridding web.xml constraints not possible:" +!unchanged.isEmpty()); /* For servlet 3.0 */ FilterRegistration.Dynamic registration = sce.getServletContext().addFilter("TestFilter",TestFilter.class.getName()); From bf1966ca94666a201ef635376dae2f5e034f0316 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 18 Oct 2012 11:30:48 +1100 Subject: [PATCH 33/56] 392239 Throw exception if no code or exception in error-page element --- .../jetty/webapp/StandardDescriptorProcessor.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 30a7ccc3a48..9f646e21329 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 @@ -682,13 +682,14 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor error = node.getString("exception-type", false, true); else code=Integer.valueOf(error); + + if (code == 0 && (error == null || error.length()==0)) + throw new IllegalStateException("Missing error-code or exception-type for error-page"); + String location = node.getString("location", false, true); - - ErrorPageErrorHandler handler = (ErrorPageErrorHandler)context.getErrorHandler(); - - Origin o = context.getMetaData().getOrigin("error."+error); + switch (o) { case NotSet: @@ -698,7 +699,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor handler.addErrorPage(code,location); else handler.addErrorPage(error,location); - context.getMetaData().setOrigin("error."+error, descriptor); + context.getMetaData().setOrigin("error."+(code>0?code:error), descriptor); break; } case WebXml: @@ -712,7 +713,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor handler.addErrorPage(code,location); else handler.addErrorPage(error,location); - context.getMetaData().setOrigin("error."+error, descriptor); + context.getMetaData().setOrigin("error."+(code>0?code:error), descriptor); } break; } From f6c1ade82f2f84b16996207cf95dee0cd2b83ab3 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 18 Oct 2012 14:40:22 +1100 Subject: [PATCH 34/56] Refactor AbstractSession to remove _jdbcAttributes --- .../jetty/server/session/AbstractSession.java | 15 ++++++++-- .../server/session/JDBCSessionManager.java | 29 ++++++++++--------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java index d3dab5fd14a..a23f399feba 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSession.java @@ -65,8 +65,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI private boolean _newSession; private int _requests; - // TODO remove this. - protected final Map _jdbcAttributes=_attributes; + /* ------------------------------------------------------------- */ protected AbstractSession(AbstractSessionManager abstractSessionManager, HttpServletRequest request) @@ -255,6 +254,18 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI return (String[])_attributes.keySet().toArray(a); } } + + /* ------------------------------------------------------------ */ + protected Map getAttributeMap () + { + return _attributes; + } + + /* ------------------------------------------------------------ */ + protected void addAttributes(Map map) + { + _attributes.putAll(map); + } /* ------------------------------------------------------------ */ protected boolean access(long time) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java index 16a39b4af63..74cb9b849d5 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java @@ -265,7 +265,8 @@ public class JDBCSessionManager extends AbstractSessionManager private static final long serialVersionUID = 5208464051134226143L; private final SessionData _data; private boolean _dirty=false; - + + /** * Session from a request. * @@ -274,7 +275,7 @@ public class JDBCSessionManager extends AbstractSessionManager protected Session (HttpServletRequest request) { super(JDBCSessionManager.this,request); - _data = new SessionData(getClusterId(),_jdbcAttributes); + _data = new SessionData(getClusterId(),getAttributeMap()); if (_dftMaxIdleSecs>0) _data.setMaxIdleMs(_dftMaxIdleSecs*1000L); _data.setCanonicalContext(canonicalize(_context.getContextPath())); @@ -284,18 +285,18 @@ public class JDBCSessionManager extends AbstractSessionManager } /** - * Session restored in database. - * @param data - */ - protected Session (long accessed, SessionData data) - { - super(JDBCSessionManager.this,data.getCreated(), accessed, data.getId()); - _data=data; - if (_dftMaxIdleSecs>0) - _data.setMaxIdleMs(_dftMaxIdleSecs*1000L); - _jdbcAttributes.putAll(_data.getAttributeMap()); - _data.setAttributeMap(_jdbcAttributes); - } + * Session restored in database. + * @param data + */ + protected Session (long accessed, SessionData data) + { + super(JDBCSessionManager.this,data.getCreated(), accessed, data.getId()); + _data=data; + if (_dftMaxIdleSecs>0) + _data.setMaxIdleMs(_dftMaxIdleSecs*1000L); + addAttributes(_data.getAttributeMap()); + _data.setAttributeMap(getAttributeMap()); + } @Override public void setAttribute (String name, Object value) From 4769ada6667f7f9ef7fcb716ea3c4f64acaa78ed Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 18 Oct 2012 16:34:15 +1100 Subject: [PATCH 35/56] 392239 Allow no error-code or exception for error-pages --- .../jetty/servlet/ErrorPageErrorHandler.java | 7 ++++++ .../webapp/StandardDescriptorProcessor.java | 22 ++++++++++++------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ErrorPageErrorHandler.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ErrorPageErrorHandler.java index de2327984c1..7f07fb194f6 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ErrorPageErrorHandler.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ErrorPageErrorHandler.java @@ -50,6 +50,7 @@ public class ErrorPageErrorHandler extends ErrorHandler private static final Logger LOG = Log.getLogger(ErrorPageErrorHandler.class); public final static String ERROR_PAGE="org.eclipse.jetty.server.error_page"; + public final static String GLOBAL_ERROR_PAGE = "org.eclipse.jetty.server.error_page.global"; protected ServletContext _servletContext; private final Map _errorPages= new HashMap(); // code or exception to URL @@ -120,6 +121,12 @@ public class ErrorPageErrorHandler extends ErrorHandler } } } + + //try new servlet 3.0 global error page + if (error_page == null) + { + error_page = _errorPages.get(GLOBAL_ERROR_PAGE); + } if (error_page!=null) { 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 9f646e21329..af737d78ab2 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 @@ -679,13 +679,14 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor String error = node.getString("error-code", false, true); int code=0; if (error == null || error.length() == 0) + { error = node.getString("exception-type", false, true); + if (error == null || error.length() == 0) + error = ErrorPageErrorHandler.GLOBAL_ERROR_PAGE; + } else code=Integer.valueOf(error); - if (code == 0 && (error == null || error.length()==0)) - throw new IllegalStateException("Missing error-code or exception-type for error-page"); - String location = node.getString("location", false, true); ErrorPageErrorHandler handler = (ErrorPageErrorHandler)context.getErrorHandler(); Origin o = context.getMetaData().getOrigin("error."+error); @@ -699,7 +700,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor handler.addErrorPage(code,location); else handler.addErrorPage(error,location); - context.getMetaData().setOrigin("error."+(code>0?code:error), descriptor); + context.getMetaData().setOrigin("error."+error, descriptor); break; } case WebXml: @@ -709,11 +710,16 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor //an error page setup was set in web.xml, only allow other web xml descriptors to override it if (!(descriptor instanceof FragmentDescriptor)) { - if (code>0) - handler.addErrorPage(code,location); + if (descriptor instanceof OverrideDescriptor || descriptor instanceof DefaultsDescriptor) + { + if (code>0) + handler.addErrorPage(code,location); + else + handler.addErrorPage(error,location); + context.getMetaData().setOrigin("error."+error, descriptor); + } else - handler.addErrorPage(error,location); - context.getMetaData().setOrigin("error."+(code>0?code:error), descriptor); + throw new IllegalStateException("Duplicate global error-page "+location); } break; } From 63ec4e4a396295befb36872a9bb028344bb8c0a2 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Sun, 21 Oct 2012 20:18:45 +1100 Subject: [PATCH 36/56] 392525 Add option to --stop-wait to specify timeout --- .../java/org/eclipse/jetty/start/Main.java | 20 ++++++++++++++----- .../org/eclipse/jetty/start/usage.txt | 5 +++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java index 96207821bc7..9726742630c 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java @@ -38,6 +38,7 @@ import java.lang.reflect.Method; import java.net.ConnectException; import java.net.InetAddress; import java.net.Socket; +import java.net.SocketTimeoutException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; @@ -182,7 +183,7 @@ public class Main { int port = Integer.parseInt(Config.getProperty("STOP.PORT","-1")); String key = Config.getProperty("STOP.KEY",null); - stop(port,key, false); + stop(port,key); return null; } @@ -190,7 +191,8 @@ public class Main { int port = Integer.parseInt(Config.getProperty("STOP.PORT","-1")); String key = Config.getProperty("STOP.KEY",null); - stop(port,key, true); + int timeout = Integer.parseInt(Config.getProperty("STOP.WAIT", "0")); + stop(port,key, true, timeout); return null; } @@ -1012,11 +1014,11 @@ public class Main */ public void stop(int port, String key) { - stop (port,key,false); + stop (port,key,false, 0); } + - - public void stop (int port, String key, boolean wait) + public void stop (int port, String key, boolean wait, int timeout) { int _port = port; String _key = key; @@ -1035,6 +1037,8 @@ public class Main } Socket s = new Socket(InetAddress.getByName("127.0.0.1"),_port); + if (wait && timeout > 0) + s.setSoTimeout(timeout*1000); try { OutputStream out = s.getOutputStream(); @@ -1043,6 +1047,7 @@ public class Main if (wait) { + System.err.println("Waiting"+(timeout > 0 ? (" "+timeout+"sec") : "")+" for jetty to stop"); LineNumberReader lin = new LineNumberReader(new InputStreamReader(s.getInputStream())); String response=lin.readLine(); if ("Stopped".equals(response)) @@ -1054,6 +1059,11 @@ public class Main s.close(); } } + catch (SocketTimeoutException e) + { + System.err.println("Timed out waiting for stop confirmation"); + System.exit(ERR_UNKNOWN); + } catch (ConnectException e) { usageExit(e,ERR_NOT_STOPPED); diff --git a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt index db8e8d22c87..54c32d45ce9 100644 --- a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt +++ b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt @@ -95,6 +95,11 @@ Properties: STOP.KEY=[alphanumeric] The passphrase defined to stop the server. Requried along with STOP.PORT if you want to use the --stop option above. + + STOP.WAIT=[number] + The time (in seconds) to wait for confirmation that the running Jetty server + has stopped. If not specified, the stopper will wait indefinitely. Use in + conjunction with the --stop-wait option. DEBUG=true Enable debug on the start mechanism and sets the From 8a9d25a48b48c6f6eb3240c9f44190488075cbce Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Fri, 26 Oct 2012 09:26:40 +1100 Subject: [PATCH 37/56] 392641 JDBC Sessions not scavenged if expired during downtime --- .../server/session/JDBCSessionIdManager.java | 164 +++++++++++--- .../server/session/JDBCSessionManager.java | 12 +- .../server/session/SessionExpiryTest.java | 53 +++++ .../session/AbstractSessionExpiryTest.java | 210 ++++++++++++++++++ 4 files changed, 405 insertions(+), 34 deletions(-) create mode 100644 tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionExpiryTest.java create mode 100644 tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionExpiryTest.java diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java index c8578ba8b8c..5ffb6dd9dad 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java @@ -30,7 +30,9 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; +import java.util.Collection; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Random; import java.util.Timer; @@ -81,7 +83,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager protected String _createSessionIdTable; protected String _createSessionTable; - protected String _selectExpiredSessions; + protected String _selectBoundedExpiredSessions; protected String _deleteOldExpiredSessions; protected String _insertId; @@ -96,6 +98,8 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager protected DatabaseAdaptor _dbAdaptor; + private String _selectExpiredSessions; + /** * DatabaseAdaptor @@ -114,7 +118,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager String _dbName; boolean _isLower; boolean _isUpper; - + public DatabaseAdaptor (DatabaseMetaData dbMeta) @@ -123,7 +127,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager _dbName = dbMeta.getDatabaseProductName().toLowerCase(); LOG.debug ("Using database {}",_dbName); _isLower = dbMeta.storesLowerCaseIdentifiers(); - _isUpper = dbMeta.storesUpperCaseIdentifiers(); + _isUpper = dbMeta.storesUpperCaseIdentifiers(); } /** @@ -455,6 +459,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager inUse = _sessionIds.contains(clusterId); } + if (inUse) return true; //optimisation - if this session is one we've been managing, we can check locally @@ -514,7 +519,8 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager try { initializeDatabase(); - prepareTables(); + prepareTables(); + cleanExpiredSessions(); super.doStart(); if (LOG.isDebugEnabled()) LOG.debug("Scavenging interval = "+getScavengeInterval()+" sec"); @@ -542,6 +548,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager _timer.cancel(); _timer=null; } + _sessionIds.clear(); super.doStop(); } @@ -559,31 +566,9 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager else return DriverManager.getConnection(_connectionUrl); } - - private void initializeDatabase () - throws Exception - { - if (_datasource != null) - return; //already set up - - if (_jndiName!=null) - { - InitialContext ic = new InitialContext(); - _datasource = (DataSource)ic.lookup(_jndiName); - } - else if ( _driver != null && _connectionUrl != null ) - { - DriverManager.registerDriver(_driver); - } - else if (_driverClassName != null && _connectionUrl != null) - { - Class.forName(_driverClassName); - } - else - throw new IllegalStateException("No database configured for sessions"); - } + /** @@ -594,7 +579,8 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager throws SQLException { _createSessionIdTable = "create table "+_sessionIdTable+" (id varchar(120), primary key(id))"; - _selectExpiredSessions = "select * from "+_sessionTable+" where expiryTime >= ? and expiryTime <= ?"; + _selectBoundedExpiredSessions = "select * from "+_sessionTable+" where expiryTime >= ? and expiryTime <= ?"; + _selectExpiredSessions = "select * from "+_sessionTable+" where expiryTime >0 and expiryTime <= ?"; _deleteOldExpiredSessions = "delete from "+_sessionTable+" where expiryTime >0 and expiryTime <= ?"; _insertId = "insert into "+_sessionIdTable+" (id) values (?)"; @@ -794,7 +780,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager connection = getConnection(); connection.setAutoCommit(true); //"select sessionId from JettySessions where expiryTime > (lastScavengeTime - scanInterval) and expiryTime < lastScavengeTime"; - PreparedStatement statement = connection.prepareStatement(_selectExpiredSessions); + PreparedStatement statement = connection.prepareStatement(_selectBoundedExpiredSessions); long lowerBound = (_lastScavengeTime - _scavengeIntervalMs); long upperBound = _lastScavengeTime; if (LOG.isDebugEnabled()) @@ -833,7 +819,8 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager if (LOG.isDebugEnabled()) LOG.debug("Deleting old expired sessions expired before "+upperBound); statement = connection.prepareStatement(_deleteOldExpiredSessions); statement.setLong(1, upperBound); - statement.executeUpdate(); + int rows = statement.executeUpdate(); + if (LOG.isDebugEnabled()) LOG.debug("Deleted "+rows+" rows"); } } } @@ -861,4 +848,121 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager } } } + + /** + * Get rid of sessions and sessionids from sessions that have already expired + * @throws Exception + */ + private void cleanExpiredSessions () + throws Exception + { + Connection connection = null; + List expiredSessionIds = new ArrayList(); + try + { + connection = getConnection(); + connection.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); + connection.setAutoCommit(false); + + PreparedStatement statement = connection.prepareStatement(_selectExpiredSessions); + long now = System.currentTimeMillis(); + if (LOG.isDebugEnabled()) LOG.debug ("Searching for sessions expired before {}", now); + + statement.setLong(1, now); + ResultSet result = statement.executeQuery(); + while (result.next()) + { + String sessionId = result.getString("sessionId"); + expiredSessionIds.add(sessionId); + if (LOG.isDebugEnabled()) LOG.debug ("Found expired sessionId={}", sessionId); + } + + Statement sessionsTableStatement = null; + Statement sessionIdsTableStatement = null; + + if (!expiredSessionIds.isEmpty()) + { + sessionsTableStatement = connection.createStatement(); + sessionsTableStatement.executeUpdate(createCleanExpiredSessionsSql("delete from "+_sessionTable+" where sessionId in ", expiredSessionIds)); + sessionIdsTableStatement = connection.createStatement(); + sessionIdsTableStatement.executeUpdate(createCleanExpiredSessionsSql("delete from "+_sessionIdTable+" where id in ", expiredSessionIds)); + } + connection.commit(); + + synchronized (_sessionIds) + { + _sessionIds.removeAll(expiredSessionIds); //in case they were in our local cache of session ids + } + } + catch (Exception e) + { + if (connection != null) + connection.rollback(); + throw e; + } + finally + { + try + { + if (connection != null) + connection.close(); + } + catch (SQLException e) + { + LOG.warn(e); + } + } + } + + + /** + * + * @param sql + * @param connection + * @param expiredSessionIds + * @throws Exception + */ + private String createCleanExpiredSessionsSql (String sql,Collection expiredSessionIds) + throws Exception + { + StringBuffer buff = new StringBuffer(); + buff.append(sql); + buff.append("("); + Iterator itor = expiredSessionIds.iterator(); + while (itor.hasNext()) + { + buff.append("'"+(itor.next())+"'"); + if (itor.hasNext()) + buff.append(","); + } + buff.append(")"); + + if (LOG.isDebugEnabled()) LOG.debug("Cleaning expired sessions with: {}", buff); + return buff.toString(); + } + + private void initializeDatabase () + throws Exception + { + if (_datasource != null) + return; //already set up + + if (_jndiName!=null) + { + InitialContext ic = new InitialContext(); + _datasource = (DataSource)ic.lookup(_jndiName); + } + else if ( _driver != null && _connectionUrl != null ) + { + DriverManager.registerDriver(_driver); + } + else if (_driverClassName != null && _connectionUrl != null) + { + Class.forName(_driverClassName); + } + else + throw new IllegalStateException("No database configured for sessions"); + } + + } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java index 74cb9b849d5..e63704793a9 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionManager.java @@ -540,7 +540,7 @@ public class JDBCSessionManager extends AbstractSessionManager //if the session has no expiry, or it is not already expired if (data._expiryTime <= 0 || data._expiryTime > now) { - LOG.debug("getSession("+idInCluster+"): lastNode="+data.getLastNode()+" thisNode="+getSessionIdManager().getWorkerName()); + if (LOG.isDebugEnabled()) LOG.debug("getSession("+idInCluster+"): lastNode="+data.getLastNode()+" thisNode="+getSessionIdManager().getWorkerName()); data.setLastNode(getSessionIdManager().getWorkerName()); //session last used on a different node, or we don't have it in memory session = new Session(now,data); @@ -551,18 +551,21 @@ public class JDBCSessionManager extends AbstractSessionManager updateSessionNode(data); } else - if (LOG.isDebugEnabled()) LOG.debug("getSession("+idInCluster+"): Session has expired"); + { + LOG.debug("getSession ({}): Session has expired", idInCluster); + + } } else - if (LOG.isDebugEnabled()) LOG.debug("getSession("+idInCluster+"): Session not stale "+session._data); + LOG.debug("getSession({}): Session not stale {}", idInCluster,session._data); //session in db shares same id, but is not for this context } else { //No session in db with matching id and context path. session=null; - if (LOG.isDebugEnabled()) LOG.debug("getSession("+idInCluster+"): No session in database matching id="+idInCluster); + LOG.debug("getSession({}): No session in database matching id={}",idInCluster,idInCluster); } return session; @@ -606,6 +609,7 @@ public class JDBCSessionManager extends AbstractSessionManager _jdbcSessionIdMgr = (JDBCSessionIdManager)_sessionIdManager; _sessions = new ConcurrentHashMap(); + super.doStart(); } diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionExpiryTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionExpiryTest.java new file mode 100644 index 00000000000..f9c09224e2a --- /dev/null +++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionExpiryTest.java @@ -0,0 +1,53 @@ +// +// ======================================================================== +// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// 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.server.session; + +import org.junit.Test; + +/** + * SessionExpiryTest + * + * + * + */ +public class SessionExpiryTest extends AbstractSessionExpiryTest +{ + + /** + * @see org.eclipse.jetty.server.session.AbstractSessionExpiryTest#createServer(int, int, int) + */ + @Override + public AbstractTestServer createServer(int port, int max, int scavenge) + { + return new JdbcTestServer(port,max,scavenge); + } + + @Test + public void testSessionExpiry() throws Exception + { + super.testSessionExpiry(); + } + + @Test + public void testSessionNotExpired() throws Exception + { + super.testSessionNotExpired(); + } + + +} diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionExpiryTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionExpiryTest.java new file mode 100644 index 00000000000..ad870dfc863 --- /dev/null +++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionExpiryTest.java @@ -0,0 +1,210 @@ +// +// ======================================================================== +// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// 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.server.session; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.eclipse.jetty.client.ContentExchange; +import org.eclipse.jetty.client.HttpClient; +import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.server.Request; +import org.eclipse.jetty.server.SessionManager; +import org.eclipse.jetty.server.session.AbstractTestServer; +import org.eclipse.jetty.servlet.ServletHolder; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + + + +/** + * AbstractSessionExpiryTest + * + * + * + */ +public abstract class AbstractSessionExpiryTest +{ + public abstract AbstractTestServer createServer(int port, int max, int scavenge); + + public void pause(int scavengePeriod) + { + try + { + Thread.sleep(scavengePeriod * 2500L); + } + catch (InterruptedException e) + { + e.printStackTrace(); + } + } + + @Test + public void testSessionNotExpired() throws Exception + { + String contextPath = ""; + String servletMapping = "/server"; + int inactivePeriod = 10; + int scavengePeriod = 10; + AbstractTestServer server1 = createServer(0, inactivePeriod, scavengePeriod); + TestServlet servlet = new TestServlet(); + ServletHolder holder = new ServletHolder(servlet); + server1.addContext(contextPath).addServlet(holder, servletMapping); + server1.start(); + int port1 = server1.getPort(); + + try + { + HttpClient client = new HttpClient(); + client.setConnectorType(HttpClient.CONNECTOR_SOCKET); + client.start(); + String url = "http://localhost:" + port1 + contextPath + servletMapping; + + //make a request to set up a session on the server + ContentExchange exchange1 = new ContentExchange(true); + exchange1.setMethod(HttpMethods.GET); + exchange1.setURL(url + "?action=init"); + client.send(exchange1); + exchange1.waitForDone(); + assertEquals(HttpServletResponse.SC_OK,exchange1.getResponseStatus()); + String sessionCookie = exchange1.getResponseFields().getStringField("Set-Cookie"); + assertTrue(sessionCookie != null); + // Mangle the cookie, replacing Path with $Path, etc. + sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path="); + + //now stop the server + server1.stop(); + + //start the server again, before the session times out + server1.start(); + port1 = server1.getPort(); + url = "http://localhost:" + port1 + contextPath + servletMapping; + + //make another request, the session should not have expired + ContentExchange exchange2 = new ContentExchange(true); + exchange2.setMethod(HttpMethods.GET); + exchange2.setURL(url + "?action=notexpired"); + exchange2.getRequestFields().add("Cookie", sessionCookie); + client.send(exchange2); + exchange2.waitForDone(); + assertEquals(HttpServletResponse.SC_OK,exchange2.getResponseStatus()); + + } + finally + { + server1.stop(); + } + } + + @Test + public void testSessionExpiry() throws Exception + { + String contextPath = ""; + String servletMapping = "/server"; + int inactivePeriod = 2; + int scavengePeriod = 10; + AbstractTestServer server1 = createServer(0, inactivePeriod, scavengePeriod); + TestServlet servlet = new TestServlet(); + ServletHolder holder = new ServletHolder(servlet); + server1.addContext(contextPath).addServlet(holder, servletMapping); + server1.start(); + int port1 = server1.getPort(); + + try + { + HttpClient client = new HttpClient(); + client.setConnectorType(HttpClient.CONNECTOR_SOCKET); + client.start(); + String url = "http://localhost:" + port1 + contextPath + servletMapping; + + //make a request to set up a session on the server + ContentExchange exchange1 = new ContentExchange(true); + exchange1.setMethod(HttpMethods.GET); + exchange1.setURL(url + "?action=init"); + client.send(exchange1); + exchange1.waitForDone(); + assertEquals(HttpServletResponse.SC_OK,exchange1.getResponseStatus()); + String sessionCookie = exchange1.getResponseFields().getStringField("Set-Cookie"); + assertTrue(sessionCookie != null); + // Mangle the cookie, replacing Path with $Path, etc. + sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path="); + + //now stop the server + server1.stop(); + + //and wait until the expiry time has passed + pause(inactivePeriod); + + //restart the server + server1.start(); + port1 = server1.getPort(); + url = "http://localhost:" + port1 + contextPath + servletMapping; + + //make another request, the session should have expired + ContentExchange exchange2 = new ContentExchange(true); + exchange2.setMethod(HttpMethods.GET); + exchange2.setURL(url + "?action=test"); + exchange2.getRequestFields().add("Cookie", sessionCookie); + client.send(exchange2); + exchange2.waitForDone(); + assertEquals(HttpServletResponse.SC_OK,exchange2.getResponseStatus()); + } + finally + { + server1.stop(); + } + } + + public static class TestServlet extends HttpServlet + { + public String originalId = null; + public String testId = null; + public String checkId = null; + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse httpServletResponse) throws ServletException, IOException + { + String action = request.getParameter("action"); + if ("init".equals(action)) + { + HttpSession session = request.getSession(true); + session.setAttribute("test", "test"); + originalId = session.getId(); + } + else if ("test".equals(action)) + { + HttpSession session = request.getSession(true); + assertTrue(session != null); + assertTrue(!originalId.equals(session.getId())); + } + else if ("notexpired".equals(action)) + { + HttpSession session = request.getSession(false); + assertTrue(session != null); + assertTrue(originalId.equals(session.getId())); + } + + } + } +} From 0efdc471db2dce4593faf78c35fdc94f6e410441 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Sat, 27 Oct 2012 18:31:34 +1100 Subject: [PATCH 38/56] Add space to license for license-checker recognition --- .../java/org/eclipse/jetty/server/session/SessionExpiryTest.java | 1 + .../eclipse/jetty/server/session/AbstractSessionExpiryTest.java | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionExpiryTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionExpiryTest.java index f9c09224e2a..a4315949174 100644 --- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionExpiryTest.java +++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionExpiryTest.java @@ -15,6 +15,7 @@ // You may elect to redistribute this code under either of these licenses. // ======================================================================== // + package org.eclipse.jetty.server.session; import org.junit.Test; diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionExpiryTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionExpiryTest.java index ad870dfc863..d743225fd26 100644 --- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionExpiryTest.java +++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionExpiryTest.java @@ -15,6 +15,7 @@ // You may elect to redistribute this code under either of these licenses. // ======================================================================== // + package org.eclipse.jetty.server.session; import java.io.IOException; From 3ef7a8b2631efbb890d4bf25322f2b67e8eb0d74 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 29 Oct 2012 11:29:34 +1100 Subject: [PATCH 39/56] 393014 Mongodb purgevalid using query for purgeinvalid --- .../eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java index 74621901cff..c7785e00268 100644 --- a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java +++ b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java @@ -234,9 +234,9 @@ public class MongoSessionIdManager extends AbstractSessionIdManager BasicDBObject validQuery = new BasicDBObject(); validQuery.put(MongoSessionManager.__ACCESSED,new BasicDBObject("$lt",System.currentTimeMillis() - _purgeValidAge)); - validQuery.put(MongoSessionManager.__VALID, __valid_false); + validQuery.put(MongoSessionManager.__VALID, true); - oldSessions = _sessions.find(invalidQuery,new BasicDBObject(MongoSessionManager.__ID,1)); + oldSessions = _sessions.find(validQuery,new BasicDBObject(MongoSessionManager.__ID,1)); for (DBObject session : oldSessions) { From 16b159fe8d547b50d31d4209b4096cac0037c2c0 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 29 Oct 2012 12:48:01 +1100 Subject: [PATCH 40/56] 393015 Mongodb purge not rescheduled --- .../org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java index c7785e00268..c0e969da7a5 100644 --- a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java +++ b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java @@ -410,7 +410,8 @@ public class MongoSessionIdManager extends AbstractSessionIdManager purge(); } }; - _purgeTimer.schedule(_purgeTask,_purgeDelay); + + _purgeTimer.schedule(_purgeTask,0,_purgeDelay); } } } From 7c03c793d56a622687a7104ea48e135a6899a43f Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 29 Oct 2012 12:49:38 +1100 Subject: [PATCH 41/56] 392812 MongoSessionIDManager never purges old sessions --- .../nosql/mongodb/MongoSessionIdManager.java | 2 +- .../mongodb/PurgeInvalidSessionTest.java | 190 ++++++++++++++++++ .../nosql/mongodb/PurgeValidSessionTest.java | 171 ++++++++++++++++ 3 files changed, 362 insertions(+), 1 deletion(-) create mode 100644 tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/PurgeInvalidSessionTest.java create mode 100644 tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/PurgeValidSessionTest.java diff --git a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java index c0e969da7a5..a8b5a1c81bc 100644 --- a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java +++ b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java @@ -216,7 +216,7 @@ public class MongoSessionIdManager extends AbstractSessionIdManager BasicDBObject invalidQuery = new BasicDBObject(); invalidQuery.put(MongoSessionManager.__ACCESSED, new BasicDBObject("$lt",System.currentTimeMillis() - _purgeInvalidAge)); - invalidQuery.put(MongoSessionManager.__VALID, __valid_false); + invalidQuery.put(MongoSessionManager.__VALID, false); DBCursor oldSessions = _sessions.find(invalidQuery, new BasicDBObject(MongoSessionManager.__ID, 1)); diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/PurgeInvalidSessionTest.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/PurgeInvalidSessionTest.java new file mode 100644 index 00000000000..51cd3879442 --- /dev/null +++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/PurgeInvalidSessionTest.java @@ -0,0 +1,190 @@ +// +// ======================================================================== +// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// 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.nosql.mongodb; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; + +import java.io.IOException; +import java.net.UnknownHostException; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.eclipse.jetty.client.ContentExchange; +import org.eclipse.jetty.client.HttpClient; +import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.junit.Test; + +import com.mongodb.BasicDBObject; +import com.mongodb.DBCollection; +import com.mongodb.DBObject; +import com.mongodb.Mongo; +import com.mongodb.MongoException; + +/** + * PurgeInvalidSessionTest + * + * + * + */ +public class PurgeInvalidSessionTest +{ + public MongoTestServer createServer(int port, int max, int scavenge) + { + MongoTestServer server = new MongoTestServer(port,max,scavenge); + + return server; + } + + + + @Test + public void testPurgeInvalidSession() throws Exception + { + String contextPath = ""; + String servletMapping = "/server"; + long purgeDelay = 1000; //1 sec + long purgeInvalidAge = 1000; //1 sec + long purgeValidAge = 1000; + + //ensure scavenging is turned off so the purger gets a chance to find the session + MongoTestServer server = createServer(0, 1, 0); + ServletContextHandler context = server.addContext(contextPath); + context.addServlet(TestServlet.class, servletMapping); + + MongoSessionManager sessionManager = (MongoSessionManager)context.getSessionHandler().getSessionManager(); + MongoSessionIdManager idManager = (MongoSessionIdManager)server.getServer().getSessionIdManager(); + idManager.setPurge(true); + idManager.setPurgeDelay(purgeDelay); + idManager.setPurgeInvalidAge(purgeInvalidAge); //purge invalid sessions older than + idManager.setPurgeValidAge(purgeValidAge); //purge valid sessions older than + + + + server.start(); + int port=server.getPort(); + try + { + HttpClient client = new HttpClient(); + client.setConnectorType(HttpClient.CONNECTOR_SOCKET); + client.start(); + try + { + //Create a session + ContentExchange exchange = new ContentExchange(true); + exchange.setMethod(HttpMethods.GET); + exchange.setURL("http://localhost:" + port + contextPath + servletMapping + "?action=create"); + client.send(exchange); + exchange.waitForDone(); + assertEquals(HttpServletResponse.SC_OK,exchange.getResponseStatus()); + String sessionCookie = exchange.getResponseFields().getStringField("Set-Cookie"); + assertTrue(sessionCookie != null); + // Mangle the cookie, replacing Path with $Path, etc. + sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path="); + + //make a request to invalidate the session + exchange = new ContentExchange(true); + exchange.setMethod(HttpMethods.GET); + exchange.setURL("http://localhost:" + port + contextPath + servletMapping + "?action=invalidate"); + exchange.getRequestFields().add("Cookie", sessionCookie); + client.send(exchange); + exchange.waitForDone(); + assertEquals(HttpServletResponse.SC_OK,exchange.getResponseStatus()); + + Thread.currentThread().sleep(3*purgeDelay); //sleep long enough for purger to have run + + //make a request using previous session to test if its still there + exchange = new ContentExchange(true); + exchange.setMethod(HttpMethods.GET); + exchange.setURL("http://localhost:" + port + contextPath + servletMapping + "?action=test"); + exchange.getRequestFields().add("Cookie", sessionCookie); + client.send(exchange); + exchange.waitForDone(); + assertEquals(HttpServletResponse.SC_OK,exchange.getResponseStatus()); + } + finally + { + client.stop(); + } + } + finally + { + server.stop(); + } + + } + + + public static class TestServlet extends HttpServlet + { + DBCollection _sessions; + + + public TestServlet() throws UnknownHostException, MongoException + { + super(); + _sessions = new Mongo().getDB("HttpSessions").getCollection("sessions"); + } + + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException + { + String action = request.getParameter("action"); + if ("create".equals(action)) + { + HttpSession session = request.getSession(true); + assertTrue(session.isNew()); + } + else if ("invalidate".equals(action)) + { + HttpSession existingSession = request.getSession(false); + assertNotNull(existingSession); + existingSession.invalidate(); + String id = request.getRequestedSessionId(); + assertNotNull(id); + id = id.substring(0, id.indexOf(".")); + + //still in db, just marked as invalid + DBObject dbSession = _sessions.findOne(new BasicDBObject("id", id)); + assertTrue(dbSession != null); + } + else if ("test".equals(action)) + { + String id = request.getRequestedSessionId(); + assertNotNull(id); + id = id.substring(0, id.indexOf(".")); + + HttpSession existingSession = request.getSession(false); + assertTrue(existingSession == null); + + //not in db any more + DBObject dbSession = _sessions.findOne(new BasicDBObject("id", id)); + assertTrue(dbSession == null); + } + } + } + +} diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/PurgeValidSessionTest.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/PurgeValidSessionTest.java new file mode 100644 index 00000000000..40b422b96c5 --- /dev/null +++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/PurgeValidSessionTest.java @@ -0,0 +1,171 @@ +// +// ======================================================================== +// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// 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.nosql.mongodb; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; + +import java.io.IOException; +import java.net.UnknownHostException; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.eclipse.jetty.client.ContentExchange; +import org.eclipse.jetty.client.HttpClient; +import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.junit.Test; + +import com.mongodb.BasicDBObject; +import com.mongodb.DBCollection; +import com.mongodb.DBObject; +import com.mongodb.Mongo; +import com.mongodb.MongoException; + +/** + * PurgeValidSessionTest + * + * + * + */ +public class PurgeValidSessionTest +{ + + + + public MongoTestServer createServer(int port, int max, int scavenge) + { + MongoTestServer server = new MongoTestServer(port,max,scavenge); + + return server; + } + + + + @Test + public void testPurgeValidSession() throws Exception + { + String contextPath = ""; + String servletMapping = "/server"; + long purgeDelay = 1000; //1 sec + long purgeValidAge = 1000; + + //ensure scavenging is turned off so the purger gets a chance to find the session + MongoTestServer server = createServer(0, 1, 0); + ServletContextHandler context = server.addContext(contextPath); + context.addServlet(TestServlet.class, servletMapping); + + MongoSessionManager sessionManager = (MongoSessionManager)context.getSessionHandler().getSessionManager(); + MongoSessionIdManager idManager = (MongoSessionIdManager)server.getServer().getSessionIdManager(); + idManager.setPurge(true); + idManager.setPurgeDelay(purgeDelay); + + idManager.setPurgeValidAge(purgeValidAge); //purge valid sessions older than + + + + server.start(); + int port=server.getPort(); + try + { + HttpClient client = new HttpClient(); + client.setConnectorType(HttpClient.CONNECTOR_SOCKET); + client.start(); + try + { + //Create a session + ContentExchange exchange = new ContentExchange(true); + exchange.setMethod(HttpMethods.GET); + exchange.setURL("http://localhost:" + port + contextPath + servletMapping + "?action=create"); + client.send(exchange); + exchange.waitForDone(); + assertEquals(HttpServletResponse.SC_OK,exchange.getResponseStatus()); + String sessionCookie = exchange.getResponseFields().getStringField("Set-Cookie"); + assertTrue(sessionCookie != null); + // Mangle the cookie, replacing Path with $Path, etc. + sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path="); + + + Thread.currentThread().sleep(3*purgeDelay); //sleep long enough for purger to have run + + //make a request using previous session to test if its still there + exchange = new ContentExchange(true); + exchange.setMethod(HttpMethods.GET); + exchange.setURL("http://localhost:" + port + contextPath + servletMapping + "?action=test"); + exchange.getRequestFields().add("Cookie", sessionCookie); + client.send(exchange); + exchange.waitForDone(); + assertEquals(HttpServletResponse.SC_OK,exchange.getResponseStatus()); + } + finally + { + client.stop(); + } + } + finally + { + server.stop(); + } + + } + + + public static class TestServlet extends HttpServlet + { + DBCollection _sessions; + + + public TestServlet() throws UnknownHostException, MongoException + { + super(); + _sessions = new Mongo().getDB("HttpSessions").getCollection("sessions"); + } + + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException + { + String action = request.getParameter("action"); + if ("create".equals(action)) + { + HttpSession session = request.getSession(true); + assertTrue(session.isNew()); + } + else if ("test".equals(action)) + { + String id = request.getRequestedSessionId(); + assertNotNull(id); + id = id.substring(0, id.indexOf(".")); + + HttpSession existingSession = request.getSession(false); + assertTrue(existingSession == null); + + //not in db any more + DBObject dbSession = _sessions.findOne(new BasicDBObject("id", id)); + assertTrue(dbSession == null); + } + } + } + +} From 8b90057b68baea9c0bd11178c6122215b0e3a5c7 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 29 Oct 2012 16:05:46 +1100 Subject: [PATCH 42/56] 371170 MongoSessionManager LastAccessTimeTest fails --- .../session/AbstractLastAccessTimeTest.java | 44 ++++++++++++++----- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLastAccessTimeTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLastAccessTimeTest.java index bd5b0d6536d..f37dd8352cd 100644 --- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLastAccessTimeTest.java +++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLastAccessTimeTest.java @@ -27,10 +27,14 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpSessionEvent; +import javax.servlet.http.HttpSessionListener; import org.eclipse.jetty.client.ContentExchange; import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -51,7 +55,12 @@ public abstract class AbstractLastAccessTimeTest int maxInactivePeriod = 8; int scavengePeriod = 2; AbstractTestServer server1 = createServer(0, maxInactivePeriod, scavengePeriod); - server1.addContext(contextPath).addServlet(TestServlet.class, servletMapping); + TestServlet servlet1 = new TestServlet(); + ServletHolder holder1 = new ServletHolder(servlet1); + ServletContextHandler context = server1.addContext(contextPath); + TestSessionListener listener1 = new TestSessionListener(); + context.addEventListener(listener1); + context.addServlet(holder1, servletMapping); server1.start(); int port1=server1.getPort(); try @@ -108,17 +117,9 @@ public abstract class AbstractLastAccessTimeTest // Let's wait for the scavenger to run, waiting 2.5 times the scavenger period Thread.sleep(scavengePeriod * 2500L); - // Access again server1, and ensure that we can still access the session - exchange1 = new ContentExchange(true); - exchange1.setMethod(HttpMethods.GET); - exchange1.setURL("http://localhost:" + port1 + contextPath + servletMapping); - exchange1.getRequestFields().add("Cookie", sessionCookie); - client.send(exchange1); - exchange1.waitForDone(); - assertEquals(HttpServletResponse.SC_OK, exchange1.getResponseStatus()); - //test that the session was kept alive by server 2 and still contains what server1 put in it - assertEquals("test", exchange1.getResponseContent()); - + //check that the session was not scavenged over on server1 by ensuring that the SessionListener destroy method wasn't called + assertTrue (listener1.destroyed == false); + } finally { @@ -136,6 +137,25 @@ public abstract class AbstractLastAccessTimeTest } } + public static class TestSessionListener implements HttpSessionListener + { + public boolean destroyed = false; + public boolean created = false; + + + public void sessionDestroyed(HttpSessionEvent se) + { + destroyed = true; + } + + + public void sessionCreated(HttpSessionEvent se) + { + created = true; + } + } + + public static class TestServlet extends HttpServlet { @Override From 6108d0df0c598227c960bc3fffa7efb531eff8d3 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 29 Oct 2012 11:18:01 -0700 Subject: [PATCH 43/56] 393075 Jetty WebSocket client cannot connect to Tomcat WebSocket Server * Adding testcase to repliate behavior as reported by bug. --- .../websocket/WebSocketClientFactory.java | 6 +- .../websocket/TomcatServerQuirksTest.java | 122 +++++++ .../jetty/websocket/WebSocketClientTest.java | 6 +- .../jetty/websocket/dummy/DummyServer.java | 308 ++++++++++++++++++ .../test/resources/jetty-logging.properties | 4 + 5 files changed, 441 insertions(+), 5 deletions(-) create mode 100644 jetty-websocket/src/test/java/org/eclipse/jetty/websocket/TomcatServerQuirksTest.java create mode 100644 jetty-websocket/src/test/java/org/eclipse/jetty/websocket/dummy/DummyServer.java create mode 100644 jetty-websocket/src/test/resources/jetty-logging.properties diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java index d624428b727..b365ee6dfd5 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java @@ -28,6 +28,7 @@ import java.util.Map; import java.util.Queue; import java.util.Random; import java.util.concurrent.ConcurrentLinkedQueue; + import javax.net.ssl.SSLEngine; import org.eclipse.jetty.http.HttpFields; @@ -389,7 +390,7 @@ public class WebSocketClientFactory extends AggregateLifeCycle _accept = value.toString(); } - @Override + @Override // TODO simone says shouldn't be needed public void startRequest(Buffer method, Buffer url, Buffer version) throws IOException { if (_error == null) @@ -397,7 +398,7 @@ public class WebSocketClientFactory extends AggregateLifeCycle _endp.close(); } - @Override + @Override // TODO simone says shouldn't be needed public void content(Buffer ref) throws IOException { if (_error == null) @@ -515,6 +516,7 @@ public class WebSocketClientFactory extends AggregateLifeCycle private WebSocketConnection newWebSocketConnection() throws IOException { + __log.debug("newWebSocketConnection()"); return new WebSocketClientConnection( _future._client.getFactory(), _future.getWebSocket(), diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/TomcatServerQuirksTest.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/TomcatServerQuirksTest.java new file mode 100644 index 00000000000..754a4199db4 --- /dev/null +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/TomcatServerQuirksTest.java @@ -0,0 +1,122 @@ +// +// ======================================================================== +// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// 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.websocket; + +import java.io.IOException; +import java.net.URI; +import java.nio.ByteBuffer; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import org.eclipse.jetty.util.thread.QueuedThreadPool; +import org.eclipse.jetty.websocket.dummy.DummyServer; +import org.eclipse.jetty.websocket.dummy.DummyServer.ServerConnection; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +public class TomcatServerQuirksTest +{ + /** + * Test for when encountering a "Transfer-Encoding: chunked" on a Upgrade Response header. + *

    + * @throws IOException + */ + @Test + @Ignore("Bug with Transfer-Encoding") + public void testTomcat7_0_32_WithTransferEncoding() throws Exception { + DummyServer server = new DummyServer(); + int bufferSize = 512; + QueuedThreadPool threadPool = new QueuedThreadPool(); + WebSocketClientFactory factory = new WebSocketClientFactory(threadPool, new ZeroMaskGen(), bufferSize); + + try { + server.start(); + + // Setup Client Factory + threadPool.start(); + factory.start(); + + // Create Client + WebSocketClient client = new WebSocketClient(factory); + + // Create End User WebSocket Class + final CountDownLatch openLatch = new CountDownLatch(1); + final CountDownLatch dataLatch = new CountDownLatch(1); + WebSocket.OnTextMessage websocket = new WebSocket.OnTextMessage() + { + public void onOpen(Connection connection) + { + openLatch.countDown(); + } + + public void onMessage(String data) + { + // System.out.println("data = " + data); + dataLatch.countDown(); + } + + public void onClose(int closeCode, String message) + { + } + }; + + // Open connection + URI wsURI = server.getWsUri(); + client.open(wsURI, websocket); + + // Accept incoming connection + ServerConnection socket = server.accept(); + socket.setSoTimeout(2000); // timeout + + // Issue upgrade + Map extraResponseHeaders = new HashMap(); + extraResponseHeaders.put("Transfer-Encoding", "chunked"); // !! The problem !! + socket.upgrade(extraResponseHeaders); + + // Wait for proper upgrade + Assert.assertTrue("Timed out waiting for Client side WebSocket open event", openLatch.await(1, TimeUnit.SECONDS)); + + // Have server write frame. + int length = bufferSize / 2; + ByteBuffer serverFrame = ByteBuffer.allocate(bufferSize); + serverFrame.put((byte)(0x80 | 0x01)); // FIN + TEXT + serverFrame.put((byte)0x7E); // No MASK and 2 bytes length + serverFrame.put((byte)(length >> 8)); // first length byte + serverFrame.put((byte)(length & 0xFF)); // second length byte + for (int i = 0; i < length; ++i) + serverFrame.put((byte)'x'); + serverFrame.flip(); + byte buf[] = serverFrame.array(); + socket.write(buf,0,buf.length); + socket.flush(); + + Assert.assertTrue(dataLatch.await(1000, TimeUnit.SECONDS)); + } finally { + factory.stop(); + threadPool.stop(); + server.stop(); + } + } +} diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketClientTest.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketClientTest.java index f70c43ca36a..8cd1b467c11 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketClientTest.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketClientTest.java @@ -18,6 +18,8 @@ package org.eclipse.jetty.websocket; +import static org.hamcrest.Matchers.*; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -47,9 +49,6 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.Matchers.is; - public class WebSocketClientTest { private WebSocketClientFactory _factory = new WebSocketClientFactory(); @@ -103,6 +102,7 @@ public class WebSocketClientTest { } }; + client.open(new URI("ws://127.0.0.1:" + _serverPort + "/"), websocket); Socket socket = _server.accept(); diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/dummy/DummyServer.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/dummy/DummyServer.java new file mode 100644 index 00000000000..9b41e51e2fa --- /dev/null +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/dummy/DummyServer.java @@ -0,0 +1,308 @@ +// +// ======================================================================== +// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// 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.websocket.dummy; + +import static org.hamcrest.Matchers.*; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.SocketException; +import java.net.URI; +import java.nio.ByteBuffer; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.eclipse.jetty.util.IO; +import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.WebSocketConnectionRFC6455; +import org.junit.Assert; + +/** + * Simple ServerSocket server used to test oddball server scenarios encountered in the real world. + */ +public class DummyServer +{ + public static class ServerConnection + { + private static final Logger LOG = Log.getLogger(ServerConnection.class); + private final Socket socket; + private InputStream in; + private OutputStream out; + + public ServerConnection(Socket socket) + { + this.socket = socket; + } + + public int read(ByteBuffer buf) throws IOException + { + int len = 0; + while ((in.available() > 0) && (buf.remaining() > 0)) + { + buf.put((byte)in.read()); + len++; + } + return len; + } + + public void disconnect() + { + LOG.debug("disconnect"); + IO.close(in); + IO.close(out); + if (socket != null) + { + try + { + socket.close(); + } + catch (IOException ignore) + { + /* ignore */ + } + } + } + + public InputStream getInputStream() throws IOException + { + if (in == null) + { + in = socket.getInputStream(); + } + return in; + } + + public OutputStream getOutputStream() throws IOException + { + if (out == null) + { + out = socket.getOutputStream(); + } + return out; + } + + public void flush() throws IOException + { + LOG.debug("flush()"); + getOutputStream().flush(); + } + + public String readRequest() throws IOException + { + LOG.debug("Reading client request"); + StringBuilder request = new StringBuilder(); + BufferedReader in = new BufferedReader(new InputStreamReader(getInputStream())); + for (String line = in.readLine(); line != null; line = in.readLine()) + { + if (line.length() == 0) + { + break; + } + request.append(line).append("\r\n"); + LOG.debug("read line: {}",line); + } + + LOG.debug("Client Request:{}{}","\n",request); + return request.toString(); + } + + public void respond(String rawstr) throws IOException + { + LOG.debug("respond(){}{}","\n",rawstr); + getOutputStream().write(rawstr.getBytes()); + flush(); + } + + public void setSoTimeout(int ms) throws SocketException + { + socket.setSoTimeout(ms); + } + + public void upgrade(Map extraResponseHeaders) throws IOException + { + @SuppressWarnings("unused") + Pattern patExts = Pattern.compile("^Sec-WebSocket-Extensions: (.*)$",Pattern.CASE_INSENSITIVE); + Pattern patKey = Pattern.compile("^Sec-WebSocket-Key: (.*)$",Pattern.CASE_INSENSITIVE); + + LOG.debug("(Upgrade) Reading HTTP Request"); + Matcher mat; + String key = "not sent"; + BufferedReader in = new BufferedReader(new InputStreamReader(getInputStream())); + for (String line = in.readLine(); line != null; line = in.readLine()) + { + if (line.length() == 0) + { + break; + } + + // TODO: Check for extensions + // mat = patExts.matcher(line); + // if (mat.matches()) + + // Check for Key + mat = patKey.matcher(line); + if (mat.matches()) + { + key = mat.group(1); + } + } + + LOG.debug("(Upgrade) Writing HTTP Response"); + // TODO: handle extensions? + + // Setup Response + StringBuilder resp = new StringBuilder(); + resp.append("HTTP/1.1 101 Upgrade\r\n"); + resp.append("Upgrade: websocket\r\n"); + resp.append("Connection: upgrade\r\n"); + resp.append("Sec-WebSocket-Accept: "); + resp.append(WebSocketConnectionRFC6455.hashKey(key)).append("\r\n"); + // extra response headers. + if (extraResponseHeaders != null) + { + for (Map.Entry header : extraResponseHeaders.entrySet()) + { + resp.append(header.getKey()); + resp.append(": "); + resp.append(header.getValue()); + resp.append("\r\n"); + } + } + resp.append("\r\n"); + + // Write Response + getOutputStream().write(resp.toString().getBytes()); + flush(); + } + + public void write(byte[] bytes) throws IOException + { + LOG.debug("Writing {} bytes", bytes.length); + getOutputStream().write(bytes); + } + + public void write(byte[] buf, int offset, int length) throws IOException + { + LOG.debug("Writing bytes[{}], offset={}, length={}", buf.length, offset, length); + getOutputStream().write(buf,offset,length); + } + + public void write(int b) throws IOException + { + LOG.debug("Writing int={}", b); + getOutputStream().write(b); + } + } + + private static final Logger LOG = Log.getLogger(DummyServer.class); + private ServerSocket serverSocket; + private URI wsUri; + + public ServerConnection accept() throws IOException + { + LOG.debug(".accept()"); + assertIsStarted(); + Socket socket = serverSocket.accept(); + return new ServerConnection(socket); + } + + private void assertIsStarted() + { + Assert.assertThat("ServerSocket",serverSocket,notNullValue()); + Assert.assertThat("ServerSocket.isBound",serverSocket.isBound(),is(true)); + Assert.assertThat("ServerSocket.isClosed",serverSocket.isClosed(),is(false)); + + Assert.assertThat("WsUri",wsUri,notNullValue()); + } + + public URI getWsUri() + { + return wsUri; + } + + public void respondToClient(Socket connection, String serverResponse) throws IOException + { + InputStream in = null; + InputStreamReader isr = null; + BufferedReader buf = null; + OutputStream out = null; + try + { + in = connection.getInputStream(); + isr = new InputStreamReader(in); + buf = new BufferedReader(isr); + String line; + while ((line = buf.readLine()) != null) + { + // System.err.println(line); + if (line.length() == 0) + { + // Got the "\r\n" line. + break; + } + } + + // System.out.println("[Server-Out] " + serverResponse); + out = connection.getOutputStream(); + out.write(serverResponse.getBytes()); + out.flush(); + } + finally + { + IO.close(buf); + IO.close(isr); + IO.close(in); + IO.close(out); + } + } + + public void start() throws IOException + { + serverSocket = new ServerSocket(); + InetAddress addr = InetAddress.getByName("localhost"); + InetSocketAddress endpoint = new InetSocketAddress(addr,0); + serverSocket.bind(endpoint); + int port = serverSocket.getLocalPort(); + String uri = String.format("ws://%s:%d/",addr.getHostAddress(),port); + wsUri = URI.create(uri); + LOG.debug("Server Started on {} -> {}",endpoint,wsUri); + } + + public void stop() + { + LOG.debug("Stopping Server"); + try + { + serverSocket.close(); + } + catch (IOException ignore) + { + /* ignore */ + } + } + +} diff --git a/jetty-websocket/src/test/resources/jetty-logging.properties b/jetty-websocket/src/test/resources/jetty-logging.properties new file mode 100644 index 00000000000..78d8a9d8123 --- /dev/null +++ b/jetty-websocket/src/test/resources/jetty-logging.properties @@ -0,0 +1,4 @@ +# Setup default logging implementation for during testing +org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog +org.eclipse.jetty.LEVEL=INFO +org.eclipse.jetty.websocket.LEVEL=DEBUG \ No newline at end of file From b5fd0950550a898058251e22b2b72aec5d0415c0 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Wed, 31 Oct 2012 10:24:47 -0500 Subject: [PATCH 44/56] added test case to validate the existing regex rewrite rule as wired up --- .../jetty/rewrite/handler/RewriteHandlerTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/RewriteHandlerTest.java b/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/RewriteHandlerTest.java index 26eaf136fd5..497006c6ab8 100644 --- a/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/RewriteHandlerTest.java +++ b/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/RewriteHandlerTest.java @@ -77,6 +77,20 @@ public class RewriteHandlerTest extends AbstractRuleTestCase @Test public void test() throws Exception { + _response.setStatus(200); + _request.setHandled(false); + _handler.setOriginalPathAttribute("/before"); + _handler.setRewriteRequestURI(true); + _handler.setRewritePathInfo(true); + _request.setRequestURI("/xxx/bar"); + _request.setPathInfo("/xxx/bar"); + _handler.handle("/xxx/bar",_request,_request, _response); + assertEquals(201,_response.getStatus()); + assertEquals("/bar/zzz",_request.getAttribute("target")); + assertEquals("/bar/zzz",_request.getAttribute("URI")); + assertEquals("/bar/zzz",_request.getAttribute("info")); + assertEquals(null,_request.getAttribute("before")); + _response.setStatus(200); _request.setHandled(false); _handler.setOriginalPathAttribute("/before"); From e93a254306bbb27d08dff0d5d7f858fe4996f0df Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Thu, 1 Nov 2012 10:57:17 -0500 Subject: [PATCH 45/56] [Bug 393218] add xsd=application/xml mime mapping to defaults --- .../src/main/resources/org/eclipse/jetty/http/mime.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/jetty-http/src/main/resources/org/eclipse/jetty/http/mime.properties b/jetty-http/src/main/resources/org/eclipse/jetty/http/mime.properties index a26891e7b0f..8425ac1931a 100644 --- a/jetty-http/src/main/resources/org/eclipse/jetty/http/mime.properties +++ b/jetty-http/src/main/resources/org/eclipse/jetty/http/mime.properties @@ -171,6 +171,7 @@ xhtml = application/xhtml+xml xls = application/vnd.ms-excel xml = application/xml xpm = image/x-xpixmap +xsd = application/xml xsl = application/xml xslt = application/xslt+xml xul = application/vnd.mozilla.xul+xml From ba06103442f221f1a1e680f25a3de1f91b157683 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 2 Nov 2012 10:28:23 +1100 Subject: [PATCH 46/56] 393383 delay onClose call until closeOut is done --- .../jetty/websocket/WebSocketConnectionRFC6455.java | 10 +++++----- .../jetty/websocket/WebSocketMessageRFC6455Test.java | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java index 46c1cbc6a74..d999d924fec 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java @@ -323,13 +323,13 @@ public class WebSocketConnectionRFC6455 extends AbstractConnection implements We try { - if (tell_app) - _webSocket.onClose(code,message); + if (!closed_out) + closeOut(code,message); } finally { - if (!closed_out) - closeOut(code,message); + if (tell_app) + _webSocket.onClose(code,message); } } @@ -353,7 +353,7 @@ public class WebSocketConnectionRFC6455 extends AbstractConnection implements We } try - { + { if (tell_app) _webSocket.onClose(code,message); } diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java index 2e1846fde2d..048de59e078 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java @@ -1337,7 +1337,7 @@ public class WebSocketMessageRFC6455Test output.flush(); // Make sure the read times out if there are problems with the implementation - socket.setSoTimeout(1000); + socket.setSoTimeout(10000); InputStream input = socket.getInputStream(); @@ -1347,7 +1347,7 @@ public class WebSocketMessageRFC6455Test skipTo("\r\n\r\n",input); - assertTrue(__serverWebSocket.awaitConnected(1000)); + assertTrue(__serverWebSocket.awaitConnected(10000)); assertNotNull(__serverWebSocket.connection); assertEquals(0x81,input.read()); @@ -1355,7 +1355,7 @@ public class WebSocketMessageRFC6455Test lookFor("sent on connect",input); socket.close(); - assertTrue(__serverWebSocket.awaitDisconnected(500)); + assertTrue(__serverWebSocket.awaitDisconnected(10000)); try { From 65202e9abe2c56a05b45140e46c70a94b4119cbb Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 2 Nov 2012 11:55:00 +1100 Subject: [PATCH 47/56] 393363 Use Locale.ENGLISH for all toUpperCase and toLowerCase calls --- .../jetty/annotations/AnnotationParser.java | 5 +++-- .../ResourceAnnotationHandler.java | 3 ++- .../jetty/client/SslHttpExchangeTest.java | 4 +++- .../jetty/client/SslSecurityListenerTest.java | 3 ++- .../eclipse/jetty/deploy/WebAppDeployer.java | 3 ++- .../deploy/providers/ContextProvider.java | 3 ++- .../deploy/providers/WebAppProvider.java | 7 ++++--- .../org/eclipse/jetty/deploy/util/FileID.java | 7 ++++--- .../org/eclipse/jetty/http/HttpFields.java | 2 +- .../eclipse/jetty/http/HttpFieldsTest.java | 19 ++++++++++--------- .../jetty/io/nio/SelectChannelEndPoint.java | 3 ++- .../org/eclipse/jetty/jmx/MBeanContainer.java | 3 ++- .../org/eclipse/jetty/jmx/ObjectMBean.java | 2 +- .../jetty/plus/annotation/Injection.java | 3 ++- .../jetty/plus/jaas/spi/LdapLoginModule.java | 9 +++++---- .../plus/security/DataSourceLoginService.java | 7 ++++--- .../jetty/rewrite/handler/ProxyRule.java | 5 +++-- .../authentication/FormAuthenticator.java | 7 ++++--- .../eclipse/jetty/server/CookieCutter.java | 4 +++- .../server/session/JDBCSessionIdManager.java | 7 ++++--- .../server/SelectChannelTimeoutTest.java | 7 ++++--- .../handler/AbstractConnectHandlerTest.java | 3 ++- .../server/handler/IPAccessHandlerTest.java | 3 ++- .../org/eclipse/jetty/servlet/Invoker.java | 3 ++- .../java/org/eclipse/jetty/servlets/CGI.java | 5 +++-- .../eclipse/jetty/servlets/GzipFilter.java | 5 +++-- .../jetty/servlets/MultiPartFilter.java | 3 ++- .../eclipse/jetty/servlets/ProxyServlet.java | 3 ++- .../eclipse/jetty/servlets/PutFilterTest.java | 3 ++- .../org/eclipse/jetty/spdy/api/Headers.java | 17 +++++++++-------- .../spdy/generator/HeadersBlockGenerator.java | 3 ++- .../jetty/spdy/http/ReferrerPushStrategy.java | 3 ++- .../http/ServerHTTPSPDYAsyncConnection.java | 3 ++- .../proxy/ProxyHTTPSPDYAsyncConnection.java | 3 ++- .../java/org/eclipse/jetty/start/Config.java | 9 +++++---- .../java/org/eclipse/jetty/start/Main.java | 9 +++++---- .../jetty/util/RolloverFileOutputStream.java | 5 +++-- .../jetty/util/ajax/JSONObjectConvertor.java | 5 +++-- .../jetty/util/ajax/JSONPojoConvertor.java | 5 +++-- .../org/eclipse/jetty/webapp/JarScanner.java | 3 ++- .../jetty/webapp/MetaInfConfiguration.java | 3 ++- .../webapp/StandardDescriptorProcessor.java | 5 +++-- .../jetty/webapp/TagLibConfiguration.java | 7 ++++--- .../jetty/webapp/WebAppClassLoader.java | 3 ++- .../jetty/webapp/WebInfConfiguration.java | 5 +++-- .../eclipse/jetty/xml/XmlConfiguration.java | 7 ++++--- .../src/main/java/com/acme/Dump.java | 2 +- 47 files changed, 142 insertions(+), 96 deletions(-) diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java index 781cac429f4..bd362f033c6 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java @@ -29,6 +29,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.jar.JarEntry; @@ -580,7 +581,7 @@ public class AnnotationParser try { String name = entry.getName(); - if (name.toLowerCase().endsWith(".class")) + if (name.toLowerCase(Locale.ENGLISH).endsWith(".class")) { String shortName = name.replace('/', '.').substring(0,name.length()-6); if ((resolver == null) @@ -624,7 +625,7 @@ public class AnnotationParser try { String name = entry.getName(); - if (name.toLowerCase().endsWith(".class")) + if (name.toLowerCase(Locale.ENGLISH).endsWith(".class")) { String shortName = name.replace('/', '.').substring(0,name.length()-6); diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourceAnnotationHandler.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourceAnnotationHandler.java index 4f2dd128574..af2d8aeb0e3 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourceAnnotationHandler.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/ResourceAnnotationHandler.java @@ -21,6 +21,7 @@ package org.eclipse.jetty.annotations; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.util.Locale; import javax.annotation.Resource; import javax.naming.InitialContext; @@ -262,7 +263,7 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH //default name is the javabean property name String name = method.getName().substring(3); - name = name.substring(0,1).toLowerCase()+name.substring(1); + name = name.substring(0,1).toLowerCase(Locale.ENGLISH)+name.substring(1); name = clazz.getCanonicalName()+"/"+name; name = (resource.name()!=null && !resource.name().trim().equals("")? resource.name(): name); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/SslHttpExchangeTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/SslHttpExchangeTest.java index 0aa29202d76..93b1c2b7f51 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/SslHttpExchangeTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/SslHttpExchangeTest.java @@ -21,6 +21,8 @@ package org.eclipse.jetty.client; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.not; +import java.util.Locale; + import org.eclipse.jetty.client.helperClasses.ServerAndClientCreator; import org.eclipse.jetty.client.helperClasses.SslServerAndClientCreator; import org.eclipse.jetty.server.Connector; @@ -51,7 +53,7 @@ public class SslHttpExchangeTest extends HttpExchangeTest { // Use Junit 4.x to flag test as ignored if encountering IBM JVM // Will show up in various junit reports as an ignored test as well. - Assume.assumeThat(System.getProperty("java.vendor").toLowerCase(),not(containsString("ibm"))); + Assume.assumeThat(System.getProperty("java.vendor").toLowerCase(Locale.ENGLISH),not(containsString("ibm"))); } /* ------------------------------------------------------------ */ diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/SslSecurityListenerTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/SslSecurityListenerTest.java index 0e4183ad013..56d73638019 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/SslSecurityListenerTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/SslSecurityListenerTest.java @@ -28,6 +28,7 @@ import java.io.OutputStream; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; +import java.util.Locale; import java.util.Set; import java.util.concurrent.CyclicBarrier; import java.util.concurrent.TimeUnit; @@ -126,7 +127,7 @@ public class SslSecurityListenerTest public void testSslGet() throws Exception { // TODO Resolve problems on IBM JVM https://bugs.eclipse.org/bugs/show_bug.cgi?id=304532 - if (System.getProperty("java.vendor").toLowerCase().indexOf("ibm")>=0) + if (System.getProperty("java.vendor").toLowerCase(Locale.ENGLISH).indexOf("ibm")>=0) { LOG.warn("Skipped SSL testSslGet on IBM JVM"); return; diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/WebAppDeployer.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/WebAppDeployer.java index 759c31cce36..6c841f173b3 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/WebAppDeployer.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/WebAppDeployer.java @@ -19,6 +19,7 @@ package org.eclipse.jetty.deploy; import java.util.ArrayList; +import java.util.Locale; import org.eclipse.jetty.deploy.providers.ScanningAppProvider; import org.eclipse.jetty.server.Handler; @@ -223,7 +224,7 @@ public class WebAppDeployer extends AbstractLifeCycle Resource app=r.addPath(r.encode(context)); - if (context.toLowerCase().endsWith(".war")||context.toLowerCase().endsWith(".jar")) + if (context.toLowerCase(Locale.ENGLISH).endsWith(".war")||context.toLowerCase(Locale.ENGLISH).endsWith(".jar")) { context=context.substring(0,context.length()-4); Resource unpacked=r.addPath(context); diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ContextProvider.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ContextProvider.java index f9e0dea5d06..2e4af290988 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ContextProvider.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ContextProvider.java @@ -20,6 +20,7 @@ package org.eclipse.jetty.deploy.providers; import java.io.File; import java.io.FilenameFilter; +import java.util.Locale; import org.eclipse.jetty.deploy.App; import org.eclipse.jetty.deploy.ConfigurationManager; @@ -45,7 +46,7 @@ public class ContextProvider extends ScanningAppProvider { if (!dir.exists()) return false; - String lowername = name.toLowerCase(); + String lowername = name.toLowerCase(Locale.ENGLISH); if (lowername.startsWith(".")) return false; diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java index fbad5325c55..f27a84548a0 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java @@ -22,6 +22,7 @@ import java.io.File; import java.io.FilenameFilter; import java.io.IOException; import java.net.MalformedURLException; +import java.util.Locale; import org.eclipse.jetty.deploy.App; import org.eclipse.jetty.deploy.util.FileID; @@ -59,7 +60,7 @@ public class WebAppProvider extends ScanningAppProvider { return false; } - String lowername = name.toLowerCase(); + String lowername = name.toLowerCase(Locale.ENGLISH); File file = new File(dir,name); // is it not a directory and not a war ? @@ -279,9 +280,9 @@ public class WebAppProvider extends ScanningAppProvider { context = URIUtil.SLASH; } - else if (context.toLowerCase().startsWith("root-")) + else if (context.toLowerCase(Locale.ENGLISH).startsWith("root-")) { - int dash=context.toLowerCase().indexOf('-'); + int dash=context.toLowerCase(Locale.ENGLISH).indexOf('-'); String virtual = context.substring(dash+1); wah.setVirtualHosts(new String[]{virtual}); context = URIUtil.SLASH; diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/util/FileID.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/util/FileID.java index cda1fe21a88..7df726926f0 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/util/FileID.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/util/FileID.java @@ -19,6 +19,7 @@ package org.eclipse.jetty.deploy.util; import java.io.File; +import java.util.Locale; /** * Simple, yet surprisingly common utility methods for identifying various file types commonly seen and worked with in a @@ -38,7 +39,7 @@ public class FileID { if (path.isFile()) { - String name = path.getName().toLowerCase(); + String name = path.getName().toLowerCase(Locale.ENGLISH); return (name.endsWith(".war") || name.endsWith(".jar")); } @@ -62,7 +63,7 @@ public class FileID return false; } - String name = path.getName().toLowerCase(); + String name = path.getName().toLowerCase(Locale.ENGLISH); return (name.endsWith(".war") || name.endsWith(".jar")); } @@ -73,7 +74,7 @@ public class FileID return false; } - String name = path.getName().toLowerCase(); + String name = path.getName().toLowerCase(Locale.ENGLISH); return name.endsWith(".xml"); } } diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java index 89a004f7107..a0a117c6616 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java @@ -959,7 +959,7 @@ public class HttpFields { hasDomain = true; buf.append(";Domain="); - QuotedStringTokenizer.quoteIfNeeded(buf,domain.toLowerCase(),delim); + QuotedStringTokenizer.quoteIfNeeded(buf,domain.toLowerCase(Locale.ENGLISH),delim); } if (maxAge >= 0) diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java index 3e26687ec4a..20cf89c222e 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java @@ -25,6 +25,7 @@ import static org.junit.Assert.assertTrue; import java.util.Enumeration; import java.util.HashSet; +import java.util.Locale; import java.util.Set; import org.eclipse.jetty.io.Buffer; @@ -312,8 +313,8 @@ public class HttpFieldsTest s=enum2set(fields.getFieldNames()); assertEquals(3,s.size()); assertTrue(s.contains("message-id")); - assertEquals("value",fields.getStringField("message-id").toLowerCase()); - assertEquals("value",fields.getStringField("Message-ID").toLowerCase()); + assertEquals("value",fields.getStringField("message-id").toLowerCase(Locale.ENGLISH)); + assertEquals("value",fields.getStringField("Message-ID").toLowerCase(Locale.ENGLISH)); fields.clear(); @@ -323,8 +324,8 @@ public class HttpFieldsTest s=enum2set(fields.getFieldNames()); assertEquals(3,s.size()); assertTrue(s.contains("message-id")); - assertEquals("value",fields.getStringField("Message-ID").toLowerCase()); - assertEquals("value",fields.getStringField("message-id").toLowerCase()); + assertEquals("value",fields.getStringField("Message-ID").toLowerCase(Locale.ENGLISH)); + assertEquals("value",fields.getStringField("message-id").toLowerCase(Locale.ENGLISH)); fields.clear(); @@ -334,8 +335,8 @@ public class HttpFieldsTest s=enum2set(fields.getFieldNames()); assertEquals(3,s.size()); assertTrue(s.contains("message-id")); - assertEquals("value",fields.getStringField("message-id").toLowerCase()); - assertEquals("value",fields.getStringField("Message-ID").toLowerCase()); + assertEquals("value",fields.getStringField("message-id").toLowerCase(Locale.ENGLISH)); + assertEquals("value",fields.getStringField("Message-ID").toLowerCase(Locale.ENGLISH)); fields.clear(); @@ -345,8 +346,8 @@ public class HttpFieldsTest s=enum2set(fields.getFieldNames()); assertEquals(3,s.size()); assertTrue(s.contains("message-id")); - assertEquals("value",fields.getStringField("Message-ID").toLowerCase()); - assertEquals("value",fields.getStringField("message-id").toLowerCase()); + assertEquals("value",fields.getStringField("Message-ID").toLowerCase(Locale.ENGLISH)); + assertEquals("value",fields.getStringField("message-id").toLowerCase(Locale.ENGLISH)); } @Test @@ -458,7 +459,7 @@ public class HttpFieldsTest { Set s=new HashSet(); while(e.hasMoreElements()) - s.add(e.nextElement().toLowerCase()); + s.add(e.nextElement().toLowerCase(Locale.ENGLISH)); return s; } diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java index bc6ada8bd93..4c09ccd80fb 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java @@ -23,6 +23,7 @@ import java.nio.channels.ClosedChannelException; import java.nio.channels.SelectableChannel; import java.nio.channels.SelectionKey; import java.nio.channels.SocketChannel; +import java.util.Locale; import org.eclipse.jetty.io.AsyncEndPoint; import org.eclipse.jetty.io.Buffer; @@ -42,7 +43,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo { public static final Logger LOG=Log.getLogger("org.eclipse.jetty.io.nio"); - private final boolean WORK_AROUND_JVM_BUG_6346658 = System.getProperty("os.name").toLowerCase().contains("win"); + private final boolean WORK_AROUND_JVM_BUG_6346658 = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("win"); private final SelectorManager.SelectSet _selectSet; private final SelectorManager _manager; private SelectionKey _key; diff --git a/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java b/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java index 2bde7f9e30e..dd97554b3e2 100644 --- a/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java +++ b/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java @@ -24,6 +24,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.WeakHashMap; @@ -251,7 +252,7 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste //no override mbean object name, so make a generic one if (oname == null) { - String type = obj.getClass().getName().toLowerCase(); + String type = obj.getClass().getName().toLowerCase(Locale.ENGLISH); int dot = type.lastIndexOf('.'); if (dot >= 0) type = type.substring(dot + 1); diff --git a/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/ObjectMBean.java b/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/ObjectMBean.java index 0123a4bcb7e..b526599e935 100644 --- a/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/ObjectMBean.java +++ b/jetty-jmx/src/main/java/org/eclipse/jetty/jmx/ObjectMBean.java @@ -564,7 +564,7 @@ public class ObjectMBean implements DynamicMBean } - String uName = name.substring(0, 1).toUpperCase() + name.substring(1); + String uName = name.substring(0, 1).toUpperCase(Locale.ENGLISH) + name.substring(1); Class oClass = onMBean ? this.getClass() : _managed.getClass(); if (LOG.isDebugEnabled()) diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/Injection.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/Injection.java index 68310ee2b79..79ec710e772 100644 --- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/Injection.java +++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/Injection.java @@ -21,6 +21,7 @@ package org.eclipse.jetty.plus.annotation; import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.Method; +import java.util.Locale; import javax.naming.InitialContext; import javax.naming.NamingException; @@ -141,7 +142,7 @@ public class Injection _resourceClass = resourceType; //first look for a javabeans style setter matching the targetName - String setter = "set"+target.substring(0,1).toUpperCase()+target.substring(1); + String setter = "set"+target.substring(0,1).toUpperCase(Locale.ENGLISH)+target.substring(1); try { LOG.debug("Looking for method for setter: "+setter+" with arg "+_resourceClass); diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/jaas/spi/LdapLoginModule.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/jaas/spi/LdapLoginModule.java index db9e8f9f55e..f2a20b0fe2c 100644 --- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/jaas/spi/LdapLoginModule.java +++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/jaas/spi/LdapLoginModule.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Properties; @@ -653,12 +654,12 @@ public class LdapLoginModule extends AbstractLoginModule public static String convertCredentialJettyToLdap(String encryptedPassword) { - if ("MD5:".startsWith(encryptedPassword.toUpperCase())) + if ("MD5:".startsWith(encryptedPassword.toUpperCase(Locale.ENGLISH))) { return "{MD5}" + encryptedPassword.substring("MD5:".length(), encryptedPassword.length()); } - if ("CRYPT:".startsWith(encryptedPassword.toUpperCase())) + if ("CRYPT:".startsWith(encryptedPassword.toUpperCase(Locale.ENGLISH))) { return "{CRYPT}" + encryptedPassword.substring("CRYPT:".length(), encryptedPassword.length()); } @@ -673,12 +674,12 @@ public class LdapLoginModule extends AbstractLoginModule return encryptedPassword; } - if ("{MD5}".startsWith(encryptedPassword.toUpperCase())) + if ("{MD5}".startsWith(encryptedPassword.toUpperCase(Locale.ENGLISH))) { return "MD5:" + encryptedPassword.substring("{MD5}".length(), encryptedPassword.length()); } - if ("{CRYPT}".startsWith(encryptedPassword.toUpperCase())) + if ("{CRYPT}".startsWith(encryptedPassword.toUpperCase(Locale.ENGLISH))) { return "CRYPT:" + encryptedPassword.substring("{CRYPT}".length(), encryptedPassword.length()); } diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/security/DataSourceLoginService.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/security/DataSourceLoginService.java index a350764ae6d..a6673385ae6 100644 --- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/security/DataSourceLoginService.java +++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/security/DataSourceLoginService.java @@ -26,6 +26,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import javax.naming.InitialContext; import javax.naming.NameNotFoundException; @@ -414,7 +415,7 @@ public class DataSourceLoginService extends MappedLoginService DatabaseMetaData metaData = connection.getMetaData(); //check if tables exist - String tableName = (metaData.storesLowerCaseIdentifiers()? _userTableName.toLowerCase(): (metaData.storesUpperCaseIdentifiers()?_userTableName.toUpperCase(): _userTableName)); + String tableName = (metaData.storesLowerCaseIdentifiers()? _userTableName.toLowerCase(Locale.ENGLISH): (metaData.storesUpperCaseIdentifiers()?_userTableName.toUpperCase(Locale.ENGLISH): _userTableName)); ResultSet result = metaData.getTables(null, null, tableName, null); if (!result.next()) { @@ -432,7 +433,7 @@ public class DataSourceLoginService extends MappedLoginService result.close(); - tableName = (metaData.storesLowerCaseIdentifiers()? _roleTableName.toLowerCase(): (metaData.storesUpperCaseIdentifiers()?_roleTableName.toUpperCase(): _roleTableName)); + tableName = (metaData.storesLowerCaseIdentifiers()? _roleTableName.toLowerCase(Locale.ENGLISH): (metaData.storesUpperCaseIdentifiers()?_roleTableName.toUpperCase(Locale.ENGLISH): _roleTableName)); result = metaData.getTables(null, null, tableName, null); if (!result.next()) { @@ -449,7 +450,7 @@ public class DataSourceLoginService extends MappedLoginService result.close(); - tableName = (metaData.storesLowerCaseIdentifiers()? _userRoleTableName.toLowerCase(): (metaData.storesUpperCaseIdentifiers()?_userRoleTableName.toUpperCase(): _userRoleTableName)); + tableName = (metaData.storesLowerCaseIdentifiers()? _userRoleTableName.toLowerCase(Locale.ENGLISH): (metaData.storesUpperCaseIdentifiers()?_userRoleTableName.toUpperCase(Locale.ENGLISH): _userRoleTableName)); result = metaData.getTables(null, null, tableName, null); if (!result.next()) { diff --git a/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ProxyRule.java b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ProxyRule.java index 67600700fe5..657eead9343 100644 --- a/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ProxyRule.java +++ b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ProxyRule.java @@ -24,6 +24,7 @@ import java.io.OutputStream; import java.net.MalformedURLException; import java.util.Enumeration; import java.util.HashSet; +import java.util.Locale; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -229,7 +230,7 @@ public class ProxyRule extends PatternRule @Override protected void onResponseHeader(Buffer name, Buffer value) throws IOException { - String s = name.toString().toLowerCase(); + String s = name.toString().toLowerCase(Locale.ENGLISH); if (!_DontProxyHeaders.contains(s) || (HttpHeaders.CONNECTION_BUFFER.equals(name) && HttpHeaderValues.CLOSE_BUFFER.equals(value))) { if (debug != 0) @@ -348,7 +349,7 @@ public class ProxyRule extends PatternRule String connectionHdr = request.getHeader("Connection"); if (connectionHdr != null) { - connectionHdr = connectionHdr.toLowerCase(); + connectionHdr = connectionHdr.toLowerCase(Locale.ENGLISH); if (connectionHdr.indexOf("keep-alive") < 0 && connectionHdr.indexOf("close") < 0) { connectionHdr = null; diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/FormAuthenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/FormAuthenticator.java index 829a9d595b0..26a080dbdb8 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/FormAuthenticator.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/FormAuthenticator.java @@ -21,6 +21,7 @@ package org.eclipse.jetty.security.authentication; import java.io.IOException; import java.util.Collections; import java.util.Enumeration; +import java.util.Locale; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; @@ -390,7 +391,7 @@ public class FormAuthenticator extends LoginAuthenticator @Override public long getDateHeader(String name) { - if (name.toLowerCase().startsWith("if-")) + if (name.toLowerCase(Locale.ENGLISH).startsWith("if-")) return -1; return super.getDateHeader(name); } @@ -398,7 +399,7 @@ public class FormAuthenticator extends LoginAuthenticator @Override public String getHeader(String name) { - if (name.toLowerCase().startsWith("if-")) + if (name.toLowerCase(Locale.ENGLISH).startsWith("if-")) return null; return super.getHeader(name); } @@ -412,7 +413,7 @@ public class FormAuthenticator extends LoginAuthenticator @Override public Enumeration getHeaders(String name) { - if (name.toLowerCase().startsWith("if-")) + if (name.toLowerCase(Locale.ENGLISH).startsWith("if-")) return Collections.enumeration(Collections.EMPTY_LIST); return super.getHeaders(name); } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/CookieCutter.java b/jetty-server/src/main/java/org/eclipse/jetty/server/CookieCutter.java index eb3e39aa373..65c93517404 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/CookieCutter.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/CookieCutter.java @@ -17,6 +17,8 @@ // package org.eclipse.jetty.server; +import java.util.Locale; + import javax.servlet.http.Cookie; import org.eclipse.jetty.util.LazyList; @@ -286,7 +288,7 @@ public class CookieCutter { if (name.startsWith("$")) { - String lowercaseName = name.toLowerCase(); + String lowercaseName = name.toLowerCase(Locale.ENGLISH); if ("$path".equals(lowercaseName)) { if (cookie!=null) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java index 5ffb6dd9dad..ecc84b22de7 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java @@ -34,6 +34,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.Random; import java.util.Timer; import java.util.TimerTask; @@ -124,7 +125,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager public DatabaseAdaptor (DatabaseMetaData dbMeta) throws SQLException { - _dbName = dbMeta.getDatabaseProductName().toLowerCase(); + _dbName = dbMeta.getDatabaseProductName().toLowerCase(Locale.ENGLISH); LOG.debug ("Using database {}",_dbName); _isLower = dbMeta.storesLowerCaseIdentifiers(); _isUpper = dbMeta.storesUpperCaseIdentifiers(); @@ -140,9 +141,9 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager public String convertIdentifier (String identifier) { if (_isLower) - return identifier.toLowerCase(); + return identifier.toLowerCase(Locale.ENGLISH); if (_isUpper) - return identifier.toUpperCase(); + return identifier.toUpperCase(Locale.ENGLISH); return identifier; } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java index d61eb1920ca..e44b9cdaf35 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.Socket; +import java.util.Locale; import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.eclipse.jetty.server.session.SessionHandler; @@ -54,7 +55,7 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest _handler.setSuspendFor(100); _handler.setResumeAfter(25); - assertTrue(process(null).toUpperCase().contains("RESUMED")); + assertTrue(process(null).toUpperCase(Locale.ENGLISH).contains("RESUMED")); } @Test @@ -68,7 +69,7 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest _server.start(); _handler.setSuspendFor(50); - assertTrue(process(null).toUpperCase().contains("TIMEOUT")); + assertTrue(process(null).toUpperCase(Locale.ENGLISH).contains("TIMEOUT")); } @Test @@ -83,7 +84,7 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest _handler.setSuspendFor(100); _handler.setCompleteAfter(25); - assertTrue(process(null).toUpperCase().contains("COMPLETED")); + assertTrue(process(null).toUpperCase(Locale.ENGLISH).contains("COMPLETED")); } private synchronized String process(String content) throws UnsupportedEncodingException, IOException, InterruptedException diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/AbstractConnectHandlerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/AbstractConnectHandlerTest.java index 1711fccce5c..a597e7b801b 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/AbstractConnectHandlerTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/AbstractConnectHandlerTest.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.net.Socket; import java.net.SocketTimeoutException; import java.util.LinkedHashMap; +import java.util.Locale; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -104,7 +105,7 @@ public abstract class AbstractConnectHandlerTest assertTrue(header.lookingAt()); String headerName = header.group(1); String headerValue = header.group(2); - headers.put(headerName.toLowerCase(), headerValue.toLowerCase()); + headers.put(headerName.toLowerCase(Locale.ENGLISH), headerValue.toLowerCase(Locale.ENGLISH)); } StringBuilder body; diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/IPAccessHandlerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/IPAccessHandlerTest.java index dd9750300bc..3bcf058d850 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/IPAccessHandlerTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/IPAccessHandlerTest.java @@ -30,6 +30,7 @@ import java.net.Socket; import java.util.Arrays; import java.util.Collection; import java.util.LinkedHashMap; +import java.util.Locale; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -152,7 +153,7 @@ public class IPAccessHandlerTest assertTrue(header.lookingAt()); String headerName = header.group(1); String headerValue = header.group(2); - headers.put(headerName.toLowerCase(), headerValue.toLowerCase()); + headers.put(headerName.toLowerCase(Locale.ENGLISH), headerValue.toLowerCase(Locale.ENGLISH)); } StringBuilder body = new StringBuilder(); 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 999ebf3286f..98ddb5fc228 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 @@ -21,6 +21,7 @@ package org.eclipse.jetty.servlet; import java.io.IOException; import java.util.Enumeration; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import javax.servlet.ServletContext; @@ -91,7 +92,7 @@ public class Invoker extends HttpServlet { String param=(String)e.nextElement(); String value=getInitParameter(param); - String lvalue=value.toLowerCase(); + String lvalue=value.toLowerCase(Locale.ENGLISH); if ("nonContextServlets".equals(param)) { _nonContextServlets=value.length()>0 && lvalue.startsWith("t"); diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/CGI.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/CGI.java index 7db012ab329..4c625088b7b 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/CGI.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/CGI.java @@ -24,6 +24,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.util.Enumeration; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import javax.servlet.ServletException; @@ -139,7 +140,7 @@ public class CGI extends HttpServlet if (!_env.envMap.containsKey("SystemRoot")) { String os = System.getProperty("os.name"); - if (os != null && os.toLowerCase().indexOf("windows") != -1) + if (os != null && os.toLowerCase(Locale.ENGLISH).indexOf("windows") != -1) { _env.set("SystemRoot","C:\\WINDOWS"); } @@ -256,7 +257,7 @@ public class CGI extends HttpServlet { String name = (String)enm.nextElement(); String value = req.getHeader(name); - env.set("HTTP_" + name.toUpperCase().replace('-','_'),value); + env.set("HTTP_" + name.toUpperCase(Locale.ENGLISH).replace('-','_'),value); } // these extra ones were from printenv on www.dev.nomura.co.uk diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/GzipFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/GzipFilter.java index 78d47cf2e84..27c930b2045 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/GzipFilter.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/GzipFilter.java @@ -20,6 +20,7 @@ package org.eclipse.jetty.servlets; import java.io.IOException; import java.util.HashSet; +import java.util.Locale; import java.util.Set; import java.util.StringTokenizer; import java.util.regex.Pattern; @@ -278,7 +279,7 @@ public class GzipFilter extends UserAgentFilter { for (int i=0; i< encodings.length; i++) { - if (encodings[i].toLowerCase().contains(GZIP)) + if (encodings[i].toLowerCase(Locale.ENGLISH).contains(GZIP)) { if (isEncodingAcceptable(encodings[i])) { @@ -287,7 +288,7 @@ public class GzipFilter extends UserAgentFilter } } - if (encodings[i].toLowerCase().contains(DEFLATE)) + if (encodings[i].toLowerCase(Locale.ENGLISH).contains(DEFLATE)) { if (isEncodingAcceptable(encodings[i])) { diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/MultiPartFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/MultiPartFilter.java index 2584b2f9f5b..bceb6b5efda 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/MultiPartFilter.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/MultiPartFilter.java @@ -36,6 +36,7 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.Map; import javax.servlet.Filter; @@ -172,7 +173,7 @@ public class MultiPartFilter implements Filter int c=line.indexOf(':',0); if(c>0) { - String key=line.substring(0,c).trim().toLowerCase(); + String key=line.substring(0,c).trim().toLowerCase(Locale.ENGLISH); String value=line.substring(c+1,line.length()).trim(); if(key.equals("content-disposition")) content_disposition=value; diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java index b908c5324f0..53eada5e20f 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java @@ -30,6 +30,7 @@ import java.util.Collections; import java.util.Enumeration; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.StringTokenizer; @@ -489,7 +490,7 @@ public class ProxyServlet implements Servlet protected void onResponseHeader(Buffer name, Buffer value) throws IOException { String nameString = name.toString(); - String s = nameString.toLowerCase(); + String s = nameString.toLowerCase(Locale.ENGLISH); if (!_DontProxyHeaders.contains(s) || (HttpHeaders.CONNECTION_BUFFER.equals(name) && HttpHeaderValues.CLOSE_BUFFER.equals(value))) { if (debug != 0) diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/PutFilterTest.java b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/PutFilterTest.java index 731a9794d21..300430791fb 100644 --- a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/PutFilterTest.java +++ b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/PutFilterTest.java @@ -28,6 +28,7 @@ import java.net.Socket; import java.net.URL; import java.util.Arrays; import java.util.HashSet; +import java.util.Locale; import java.util.Set; import javax.servlet.http.HttpServletResponse; @@ -61,7 +62,7 @@ public class PutFilterTest FilterHolder holder = tester.addFilter(PutFilter.class,"/*",0); holder.setInitParameter("delAllowed","true"); // Bloody Windows does not allow file renaming - if (!System.getProperty("os.name").toLowerCase().contains("windows")) + if (!System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows")) holder.setInitParameter("putAtomic","true"); tester.start(); } diff --git a/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/Headers.java b/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/Headers.java index 25d3047efe0..f5d434e1339 100644 --- a/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/Headers.java +++ b/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/Headers.java @@ -23,6 +23,7 @@ import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; +import java.util.Locale; import java.util.Map; import java.util.Set; @@ -93,7 +94,7 @@ public class Headers implements Iterable */ public Header get(String name) { - return headers.get(name.trim().toLowerCase()); + return headers.get(name.trim().toLowerCase(Locale.ENGLISH)); } /** @@ -106,7 +107,7 @@ public class Headers implements Iterable { name = name.trim(); Header header = new Header(name, value.trim()); - headers.put(name.toLowerCase(), header); + headers.put(name.toLowerCase(Locale.ENGLISH), header); } /** @@ -117,7 +118,7 @@ public class Headers implements Iterable public void put(Header header) { if (header != null) - headers.put(header.name().toLowerCase(), header); + headers.put(header.name().toLowerCase(Locale.ENGLISH), header); } /** @@ -130,16 +131,16 @@ public class Headers implements Iterable public void add(String name, String value) { name = name.trim(); - Header header = headers.get(name.toLowerCase()); + Header header = headers.get(name.toLowerCase(Locale.ENGLISH)); if (header == null) { header = new Header(name, value.trim()); - headers.put(name.toLowerCase(), header); + headers.put(name.toLowerCase(Locale.ENGLISH), header); } else { header = new Header(header.name(), header.value() + "," + value.trim()); - headers.put(name.toLowerCase(), header); + headers.put(name.toLowerCase(Locale.ENGLISH), header); } } @@ -152,7 +153,7 @@ public class Headers implements Iterable public Header remove(String name) { name = name.trim(); - return headers.remove(name.toLowerCase()); + return headers.remove(name.toLowerCase(Locale.ENGLISH)); } /** @@ -229,7 +230,7 @@ public class Headers implements Iterable @Override public int hashCode() { - int result = name.toLowerCase().hashCode(); + int result = name.toLowerCase(Locale.ENGLISH).hashCode(); result = 31 * result + Arrays.hashCode(values); return result; } diff --git a/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/HeadersBlockGenerator.java b/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/HeadersBlockGenerator.java index 3f78d1a928d..c273ba35057 100644 --- a/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/HeadersBlockGenerator.java +++ b/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/HeadersBlockGenerator.java @@ -21,6 +21,7 @@ package org.eclipse.jetty.spdy.generator; import java.io.ByteArrayOutputStream; import java.nio.ByteBuffer; import java.nio.charset.Charset; +import java.util.Locale; import org.eclipse.jetty.spdy.CompressionDictionary; import org.eclipse.jetty.spdy.CompressionFactory; @@ -45,7 +46,7 @@ public class HeadersBlockGenerator writeCount(version, buffer, headers.size()); for (Headers.Header header : headers) { - String name = header.name().toLowerCase(); + String name = header.name().toLowerCase(Locale.ENGLISH); byte[] nameBytes = name.getBytes(iso1); writeNameLength(version, buffer, nameBytes.length); buffer.write(nameBytes, 0, nameBytes.length); diff --git a/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ReferrerPushStrategy.java b/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ReferrerPushStrategy.java index a1938548412..5fc60853108 100644 --- a/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ReferrerPushStrategy.java +++ b/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ReferrerPushStrategy.java @@ -23,6 +23,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -205,7 +206,7 @@ public class ReferrerPushStrategy implements PushStrategy if (header == null) return true; - String contentType = header.value().toLowerCase(); + String contentType = header.value().toLowerCase(Locale.ENGLISH); for (String pushContentType : pushContentTypes) if (contentType.startsWith(pushContentType)) return true; diff --git a/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ServerHTTPSPDYAsyncConnection.java b/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ServerHTTPSPDYAsyncConnection.java index 01a82ca5593..9eb4f2b8a9d 100644 --- a/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ServerHTTPSPDYAsyncConnection.java +++ b/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ServerHTTPSPDYAsyncConnection.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.io.InterruptedIOException; import java.nio.ByteBuffer; import java.util.LinkedList; +import java.util.Locale; import java.util.Queue; import java.util.Set; import java.util.concurrent.BlockingQueue; @@ -664,7 +665,7 @@ public class ServerHTTPSPDYAsyncConnection extends AbstractHttpConnection implem for (int i = 0; i < fields.size(); ++i) { HttpFields.Field field = fields.getField(i); - String name = field.getName().toLowerCase(); + String name = field.getName().toLowerCase(Locale.ENGLISH); String value = field.getValue(); headers.put(name, value); logger.debug("HTTP < {}: {}", name, value); diff --git a/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/proxy/ProxyHTTPSPDYAsyncConnection.java b/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/proxy/ProxyHTTPSPDYAsyncConnection.java index f9e1e0ff130..4274ac64e30 100644 --- a/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/proxy/ProxyHTTPSPDYAsyncConnection.java +++ b/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/proxy/ProxyHTTPSPDYAsyncConnection.java @@ -21,6 +21,7 @@ package org.eclipse.jetty.spdy.proxy; import java.io.IOException; import java.nio.ByteBuffer; +import java.util.Locale; import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -95,7 +96,7 @@ public class ProxyHTTPSPDYAsyncConnection extends AsyncHttpConnection @Override protected void parsedHeader(Buffer name, Buffer value) throws IOException { - String headerName = name.toString("UTF-8").toLowerCase(); + String headerName = name.toString("UTF-8").toLowerCase(Locale.ENGLISH); String headerValue = value.toString("UTF-8"); switch (headerName) { diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Config.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Config.java index 0235a760cfc..f6249ccaf61 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Config.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Config.java @@ -38,6 +38,7 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Properties; import java.util.Set; @@ -269,7 +270,7 @@ public class Config } else { - String name = entry.getName().toLowerCase(); + String name = entry.getName().toLowerCase(Locale.ENGLISH); if (name.endsWith(".jar") || name.endsWith(".zip")) { String jar = entry.getCanonicalPath(); @@ -796,7 +797,7 @@ public class Config } // Add XML configuration - if (subject.toLowerCase().endsWith(".xml")) + if (subject.toLowerCase(Locale.ENGLISH).endsWith(".xml")) { // Config file File f = new File(fixPath(file)); @@ -807,7 +808,7 @@ public class Config } // Set the main class to execute (overrides any previously set) - if (subject.toLowerCase().endsWith(".class")) + if (subject.toLowerCase(Locale.ENGLISH).endsWith(".class")) { // Class String cn = expand(subject.substring(0,subject.length() - 6)); @@ -820,7 +821,7 @@ public class Config } // Add raw classpath entry - if (subject.toLowerCase().endsWith(".path")) + if (subject.toLowerCase(Locale.ENGLISH).endsWith(".path")) { // classpath (jetty.class.path?) to add to runtime classpath String cn = expand(subject.substring(0,subject.length() - 5)); diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java index 9726742630c..dabd5385f6f 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java @@ -46,6 +46,7 @@ import java.util.Collections; import java.util.Date; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Properties; import java.util.Set; @@ -154,7 +155,7 @@ public class Main { public boolean accept(File dir, String name) { - return name.toLowerCase().endsWith(".ini"); + return name.toLowerCase(Locale.ENGLISH).endsWith(".ini"); } }); Arrays.sort(inis); @@ -385,7 +386,7 @@ public class Main return false; } - String name = path.getName().toLowerCase(); + String name = path.getName(Locale.ENGLISH).toLowerCase(); return (name.startsWith("jetty") && name.endsWith(".xml")); } }); @@ -659,7 +660,7 @@ public class Main private String resolveXmlConfig(String xmlFilename) throws FileNotFoundException { - if (!xmlFilename.toLowerCase().endsWith(".xml")) + if (!xmlFilename.toLowerCase(Locale.ENGLISH).endsWith(".xml")) { // Nothing to resolve. return xmlFilename; @@ -873,7 +874,7 @@ public class Main if (element.isFile()) { - String name = element.getName().toLowerCase(); + String name = element.getName().toLowerCase(Locale.ENGLISH); if (name.endsWith(".jar")) { return JarVersion.getVersion(element); diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/RolloverFileOutputStream.java b/jetty-util/src/main/java/org/eclipse/jetty/util/RolloverFileOutputStream.java index a4d7ee7a13e..fffada8bd33 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/RolloverFileOutputStream.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/RolloverFileOutputStream.java @@ -27,6 +27,7 @@ import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; +import java.util.Locale; import java.util.TimeZone; import java.util.Timer; import java.util.TimerTask; @@ -221,7 +222,7 @@ public class RolloverFileOutputStream extends FilterOutputStream // Is this a rollover file? String filename=file.getName(); - int i=filename.toLowerCase().indexOf(YYYY_MM_DD); + int i=filename.toLowerCase(Locale.ENGLISH).indexOf(YYYY_MM_DD); if (i>=0) { file=new File(dir, @@ -258,7 +259,7 @@ public class RolloverFileOutputStream extends FilterOutputStream File file= new File(_filename); File dir = new File(file.getParent()); String fn=file.getName(); - int s=fn.toLowerCase().indexOf(YYYY_MM_DD); + int s=fn.toLowerCase(Locale.ENGLISH).indexOf(YYYY_MM_DD); if (s<0) return; String prefix=fn.substring(0,s); diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/ajax/JSONObjectConvertor.java b/jetty-util/src/main/java/org/eclipse/jetty/util/ajax/JSONObjectConvertor.java index 70e73e97786..f2e823deab9 100755 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/ajax/JSONObjectConvertor.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/ajax/JSONObjectConvertor.java @@ -22,6 +22,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Arrays; import java.util.HashSet; +import java.util.Locale; import java.util.Map; import java.util.Set; @@ -89,9 +90,9 @@ public class JSONObjectConvertor implements JSON.Convertor { String name=m.getName(); if (name.startsWith("is")) - name=name.substring(2,3).toLowerCase()+name.substring(3); + name=name.substring(2,3).toLowerCase(Locale.ENGLISH)+name.substring(3); else if (name.startsWith("get")) - name=name.substring(3,4).toLowerCase()+name.substring(4); + name=name.substring(3,4).toLowerCase(Locale.ENGLISH)+name.substring(4); else continue; diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/ajax/JSONPojoConvertor.java b/jetty-util/src/main/java/org/eclipse/jetty/util/ajax/JSONPojoConvertor.java index d49d4cfe8ec..ca2f5e93be6 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/ajax/JSONPojoConvertor.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/ajax/JSONPojoConvertor.java @@ -26,6 +26,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.Locale; import java.util.Map; import java.util.Set; @@ -122,9 +123,9 @@ public class JSONPojoConvertor implements JSON.Convertor if(m.getReturnType()!=null) { if (name.startsWith("is") && name.length()>2) - name=name.substring(2,3).toLowerCase()+name.substring(3); + name=name.substring(2,3).toLowerCase(Locale.ENGLISH)+name.substring(3); else if (name.startsWith("get") && name.length()>3) - name=name.substring(3,4).toLowerCase()+name.substring(4); + name=name.substring(3,4).toLowerCase(Locale.ENGLISH)+name.substring(4); else break; if(includeField(name, m)) diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JarScanner.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JarScanner.java index 4528e162923..0dfa1eefb9e 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JarScanner.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JarScanner.java @@ -23,6 +23,7 @@ import java.io.InputStream; import java.net.URI; import java.net.URL; import java.net.URLClassLoader; +import java.util.Locale; import java.util.jar.JarEntry; import java.util.jar.JarInputStream; import java.util.regex.Pattern; @@ -144,7 +145,7 @@ public abstract class JarScanner extends org.eclipse.jetty.util.PatternMatcher throws Exception { LOG.debug("Search of {}",uri); - if (uri.toString().toLowerCase().endsWith(".jar")) + if (uri.toString().toLowerCase(Locale.ENGLISH).endsWith(".jar")) { InputStream in = Resource.newResource(uri).getInputStream(); diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaInfConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaInfConfiguration.java index 4b9be461ceb..2190c30050c 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaInfConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaInfConfiguration.java @@ -22,6 +22,7 @@ package org.eclipse.jetty.webapp; import java.net.URI; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.jar.JarEntry; import org.eclipse.jetty.util.log.Log; @@ -125,7 +126,7 @@ public class MetaInfConfiguration extends AbstractConfiguration } else { - String lcname = name.toLowerCase(); + String lcname = name.toLowerCase(Locale.ENGLISH); if (lcname.endsWith(".tld")) { addResource(context,METAINF_TLDS,Resource.newResource("jar:"+jarUri+"!/"+name)); 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 af737d78ab2..cc308ed30f3 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 @@ -27,6 +27,7 @@ import java.util.EnumSet; import java.util.EventListener; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.Map; import javax.servlet.ServletException; @@ -320,7 +321,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor XmlParser.Node startup = node.get("load-on-startup"); if (startup != null) { - String s = startup.toString(false, true).toLowerCase(); + String s = startup.toString(false, true).toLowerCase(Locale.ENGLISH); int order = 0; if (s.startsWith("t")) { @@ -916,7 +917,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor if (data != null) { data = data.get("transport-guarantee"); - String guarantee = data.toString(false, true).toUpperCase(); + String guarantee = data.toString(false, true).toUpperCase(Locale.ENGLISH); if (guarantee == null || guarantee.length() == 0 || "NONE".equals(guarantee)) scBase.setDataConstraint(Constraint.DC_NONE); else if ("INTEGRAL".equals(guarantee)) diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/TagLibConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/TagLibConfiguration.java index 580f363f813..da47a9ab62f 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/TagLibConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/TagLibConfiguration.java @@ -28,6 +28,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; @@ -217,7 +218,7 @@ public class TagLibConfiguration extends AbstractConfiguration while(iter.hasNext()) { String location = iter.next(); - if (location!=null && location.toLowerCase().endsWith(".tld")) + if (location!=null && location.toLowerCase(Locale.ENGLISH).endsWith(".tld")) { if (!location.startsWith("/")) location="/WEB-INF/"+location; @@ -234,7 +235,7 @@ public class TagLibConfiguration extends AbstractConfiguration String[] contents = web_inf.list(); for (int i=0;contents!=null && i Date: Thu, 1 Nov 2012 19:12:36 -0700 Subject: [PATCH 48/56] Fixing compile issue. File.getName(Locale) is not allowed. --- jetty-start/src/main/java/org/eclipse/jetty/start/Main.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java index dabd5385f6f..7530f013420 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java @@ -386,7 +386,7 @@ public class Main return false; } - String name = path.getName(Locale.ENGLISH).toLowerCase(); + String name = path.getName().toLowerCase(); return (name.startsWith("jetty") && name.endsWith(".xml")); } }); From 13f6940fc3d19ef11ac2b5307fb5282f0d0d901e Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 2 Nov 2012 13:13:21 +1100 Subject: [PATCH 49/56] 393363 Use Locale.ENGLISH for all toUpperCase and toLowerCase calls --- jetty-start/src/main/java/org/eclipse/jetty/start/Main.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java index 7530f013420..3aa0483d23d 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java @@ -386,7 +386,7 @@ public class Main return false; } - String name = path.getName().toLowerCase(); + String name = path.getName().toLowerCase(Locale.ENGLISH); return (name.startsWith("jetty") && name.endsWith(".xml")); } }); From e076e8a8f0474fe0f539fc53297fa57056ab4cc8 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 2 Nov 2012 13:19:07 +1100 Subject: [PATCH 50/56] 393363 Use Locale.ENGLISH for all toUpperCase and toLowerCase calls --- .../boot/internal/webapp/LibExtClassLoaderHelper.java | 3 ++- .../eclipse/jetty/overlays/OverlayedAppProvider.java | 11 ++++++----- .../org/eclipse/jetty/rewrite/handler/ProxyRule.java | 2 +- .../java/org/eclipse/jetty/servlets/ProxyServlet.java | 4 ++-- .../src/main/java/org/eclipse/jetty/start/Main.java | 2 +- .../org/eclipse/jetty/util/MultiPartInputStream.java | 6 +++--- .../eclipse/jetty/util/ajax/JSONPojoConvertor.java | 2 +- .../src/main/java/org/eclipse/jetty/nested/Dump.java | 2 +- 8 files changed, 17 insertions(+), 15 deletions(-) diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/LibExtClassLoaderHelper.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/LibExtClassLoaderHelper.java index 6a3010db277..6e1f7b9b5af 100644 --- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/LibExtClassLoaderHelper.java +++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/LibExtClassLoaderHelper.java @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; @@ -109,7 +110,7 @@ public class LibExtClassLoaderHelper for (File f : jettyResources.listFiles()) { jettyResFiles.put(f.getName(), f); - if (f.getName().toLowerCase().startsWith("readme")) + if (f.getName().toLowerCase(Locale.ENGLISH).startsWith("readme")) { continue; } diff --git a/jetty-overlay-deployer/src/main/java/org/eclipse/jetty/overlays/OverlayedAppProvider.java b/jetty-overlay-deployer/src/main/java/org/eclipse/jetty/overlays/OverlayedAppProvider.java index 0a4cfb52cd4..1042a97bc79 100644 --- a/jetty-overlay-deployer/src/main/java/org/eclipse/jetty/overlays/OverlayedAppProvider.java +++ b/jetty-overlay-deployer/src/main/java/org/eclipse/jetty/overlays/OverlayedAppProvider.java @@ -32,6 +32,7 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Properties; import java.util.Set; @@ -389,7 +390,7 @@ public class OverlayedAppProvider extends AbstractLifeCycle implements AppProvid List libs = new ArrayList(); for (String jar :instance_lib.list()) { - if (!jar.toLowerCase().endsWith(".jar")) + if (!jar.toLowerCase(Locale.ENGLISH).endsWith(".jar")) continue; libs.add(instance_lib.addPath(jar).getURL()); } @@ -610,7 +611,7 @@ public class OverlayedAppProvider extends AbstractLifeCycle implements AppProvid { for (String jar :lib.list()) { - if (!jar.toLowerCase().endsWith(".jar")) + if (!jar.toLowerCase(Locale.ENGLISH).endsWith(".jar")) continue; libs.add(lib.addPath(jar).getURL()); } @@ -832,12 +833,12 @@ public class OverlayedAppProvider extends AbstractLifeCycle implements AppProvid File origin = new File(new URI(_scanDir.toURI()+ruri)); String name=origin.getName(); - Monitor monitor = Monitor.valueOf(origin.getParentFile().getName().toUpperCase()); + Monitor monitor = Monitor.valueOf(origin.getParentFile().getName().toUpperCase(Locale.ENGLISH)); String ext=".war"; // check directory vs archive - if (origin.isDirectory() || !origin.exists() && !ruri.toLowerCase().endsWith(ext)) + if (origin.isDirectory() || !origin.exists() && !ruri.toLowerCase(Locale.ENGLISH).endsWith(ext)) { // directories have priority over archives directory=origin; @@ -846,7 +847,7 @@ public class OverlayedAppProvider extends AbstractLifeCycle implements AppProvid else { // check extension name - if (!ruri.toLowerCase().endsWith(ext)) + if (!ruri.toLowerCase(Locale.ENGLISH).endsWith(ext)) continue; name=name.substring(0,name.length()-4); diff --git a/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ProxyRule.java b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ProxyRule.java index 657eead9343..f5a1598cf4c 100644 --- a/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ProxyRule.java +++ b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/ProxyRule.java @@ -371,7 +371,7 @@ public class ProxyRule extends PatternRule { // TODO could be better than this! String hdr = (String)enm.nextElement(); - String lhdr = hdr.toLowerCase(); + String lhdr = hdr.toLowerCase(Locale.ENGLISH); if (_DontProxyHeaders.contains(lhdr)) continue; diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java index 53eada5e20f..46fc4823a59 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java @@ -561,7 +561,7 @@ public class ProxyServlet implements Servlet String connectionHdr = request.getHeader("Connection"); if (connectionHdr != null) { - connectionHdr = connectionHdr.toLowerCase(); + connectionHdr = connectionHdr.toLowerCase(Locale.ENGLISH); if (connectionHdr.indexOf("keep-alive") < 0 && connectionHdr.indexOf("close") < 0) connectionHdr = null; } @@ -579,7 +579,7 @@ public class ProxyServlet implements Servlet { // TODO could be better than this! String hdr = (String)enm.nextElement(); - String lhdr = hdr.toLowerCase(); + String lhdr = hdr.toLowerCase(Locale.ENGLISH); if (_DontProxyHeaders.contains(lhdr)) continue; diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java index dabd5385f6f..3aa0483d23d 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java @@ -386,7 +386,7 @@ public class Main return false; } - String name = path.getName(Locale.ENGLISH).toLowerCase(); + String name = path.getName().toLowerCase(Locale.ENGLISH); return (name.startsWith("jetty") && name.endsWith(".xml")); } }); diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java b/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java index 4077ed28528..84944306319 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java @@ -181,7 +181,7 @@ public class MultiPartInputStream { if (name == null) return null; - return (String)_headers.getValue(name.toLowerCase(), 0); + return (String)_headers.getValue(name.toLowerCase(Locale.ENGLISH), 0); } /** @@ -505,7 +505,7 @@ public class MultiPartInputStream int c=line.indexOf(':',0); if(c>0) { - String key=line.substring(0,c).trim().toLowerCase(); + String key=line.substring(0,c).trim().toLowerCase(Locale.ENGLISH); String value=line.substring(c+1,line.length()).trim(); headers.put(key, value); if (key.equalsIgnoreCase("content-disposition")) @@ -531,7 +531,7 @@ public class MultiPartInputStream while(tok.hasMoreTokens()) { String t=tok.nextToken().trim(); - String tl=t.toLowerCase(); + String tl=t.toLowerCase(Locale.ENGLISH); if(t.startsWith("form-data")) form_data=true; else if(tl.startsWith("name=")) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/ajax/JSONPojoConvertor.java b/jetty-util/src/main/java/org/eclipse/jetty/util/ajax/JSONPojoConvertor.java index ca2f5e93be6..b0196fc49b5 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/ajax/JSONPojoConvertor.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/ajax/JSONPojoConvertor.java @@ -135,7 +135,7 @@ public class JSONPojoConvertor implements JSON.Convertor case 1: if (name.startsWith("set") && name.length()>3) { - name=name.substring(3,4).toLowerCase()+name.substring(4); + name=name.substring(3,4).toLowerCase(Locale.ENGLISH)+name.substring(4); if(includeField(name, m)) addSetter(name, m); } diff --git a/test-jetty-nested/src/main/java/org/eclipse/jetty/nested/Dump.java b/test-jetty-nested/src/main/java/org/eclipse/jetty/nested/Dump.java index cd6f9217a69..7a1a1558189 100644 --- a/test-jetty-nested/src/main/java/org/eclipse/jetty/nested/Dump.java +++ b/test-jetty-nested/src/main/java/org/eclipse/jetty/nested/Dump.java @@ -101,7 +101,7 @@ public class Dump extends HttpServlet final boolean flush= request.getParameter("flush")!=null?Boolean.parseBoolean(request.getParameter("flush")):false; - if(request.getPathInfo()!=null && request.getPathInfo().toLowerCase().indexOf("script")!=-1) + if(request.getPathInfo()!=null && request.getPathInfo().toLowerCase(Locale.ENGLISH).indexOf("script")!=-1) { response.sendRedirect(response.encodeRedirectURL(getServletContext().getContextPath() + "/dump/info")); return; From 36ddd3f5d628e2fc2d3a85e293f6f6c0f3593c59 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 5 Nov 2012 11:02:50 +1100 Subject: [PATCH 51/56] 393368 min websocket version --- .../jetty/client/WebSocketUpgradeTest.java | 1 + .../websocket/WebSocketConnectionD00.java | 2 ++ .../jetty/websocket/WebSocketFactory.java | 35 +++++++++++++++++-- .../jetty/websocket/WebSocketServlet.java | 7 ++++ .../websocket/SafariWebsocketDraft0Test.java | 4 ++- .../jetty/websocket/WebSocketLoadD08Test.java | 3 +- .../websocket/WebSocketLoadRFC6455Test.java | 2 +- .../websocket/WebSocketMessageD00Test.java | 1 + .../websocket/WebSocketMessageD06Test.java | 1 + .../websocket/WebSocketMessageD08Test.java | 1 + .../websocket/WebSocketServletRFCTest.java | 2 +- 11 files changed, 53 insertions(+), 6 deletions(-) diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/WebSocketUpgradeTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/WebSocketUpgradeTest.java index 7947a0beabf..108c77a2306 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/WebSocketUpgradeTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/WebSocketUpgradeTest.java @@ -214,6 +214,7 @@ public class WebSocketUpgradeTest return _websocket; } }; + _handler.getWebSocketFactory().setMinVersion(-1); _server.setHandler(_handler); _server.start(); diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD00.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD00.java index dd1ba46b8e1..a4e10bd32a6 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD00.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD00.java @@ -123,6 +123,8 @@ public class WebSocketConnectionD00 extends AbstractConnection implements WebSoc _endp.close(); break; } + else if (filled==0) + return this; } if (_websocket instanceof OnFrame) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketFactory.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketFactory.java index eca24b73e83..ae01166ed92 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketFactory.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketFactory.java @@ -81,16 +81,37 @@ public class WebSocketFactory extends AbstractLifeCycle private int _maxIdleTime = 300000; private int _maxTextMessageSize = 16 * 1024; private int _maxBinaryMessageSize = -1; + private int _minVersion; public WebSocketFactory(Acceptor acceptor) { - this(acceptor, 64 * 1024); + this(acceptor, 64 * 1024, WebSocketConnectionRFC6455.VERSION); } public WebSocketFactory(Acceptor acceptor, int bufferSize) + { + this(acceptor, bufferSize, WebSocketConnectionRFC6455.VERSION); + } + + public WebSocketFactory(Acceptor acceptor, int bufferSize, int minVersion) { _buffers = new WebSocketBuffers(bufferSize); _acceptor = acceptor; + _minVersion=WebSocketConnectionRFC6455.VERSION; + } + + public int getMinVersion() + { + return _minVersion; + } + + /* ------------------------------------------------------------ */ + /** + * @param minVersion The minimum support version (default RCF6455.VERSION == 13 ) + */ + public void setMinVersion(int minVersion) + { + _minVersion = minVersion; } /** @@ -227,6 +248,8 @@ public class WebSocketFactory extends AbstractLifeCycle } final WebSocketServletConnection connection; + if (draft<_minVersion) + draft=Integer.MAX_VALUE; switch (draft) { case -1: // unspecified draft/version @@ -263,7 +286,15 @@ public class WebSocketFactory extends AbstractLifeCycle LOG.warn("Unsupported Websocket version: " + draft); // Per RFC 6455 - 4.4 - Supporting Multiple Versions of WebSocket Protocol // Using the examples as outlined - response.setHeader("Sec-WebSocket-Version", "13, 8, 6, 0"); + String versions="13"; + if (_minVersion<=8) + versions+=", 8"; + if (_minVersion<=6) + versions+=", 6"; + if (_minVersion<=0) + versions+=", 0"; + + response.setHeader("Sec-WebSocket-Version", versions); throw new HttpException(400, "Unsupported websocket version specification: " + draft); } } diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServlet.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServlet.java index 3990ce4ddfd..d52c801900c 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServlet.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketServlet.java @@ -45,6 +45,9 @@ import org.eclipse.jetty.util.log.Logger; *

    * The initParameter "maxBinaryMessagesSize" can be used to set the size in bytes * that a websocket may be accept before closing. + *

    + * The initParameter "minVersion" can be used to set the minimum protocol version + * accepted. Default is the RFC6455 version (13) */ @SuppressWarnings("serial") public abstract class WebSocketServlet extends HttpServlet implements WebSocketFactory.Acceptor @@ -76,6 +79,10 @@ public abstract class WebSocketServlet extends HttpServlet implements WebSocketF max = getInitParameter("maxBinaryMessageSize"); if (max != null) _webSocketFactory.setMaxBinaryMessageSize(Integer.parseInt(max)); + + String min = getInitParameter("minVersion"); + if (min != null) + _webSocketFactory.setMinVersion(Integer.parseInt(min)); } catch (ServletException x) { diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/SafariWebsocketDraft0Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/SafariWebsocketDraft0Test.java index 5e59f32dcb5..67063501493 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/SafariWebsocketDraft0Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/SafariWebsocketDraft0Test.java @@ -62,7 +62,9 @@ public class SafariWebsocketDraft0Test // Serve capture servlet servlet = new WebSocketCaptureServlet(); - context.addServlet(new ServletHolder(servlet),"/"); + ServletHolder holder = new ServletHolder(servlet); + holder.setInitParameter("minVersion","-1"); + context.addServlet(holder,"/"); // Start Server server.start(); diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadD08Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadD08Test.java index d61b1ec6667..62500c45483 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadD08Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadD08Test.java @@ -72,6 +72,7 @@ public class WebSocketLoadD08Test return new EchoWebSocket(); } }; + wsHandler.getWebSocketFactory().setMinVersion(8); wsHandler.setHandler(new DefaultHandler()); _server.setHandler(wsHandler); @@ -196,7 +197,7 @@ public class WebSocketLoadD08Test "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n"+ "Sec-WebSocket-Origin: http://example.com\r\n"+ "Sec-WebSocket-Protocol: onConnect\r\n" + - "Sec-WebSocket-Version: 7\r\n"+ + "Sec-WebSocket-Version: 8\r\n"+ "\r\n"); output.flush(); diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadRFC6455Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadRFC6455Test.java index d119a13db03..514ce754122 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadRFC6455Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadRFC6455Test.java @@ -194,7 +194,7 @@ public class WebSocketLoadRFC6455Test "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n"+ "Sec-WebSocket-Origin: http://example.com\r\n"+ "Sec-WebSocket-Protocol: onConnect\r\n" + - "Sec-WebSocket-Version: 7\r\n"+ + "Sec-WebSocket-Version: 13\r\n"+ "\r\n"); output.flush(); diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD00Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD00Test.java index f3ab2e71c66..1042978974a 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD00Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD00Test.java @@ -80,6 +80,7 @@ public class WebSocketMessageD00Test return __serverWebSocket; } }; + wsHandler.getWebSocketFactory().setMinVersion(-1); wsHandler.setHandler(new DefaultHandler()); __server.setHandler(wsHandler); __server.start(); diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD06Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD06Test.java index 45f7791f727..2ce05d1c923 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD06Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD06Test.java @@ -66,6 +66,7 @@ public class WebSocketMessageD06Test return _serverWebSocket; } }; + wsHandler.getWebSocketFactory().setMinVersion(6); wsHandler.getWebSocketFactory().setBufferSize(8192); wsHandler.getWebSocketFactory().setMaxIdleTime(1000); wsHandler.setHandler(new DefaultHandler()); diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD08Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD08Test.java index e43e30deb26..971f26f4790 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD08Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD08Test.java @@ -77,6 +77,7 @@ public class WebSocketMessageD08Test return __serverWebSocket; } }; + wsHandler.getWebSocketFactory().setMinVersion(8); wsHandler.getWebSocketFactory().setBufferSize(8192); wsHandler.getWebSocketFactory().setMaxIdleTime(1000); wsHandler.setHandler(new DefaultHandler()); diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketServletRFCTest.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketServletRFCTest.java index 8296b1a9b2c..f03aba618bd 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketServletRFCTest.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketServletRFCTest.java @@ -180,7 +180,7 @@ public class WebSocketServletRFCTest // System.out.println("RESPONSE: " + respHeader); Assert.assertThat("Response Code",respHeader,startsWith("HTTP/1.1 400 Unsupported websocket version specification")); - Assert.assertThat("Response Header Versions",respHeader,containsString("Sec-WebSocket-Version: 13, 8, 6, 0\r\n")); + Assert.assertThat("Response Header Versions",respHeader,containsString("Sec-WebSocket-Version: 13\r\n")); } finally { From fff825a9979b7d1c6127a0fe274536a269c42c7b Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 5 Nov 2012 16:26:20 +1100 Subject: [PATCH 52/56] 393494 HashSessionManager can't delete unrestorable sessions on Windows --- .../server/session/HashSessionManager.java | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java index 7f888a99d72..0f789328fd5 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java @@ -482,32 +482,40 @@ public class HashSessionManager extends AbstractSessionManager protected synchronized HashedSession restoreSession(String idInCuster) { File file = new File(_storeDir,idInCuster); + FileInputStream in = null; + Exception error = null; try { if (file.exists()) { - FileInputStream in = new FileInputStream(file); + in = new FileInputStream(file); HashedSession session = restoreSession(in, null); - in.close(); addSession(session, false); session.didActivate(); - file.delete(); return session; } } catch (Exception e) { - - if (isDeleteUnrestorableSessions()) + error = e; + } + finally + { + if (in != null) + try {in.close();} catch (Exception x) {__log.ignore(x);} + + if (error != null) { - if (file.exists()) + if (isDeleteUnrestorableSessions() && file.exists()) { file.delete(); - __log.warn("Deleting file for unrestorable session "+idInCuster, e); + __log.warn("Deleting file for unrestorable session "+idInCuster, error); } + else + __log.warn("Problem restoring session "+idInCuster, error); } else - __log.warn("Problem restoring session "+idInCuster, e); + file.delete(); //delete successfully restored file } return null; From 55de6fc6e425a7bdfdc550f460e821f26b156d54 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Mon, 5 Nov 2012 11:31:11 -0600 Subject: [PATCH 53/56] add import for Locale --- .../main/java/org/eclipse/jetty/util/MultiPartInputStream.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java b/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java index 84944306319..86c02b4cb74 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartInputStream.java @@ -37,6 +37,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.StringTokenizer; From c1f06f9329e717503ea1a67f61573d1d2f5a9bc6 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 5 Nov 2012 10:37:00 -0700 Subject: [PATCH 54/56] Moving license check to default build for top-level only --- pom.xml | 77 ++++++++++++++++++++++++++------------------------------- 1 file changed, 35 insertions(+), 42 deletions(-) diff --git a/pom.xml b/pom.xml index 826feab40a8..c3d9688546e 100644 --- a/pom.xml +++ b/pom.xml @@ -299,6 +299,41 @@ org.apache.maven.plugins maven-pmd-plugin + + false + com.mycila.maven-license-plugin + maven-license-plugin + 1.10.b1 + +

    header-template.txt
    + true + true + true + + ${project.inceptionYear}-2012 + + + DOUBLESLASH_STYLE + + + **/*.java + + + jetty-util/src/main/java/org/eclipse/jetty/util/security/UnixCrypt.java + jetty-policy/src/main/java/org/eclipse/jetty/policy/loader/DefaultPolicyLoader.java + jetty-policy/src/main/java/org/eclipse/jetty/policy/loader/PolicyFileScanner.java + + + + + check-headers + verify + + check + + + + @@ -727,47 +762,5 @@ - - license-check - - - - false - com.mycila.maven-license-plugin - maven-license-plugin - 1.10.b1 - -
    header-template.txt
    - true - true - true - - ${project.inceptionYear}-2012 - - - DOUBLESLASH_STYLE - - - **/*.java - - - jetty-util/src/main/java/org/eclipse/jetty/util/security/UnixCrypt.java - jetty-policy/src/main/java/org/eclipse/jetty/policy/loader/DefaultPolicyLoader.java - jetty-policy/src/main/java/org/eclipse/jetty/policy/loader/PolicyFileScanner.java - -
    - - - check-headers - verify - - check - - - -
    -
    -
    -
    From 7b3a15a4036005ac6ed864b570192ae90ce3e026 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 5 Nov 2012 10:39:52 -0700 Subject: [PATCH 55/56] Fixing license-check plugin scope --- pom.xml | 70 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/pom.xml b/pom.xml index c3d9688546e..2a07c6b4f1c 100644 --- a/pom.xml +++ b/pom.xml @@ -196,6 +196,41 @@ + + false + com.mycila.maven-license-plugin + maven-license-plugin + 1.10.b1 + +
    header-template.txt
    + true + true + true + + ${project.inceptionYear}-2012 + + + DOUBLESLASH_STYLE + + + **/*.java + + + jetty-util/src/main/java/org/eclipse/jetty/util/security/UnixCrypt.java + jetty-policy/src/main/java/org/eclipse/jetty/policy/loader/DefaultPolicyLoader.java + jetty-policy/src/main/java/org/eclipse/jetty/policy/loader/PolicyFileScanner.java + +
    + + + check-headers + verify + + check + + + +
    @@ -299,41 +334,6 @@ org.apache.maven.plugins maven-pmd-plugin - - false - com.mycila.maven-license-plugin - maven-license-plugin - 1.10.b1 - -
    header-template.txt
    - true - true - true - - ${project.inceptionYear}-2012 - - - DOUBLESLASH_STYLE - - - **/*.java - - - jetty-util/src/main/java/org/eclipse/jetty/util/security/UnixCrypt.java - jetty-policy/src/main/java/org/eclipse/jetty/policy/loader/DefaultPolicyLoader.java - jetty-policy/src/main/java/org/eclipse/jetty/policy/loader/PolicyFileScanner.java - -
    - - - check-headers - verify - - check - - - -
    From 53f1892f7b9e27fdba1139a7c38e32d601ee5c40 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 5 Nov 2012 10:40:20 -0700 Subject: [PATCH 56/56] Fixing license header --- .../test/java/org/eclipse/jetty/websocket/dummy/DummyServer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/dummy/DummyServer.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/dummy/DummyServer.java index 9b41e51e2fa..1a9ff16fcd4 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/dummy/DummyServer.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/dummy/DummyServer.java @@ -15,6 +15,7 @@ // You may elect to redistribute this code under either of these licenses. // ======================================================================== // + package org.eclipse.jetty.websocket.dummy; import static org.hamcrest.Matchers.*;