From ff67b376fd433641b3a2c4413ca970ff1cfa202d Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 28 May 2019 13:56:33 +0200 Subject: [PATCH 1/5] Cleanup webappconfiguration Signed-off-by: Greg Wilkins --- .../eclipse/jetty/webapp/WebAppConfiguration.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppConfiguration.java index e02d6ba14f10..a3f58df5cb54 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppConfiguration.java @@ -32,14 +32,10 @@ public WebAppConfiguration() addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class); addDependents(JettyWebXmlConfiguration.class); protectAndExpose( - "org.eclipse.jetty.util.log.", - "org.eclipse.jetty.server.session.SessionData", - "org.eclipse.jetty.servlet.StatisticsServlet", + "org.eclipse.jetty.servlet.StatisticsServlet", "org.eclipse.jetty.servlet.DefaultServlet", - "org.eclipse.jetty.servlet.NoJspServlet", - "org.eclipse.jetty.continuation."); - expose( // TODO Evaluate why these are not protectAndExpose? - "org.eclipse.jetty.servlet.listener.", - "org.eclipse.jetty.alpn."); + "org.eclipse.jetty.servlet.NoJspServlet" + ); + expose("org.eclipse.jetty.servlet.listener."); } } From 646fa4fb5b89cab3d14a02bc8a96167957b9cb72 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 28 May 2019 17:07:48 +0200 Subject: [PATCH 2/5] formatting fix Signed-off-by: Greg Wilkins --- .../src/main/java/org/eclipse/jetty/servlet/FilterMapping.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/FilterMapping.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/FilterMapping.java index c6cc1da109b6..203f109e8e35 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/FilterMapping.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/FilterMapping.java @@ -149,7 +149,7 @@ boolean appliesTo(String path, int type) boolean appliesTo(int type) { if (_dispatches==0) - return type==REQUEST || type==ASYNC && _holder.isAsyncSupported(); + return type==REQUEST || type==ASYNC && _holder.isAsyncSupported(); return (_dispatches&type)!=0; } From cf9a1f98e1ba1941619a80593652dbbcb6786589 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 29 May 2019 17:15:09 +0200 Subject: [PATCH 3/5] cleanup examples and OSGi Signed-off-by: Greg Wilkins --- .../src/main/webapp/WEB-INF/jetty-web.xml | 4 ++-- .../jetty/osgi/test/TestJettyOSGiBootWithAnnotations.java | 2 ++ .../test-jaas-webapp/src/main/webapp/WEB-INF/jetty-web.xml | 4 ++-- tests/test-webapps/test-jetty-webapp/pom.xml | 1 + .../src/main/webapp/WEB-INF/jetty-web.xml | 5 +++-- .../test-jndi-webapp/src/main/webapp/WEB-INF/jetty-web.xml | 4 ++-- .../src/main/webapp/WEB-INF/jetty-web.xml | 3 +++ .../test-servlet-spec/test-spec-webapp/pom.xml | 7 +------ .../test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml | 5 ++++- 9 files changed, 20 insertions(+), 15 deletions(-) diff --git a/examples/async-rest/async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/examples/async-rest/async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml index c15dc38f119a..edff91dd75fe 100644 --- a/examples/async-rest/async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/examples/async-rest/async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -9,7 +9,7 @@ org.eclipse.jetty.servlet.WebApplicationContext object --> - - async-rest webapp is deployed. DO NOT USE IN PRODUCTION! + + The async-rest webapp is deployed. DO NOT USE IN PRODUCTION! diff --git a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWithAnnotations.java b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWithAnnotations.java index f6e0a307b676..fd54d4f091d6 100644 --- a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWithAnnotations.java +++ b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWithAnnotations.java @@ -67,6 +67,8 @@ public static Option[] configure() "com.sun.org.apache.xpath.internal.jaxp", "com.sun.org.apache.xpath.internal.objects")); options.addAll(TestOSGiUtil.coreJettyDependencies()); + options.add(mavenBundle().groupId("javax.servlet").artifactId("javax.servlet-api").version("3.1.0").noStart()); + options.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-util").version("9.3.0.RC0").noStart()); options.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-alpn-java-client").versionAsInProject().start()); options.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-alpn-client").versionAsInProject().start()); options.add(systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value(LOG_LEVEL)); diff --git a/tests/test-webapps/test-jaas-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/tests/test-webapps/test-jaas-webapp/src/main/webapp/WEB-INF/jetty-web.xml index ecd5e307bb01..f782fdea14b7 100644 --- a/tests/test-webapps/test-jaas-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/tests/test-webapps/test-jaas-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -2,7 +2,7 @@ - - test-jaas webapp is deployed. DO NOT USE IN PRODUCTION! + + The test-jaas webapp is deployed. DO NOT USE IN PRODUCTION! diff --git a/tests/test-webapps/test-jetty-webapp/pom.xml b/tests/test-webapps/test-jetty-webapp/pom.xml index 43cbb3918800..ef64ecfb3fee 100644 --- a/tests/test-webapps/test-jetty-webapp/pom.xml +++ b/tests/test-webapps/test-jetty-webapp/pom.xml @@ -141,6 +141,7 @@ org.eclipse.jetty jetty-servlets ${project.version} + provided org.eclipse.jetty.toolchain diff --git a/tests/test-webapps/test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/tests/test-webapps/test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml index dd7a9e572bba..7f0b1fed8304 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/tests/test-webapps/test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -19,7 +19,8 @@ org.eclipse.jetty.servlet.WebApplicationContext object - - test webapp is deployed. DO NOT USE IN PRODUCTION! + + + The test-jetty webapp is deployed. DO NOT USE IN PRODUCTION! diff --git a/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-web.xml index 203f811885ae..a0b5b042d2a6 100644 --- a/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -2,7 +2,7 @@ - - test-jndi webapp is deployed. DO NOT USE IN PRODUCTION! + + The test-jndi webapp is deployed. DO NOT USE IN PRODUCTION! diff --git a/tests/test-webapps/test-proxy-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/tests/test-webapps/test-proxy-webapp/src/main/webapp/WEB-INF/jetty-web.xml index e2cb8ec33c49..e84ac1b83776 100644 --- a/tests/test-webapps/test-proxy-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/tests/test-webapps/test-proxy-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -2,5 +2,8 @@ + + The test-proxy webapp is deployed. DO NOT USE IN PRODUCTION! + /proxy diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml b/tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml index fc3af8ed2c5e..87f720d99dd8 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml @@ -76,6 +76,7 @@ javax.transaction*;version="[1.1,1.3)", javax.servlet*;version="[2.6,4.1)", + org.eclipse.jetty.util;version="[9.3.0.RC0,9.3.1)", org.eclipse.jetty*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))", org.eclipse.jetty.webapp;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:="optional", org.eclipse.jetty.plus.jndi;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:="optional", @@ -199,12 +200,6 @@ jakarta.transaction-api provided - - org.eclipse.jetty - jetty-server - ${project.version} - provided - org.eclipse.jetty.toolchain jetty-servlet-api diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml index e360f5c202a5..719d77742489 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -2,7 +2,10 @@ + + The test-spec webapp is deployed. DO NOT USE IN PRODUCTION! + - test-spec webapp is deployed. DO NOT USE IN PRODUCTION! + WEB-INF/lib/jetty-util.jar logging used! From 52c332aae90745bad19c40bbc636c7081715ee07 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 3 Jun 2019 17:52:12 +0200 Subject: [PATCH 4/5] disable classloader test until 9.4.19 is released with #3726 is fixed Signed-off-by: Greg Wilkins --- .../TestJettyOSGiBootWithAnnotations.java | 4 +- .../test-spec-webapp/pom.xml | 43 +++++++++++-------- .../com/acme/test/ClassLoaderServlet.java | 5 ++- .../java/com/acme/test/MultiPartTest.java | 24 ++++++++--- 4 files changed, 49 insertions(+), 27 deletions(-) diff --git a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWithAnnotations.java b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWithAnnotations.java index fd54d4f091d6..4cfd2b58a6c4 100644 --- a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWithAnnotations.java +++ b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWithAnnotations.java @@ -67,8 +67,8 @@ public static Option[] configure() "com.sun.org.apache.xpath.internal.jaxp", "com.sun.org.apache.xpath.internal.objects")); options.addAll(TestOSGiUtil.coreJettyDependencies()); - options.add(mavenBundle().groupId("javax.servlet").artifactId("javax.servlet-api").version("3.1.0").noStart()); - options.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-util").version("9.3.0.RC0").noStart()); + // TODO uncomment and update the following once 9.4.19 is released with a fix for #3726 + // options.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-util").version("9.4.19.v????????").noStart()); options.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-alpn-java-client").versionAsInProject().start()); options.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-alpn-client").versionAsInProject().start()); options.add(systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value(LOG_LEVEL)); diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml b/tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml index 87f720d99dd8..a47b61c39a39 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml @@ -73,10 +73,10 @@ org.eclipse.jetty.tests.test-spec-webapp Test Webapp for Servlet 3.1 Features + javax.transaction*;version="[1.1,1.3)", javax.servlet*;version="[2.6,4.1)", - org.eclipse.jetty.util;version="[9.3.0.RC0,9.3.1)", org.eclipse.jetty*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))", org.eclipse.jetty.webapp;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:="optional", org.eclipse.jetty.plus.jndi;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:="optional", @@ -210,21 +210,30 @@ jakarta.annotation-api provided - - org.eclipse.jetty.tests - test-web-fragment - ${project.version} - - - org.eclipse.jetty.tests - test-container-initializer - ${project.version} - - - org.eclipse.jetty - jetty-util - - 9.3.0.RC0 - + + org.eclipse.jetty.tests + test-web-fragment + ${project.version} + + + org.eclipse.jetty.tests + test-container-initializer + ${project.version} + + + + diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/ClassLoaderServlet.java b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/ClassLoaderServlet.java index ad348ff2a0de..0b7ce45b78b7 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/ClassLoaderServlet.java +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/ClassLoaderServlet.java @@ -31,8 +31,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.util.IO; - @WebServlet(urlPatterns="/classloader") public class ClassLoaderServlet extends HttpServlet { @@ -48,6 +46,8 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) writer.println(""); writer.println("

ClassLoader Isolation Test

"); + // TODO uncomment the following once 9.4.19 is released with a fix for #3726 + /* Class webappIO = IO.class; URI webappURI = getLocationOfClass(webappIO); String webappVersion = webappIO.getPackage().getImplementationVersion(); @@ -65,6 +65,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) writer.println("
URI Result: FAIL

"); else writer.println("
URI Result: PASS

"); + */ writer.println(""); writer.println(""); diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/MultiPartTest.java b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/MultiPartTest.java index ad1b1cabdbce..7af45a30a1c0 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/MultiPartTest.java +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/MultiPartTest.java @@ -19,6 +19,8 @@ package com.acme.test; import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.util.Collection; import javax.servlet.ServletConfig; @@ -30,7 +32,6 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; -import org.eclipse.jetty.util.IO; /** * MultiPartTest * @@ -58,7 +59,6 @@ public void init(ServletConfig config) throws ServletException @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - try { response.setContentType("text/html"); @@ -78,7 +78,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr if (p.getContentType() == null || p.getContentType().startsWith("text/plain")) { out.println("

"); - IO.copy(p.getInputStream(),out); + copy(p.getInputStream(),out); out.println("

"); } } @@ -116,8 +116,20 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) thro throw new ServletException(e); } } - - - + public static void copy(InputStream in, + OutputStream out) + throws IOException + { + int bufferSize = 8192; + byte buffer[] = new byte[bufferSize]; + + while (true) + { + int len=in.read(buffer,0,bufferSize); + if (len<0 ) + break; + out.write(buffer,0,len); + } + } } From 4062cde036a154966b70eb1ca165380b7c30c994 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 4 Jun 2019 16:42:46 +0200 Subject: [PATCH 5/5] cleanup from review Signed-off-by: Greg Wilkins --- .../src/main/java/com/acme/test/MultiPartTest.java | 1 + .../test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/MultiPartTest.java b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/MultiPartTest.java index 7af45a30a1c0..e92abd8fa6b4 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/MultiPartTest.java +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/MultiPartTest.java @@ -117,6 +117,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) thro } } + // TODO remove inline once 9.4.19 is released with a fix for #3726 public static void copy(InputStream in, OutputStream out) throws IOException diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml index 719d77742489..0938b414ccfc 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -5,7 +5,9 @@ The test-spec webapp is deployed. DO NOT USE IN PRODUCTION! +