diff --git a/apache-jsp/pom.xml b/apache-jsp/pom.xml index 5f48eb85315..e3ca6a2c6e2 100644 --- a/apache-jsp/pom.xml +++ b/apache-jsp/pom.xml @@ -11,6 +11,7 @@ ${project.groupId}.apache-jsp + true @@ -52,13 +53,6 @@ - - org.jacoco - jacoco-maven-plugin - - true - - diff --git a/apache-jstl/pom.xml b/apache-jstl/pom.xml index 59672a49ebf..925898bb697 100644 --- a/apache-jstl/pom.xml +++ b/apache-jstl/pom.xml @@ -11,6 +11,7 @@ jar ${project.groupId}.apache.jstl + true @@ -22,13 +23,6 @@ false - - org.jacoco - jacoco-maven-plugin - - true - - diff --git a/jetty-ant/pom.xml b/jetty-ant/pom.xml index ac189780ddf..bd0597fbd5b 100644 --- a/jetty-ant/pom.xml +++ b/jetty-ant/pom.xml @@ -11,6 +11,7 @@ ${project.groupId}.ant + true @@ -48,13 +49,6 @@ - - org.jacoco - jacoco-maven-plugin - - true - - diff --git a/jetty-gcloud/pom.xml b/jetty-gcloud/pom.xml index dc7479d15a7..0979e3091de 100644 --- a/jetty-gcloud/pom.xml +++ b/jetty-gcloud/pom.xml @@ -13,7 +13,7 @@ Jetty :: GCloud - 2.2.4 + 2.2.9 diff --git a/jetty-home/src/main/resources/bin/jetty.sh b/jetty-home/src/main/resources/bin/jetty.sh index 1158a0ae04c..1c389045853 100755 --- a/jetty-home/src/main/resources/bin/jetty.sh +++ b/jetty-home/src/main/resources/bin/jetty.sh @@ -136,9 +136,9 @@ started() for ((T = 0; T < $(($3 / 4)); T++)) do sleep 4 - [ -z "$(grep STARTED $1 2>/dev/null)" ] || return 0 - [ -z "$(grep STOPPED $1 2>/dev/null)" ] || return 1 - [ -z "$(grep FAILED $1 2>/dev/null)" ] || return 1 + [ -z "$(tail -1 $1 | grep STARTED 2>/dev/null)" ] || return 0 + [ -z "$(tail -1 $1 | grep STOPPED 2>/dev/null)" ] || return 1 + [ -z "$(tail -1 $1 | grep FAILED 2>/dev/null)" ] || return 1 local PID=$(cat "$2" 2>/dev/null) || return 1 kill -0 "$PID" 2>/dev/null || return 1 echo -n ". " diff --git a/jetty-home/src/main/resources/modules/jminix.mod b/jetty-home/src/main/resources/modules/jminix.mod deleted file mode 100644 index c3d6f7f71bb..00000000000 --- a/jetty-home/src/main/resources/modules/jminix.mod +++ /dev/null @@ -1,46 +0,0 @@ -# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html - -[description] -Deploys the Jminix JMX Console within the server. - -[tags] -3rdparty - -[depend] -stats -jmx -commons-logging - -[xml] -etc/jminix.xml - -[files] -lib/jminix/ -maven://org.jminix/jminix/1.1.0|lib/jminix/jminix-1.1.0.jar -https://maven.restlet.talend.com/org/restlet/org.restlet/1.1.5/org.restlet-1.1.5.jar|lib/jminix/org.restlet-1.1.5.jar -https://maven.restlet.talend.com/org/restlet/org.restlet.ext.velocity/1.1.5/org.restlet.ext.velocity-1.1.5.jar|lib/jminix/org.restlet.ext.velocity-1.1.5.jar -maven://org.apache.velocity/velocity/1.5|lib/jminix/velocity-1.5.jar -maven://oro/oro/2.0.8|lib/jminix/oro-2.0.8.jar -https://maven.restlet.talend.com/com/noelios/restlet/com.noelios.restlet/1.1.5/com.noelios.restlet-1.1.5.jar|lib/jminix/com.noelios.restlet-1.1.5.jar -https://maven.restlet.talend.com/com/noelios/restlet/com.noelios.restlet.ext.servlet/1.1.5/com.noelios.restlet.ext.servlet-1.1.5.jar|lib/jminix/com.noelios.restlet.ext.servlet-1.1.5.jar -maven://net.sf.json-lib/json-lib/2.2.3/jar/jdk15|lib/jminix/json-lib-2.2.3-jdk15.jar -maven://commons-lang/commons-lang/2.4|lib/jminix/commons-lang-2.4.jar -maven://commons-beanutils/commons-beanutils/1.7.0|lib/jminix/commons-beanutils-1.7.0.jar -maven://commons-collections/commons-collections/3.2|lib/jminix/commons-collections-3.2.jar -maven://net.sf.ezmorph/ezmorph/1.0.6|lib/jminix/ezmorph-1.0.6.jar -maven://org.jgroups/jgroups/2.12.1.3.Final|lib/jminix/jgroups-2.12.1.3.Final.jar -maven://org.jasypt/jasypt/1.8|lib/jminix/jasypt-1.8.jar -basehome:modules/jminix/jminix.xml|etc/jminix.xml - -[lib] -lib/jminix/**.jar - -[license] -JMiniX is a hosted at google code and released under the Apache License 2.0 -https://code.google.com/p/jminix/ -http://www.apache.org/licenses/LICENSE-2.0 - -[ini-template] -## Jminix Configuration -# jminix.port=8088 - diff --git a/jetty-home/src/main/resources/modules/jminix/jminix.xml b/jetty-home/src/main/resources/modules/jminix/jminix.xml deleted file mode 100644 index 933de82b697..00000000000 --- a/jetty-home/src/main/resources/modules/jminix/jminix.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml index 7c28f051663..a4063352548 100644 --- a/jetty-http-spi/pom.xml +++ b/jetty-http-spi/pom.xml @@ -10,6 +10,7 @@ ${project.groupId}.http.spi org.eclipse.jetty.http.spi.* + true @@ -80,13 +81,6 @@ - - org.jacoco - jacoco-maven-plugin - - true - - diff --git a/jetty-jspc-maven-plugin/pom.xml b/jetty-jspc-maven-plugin/pom.xml index a36748cff26..b436db8b597 100644 --- a/jetty-jspc-maven-plugin/pom.xml +++ b/jetty-jspc-maven-plugin/pom.xml @@ -11,16 +11,10 @@ Jetty :: Jetty JSPC Maven Plugin ${project.groupId}.jspc.plugin + true - - org.apache.maven.plugins - maven-surefire-plugin - - true - - org.apache.maven.plugins maven-plugin-plugin @@ -35,13 +29,6 @@ - - org.jacoco - jacoco-maven-plugin - - true - - org.apache.maven.plugins maven-invoker-plugin @@ -133,53 +120,4 @@ ant - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - - false - - - - - team - mailing-lists - ci-management - issue-management - licenses - scm - - - - - - org.apache.maven.plugins - maven-plugin-plugin - - - - - - eclipse-release - - - - org.apache.maven.plugins - maven-site-plugin - - - site-jar - - jar - - package - - - - - - - diff --git a/jetty-maven-plugin/pom.xml b/jetty-maven-plugin/pom.xml index 0c6a0386a73..ea7da834a71 100644 --- a/jetty-maven-plugin/pom.xml +++ b/jetty-maven-plugin/pom.xml @@ -13,6 +13,7 @@ ${project.groupId}.maven.plugin FREEBEER + true @@ -110,13 +111,6 @@ - - org.jacoco - jacoco-maven-plugin - - true - - @@ -373,50 +367,4 @@ test - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - - - - team - mailing-lists - ci-management - issue-management - licenses - scm - - - - - - org.apache.maven.plugins - maven-plugin-plugin - - - - - - eclipse-release - - - - org.apache.maven.plugins - maven-site-plugin - - - site-jar - - jar - - package - - - - - - - diff --git a/jetty-osgi/pom.xml b/jetty-osgi/pom.xml index cb153805924..c75dade73ce 100644 --- a/jetty-osgi/pom.xml +++ b/jetty-osgi/pom.xml @@ -12,10 +12,11 @@ pom - 3.17.100 + 3.17.200 3.10.200 3.6.100 1.0.0-v20070606 + true @@ -72,13 +73,6 @@ - - org.jacoco - jacoco-maven-plugin - - true - - diff --git a/jetty-p2/pom.xml b/jetty-p2/pom.xml index c5d9bb5a460..28090d0fb5c 100644 --- a/jetty-p2/pom.xml +++ b/jetty-p2/pom.xml @@ -12,7 +12,7 @@ Generates a (maven based) P2 Updatesite pom - 2.6.0 + 2.7.0 diff --git a/jetty-quic/quic-quiche/quic-quiche-foreign-incubator/src/main/java/org/eclipse/jetty/quic/quiche/foreign/incubator/quiche_h.java b/jetty-quic/quic-quiche/quic-quiche-foreign-incubator/src/main/java/org/eclipse/jetty/quic/quiche/foreign/incubator/quiche_h.java index 8a4fa08d62f..af8584f1881 100644 --- a/jetty-quic/quic-quiche/quic-quiche-foreign-incubator/src/main/java/org/eclipse/jetty/quic/quiche/foreign/incubator/quiche_h.java +++ b/jetty-quic/quic-quiche/quic-quiche-foreign-incubator/src/main/java/org/eclipse/jetty/quic/quiche/foreign/incubator/quiche_h.java @@ -33,7 +33,7 @@ public class quiche_h { // This interface is a translation of the quiche.h header of a specific version. // It needs to be reviewed each time the native lib version changes. - private static final String EXPECTED_QUICHE_VERSION = "0.11.0"; + private static final String EXPECTED_QUICHE_VERSION = "0.12.0"; public static final byte C_FALSE = 0; public static final byte C_TRUE = 1; diff --git a/jetty-quic/quic-quiche/quic-quiche-jna/src/main/java/org/eclipse/jetty/quic/quiche/jna/LibQuiche.java b/jetty-quic/quic-quiche/quic-quiche-jna/src/main/java/org/eclipse/jetty/quic/quiche/jna/LibQuiche.java index dbeed8c899b..2ccb3295a96 100644 --- a/jetty-quic/quic-quiche/quic-quiche-jna/src/main/java/org/eclipse/jetty/quic/quiche/jna/LibQuiche.java +++ b/jetty-quic/quic-quiche/quic-quiche-jna/src/main/java/org/eclipse/jetty/quic/quiche/jna/LibQuiche.java @@ -31,7 +31,7 @@ public interface LibQuiche extends Library { // This interface is a translation of the quiche.h header of a specific version. // It needs to be reviewed each time the native lib version changes. - String EXPECTED_QUICHE_VERSION = "0.11.0"; + String EXPECTED_QUICHE_VERSION = "0.12.0"; // The charset used to convert java.lang.String to char * and vice versa. Charset CHARSET = StandardCharsets.UTF_8; 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 43f38a6e40e..777eb139488 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 @@ -1435,8 +1435,10 @@ public class Request implements HttpServletRequest RequestLog requestLog = httpChannel.getRequestLog(); if (requestLog != null) { - // Don't allow pulling more parameters + // Don't allow pulling more parameters from request body content _contentParamsExtracted = true; + if (_contentParameters == null) + _contentParameters = NO_PARAMS; // Reset the status code to what was committed MetaData.Response committedResponse = getResponse().getCommittedMetaData(); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java index 1a4688c8eda..62eb329b0c8 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java @@ -342,6 +342,9 @@ public class Response implements HttpServletResponse @Override public String encodeURL(String url) { + if (url == null) + return null; + final Request request = _channel.getRequest(); SessionHandler sessionManager = request.getSessionHandler(); @@ -349,7 +352,8 @@ public class Response implements HttpServletResponse return url; HttpURI uri = null; - if (sessionManager.isCheckingRemoteSessionIdEncoding() && URIUtil.hasScheme(url)) + boolean hasScheme = URIUtil.hasScheme(url); + if (sessionManager.isCheckingRemoteSessionIdEncoding() && hasScheme) { uri = HttpURI.from(url); String path = uri.getPath(); @@ -371,9 +375,6 @@ public class Response implements HttpServletResponse if (sessionURLPrefix == null) return url; - if (url == null) - return null; - // should not encode if cookies in evidence if ((sessionManager.isUsingCookies() && request.isRequestedSessionIdFromCookie()) || !sessionManager.isUsingURLs()) { @@ -404,9 +405,6 @@ public class Response implements HttpServletResponse String id = sessionManager.getExtendedId(session); - if (uri == null) - uri = HttpURI.from(url); - // Already encoded int prefix = url.indexOf(sessionURLPrefix); if (prefix != -1) @@ -421,20 +419,24 @@ public class Response implements HttpServletResponse url.substring(suffix); } + // check for a null path + String nonNullPath = ""; + if (hasScheme) + { + if (uri == null) + uri = HttpURI.from(url); + if (uri.getPath() == null) + nonNullPath = "/"; + } + // edit the session int suffix = url.indexOf('?'); if (suffix < 0) suffix = url.indexOf('#'); if (suffix < 0) - { - return url + - ((HttpScheme.HTTPS.is(uri.getScheme()) || HttpScheme.HTTP.is(uri.getScheme())) && uri.getPath() == null ? "/" : "") + //if no path, insert the root path - sessionURLPrefix + id; - } + return url + nonNullPath + sessionURLPrefix + id; - return url.substring(0, suffix) + - ((HttpScheme.HTTPS.is(uri.getScheme()) || HttpScheme.HTTP.is(uri.getScheme())) && uri.getPath() == null ? "/" : "") + //if no path so insert the root path - sessionURLPrefix + id + url.substring(suffix); + return url.substring(0, suffix) + nonNullPath + sessionURLPrefix + id + url.substring(suffix); } @Override diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ServletPathMapping.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ServletPathMapping.java index e8574ce2f54..c03607f542e 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/ServletPathMapping.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ServletPathMapping.java @@ -86,18 +86,13 @@ public class ServletPathMapping implements HttpServletMapping break; case MIDDLE_GLOB: - _mappingMatch = null; - _matchValue = ""; - _servletPath = pathInContext; - _pathInfo = null; - break; - default: throw new IllegalStateException(); } } else { + // TODO can we do better for RegexPathSpec _mappingMatch = null; _matchValue = ""; _servletPath = pathInContext; diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestLogTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestLogTest.java index 440650475e1..f0043415121 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestLogTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestLogTest.java @@ -34,6 +34,8 @@ import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.component.LifeCycle; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -145,8 +147,9 @@ public class RequestLogTest * Test an unread HTTP/1.1 POST, it has valid body content, the dispatched Handler on the server doesn't read the POST body content. * The RequestLog accidentally attempts to read the Request body content due to the use of Request.getParameterNames() API. */ - @Test - public void testNormalPostFormRequest() throws Exception + @ParameterizedTest + @ValueSource(strings = {"/hello", "/hello?a=b"}) + public void testNormalPostFormRequest(String requestPath) throws Exception { Server server = null; try @@ -179,7 +182,7 @@ public class RequestLogTest byte[] bufForm = form.toString().getBytes(UTF_8); StringBuilder req = new StringBuilder(); - req.append("POST /hello HTTP/1.1\r\n"); + req.append("POST ").append(requestPath).append(" HTTP/1.1\r\n"); req.append("Host: ").append(baseURI.getRawAuthority()).append("\r\n"); req.append("Content-Type: ").append(MimeTypes.Type.FORM_ENCODED).append("\r\n"); req.append("Content-Length: ").append(bufForm.length).append("\r\n"); @@ -213,7 +216,10 @@ public class RequestLogTest assertThat("Body Content", bodyContent, containsString("Got POST to /hello")); String reqlog = requestLogLines.poll(5, TimeUnit.SECONDS); - assertThat("RequestLog", reqlog, containsString("method:POST|uri:/hello|paramNames.size:0|status:200")); + int querySize = 0; + if (requestPath.contains("?")) + querySize = 1; // assuming that parameterized version only has 1 query value + assertThat("RequestLog", reqlog, containsString("method:POST|uri:/hello|paramNames.size:" + querySize + "|status:200")); } } finally diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java index c392ae7126f..2e9b9fcb27c 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java @@ -1642,7 +1642,7 @@ public class ResponseTest } @Test - public void testEncodeRedirect() + public void testEncodeURLs() { ContextHandler context = new ContextHandler("/path"); Response response = getResponse(); @@ -1708,6 +1708,7 @@ public class ResponseTest assertEquals("/;jsessionid=12345", response.encodeURL("/")); assertEquals("/foo.html;jsessionid=12345#target", response.encodeURL("/foo.html#target")); assertEquals(";jsessionid=12345", response.encodeURL("")); + assertEquals("../foo/bar.jsp;jsessionid=12345", response.encodeURL("../foo/bar.jsp")); } @Test diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java index dcafde61e0f..1b0fc85cef7 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java @@ -1246,6 +1246,12 @@ public class ServletHandler extends ScopedHandler } } + protected PathSpec asPathSpec(String pathSpec) + { + // By default only allow servlet path specs + return new ServletPathSpec(pathSpec); + } + protected void updateMappings() { try (AutoLock ignored = lock()) @@ -1354,9 +1360,9 @@ public class ServletHandler extends ScopedHandler finalMapping.getServletName(), getServlet(finalMapping.getServletName()).getSource()); - ServletPathSpec servletPathSpec = new ServletPathSpec(pathSpec); - MappedServlet mappedServlet = new MappedServlet(servletPathSpec, getServlet(finalMapping.getServletName())); - pm.put(servletPathSpec, mappedServlet); + PathSpec ps = asPathSpec(pathSpec); + MappedServlet mappedServlet = new MappedServlet(ps, getServlet(finalMapping.getServletName())); + pm.put(ps, mappedServlet); } _servletPathMap = pm; diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/RegexServletTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/RegexServletTest.java new file mode 100644 index 00000000000..1940308cbc3 --- /dev/null +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/RegexServletTest.java @@ -0,0 +1,153 @@ +// +// ======================================================================== +// Copyright (c) 1995-2022 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 +// which is available at https://www.apache.org/licenses/LICENSE-2.0. +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +package org.eclipse.jetty.servlet; + +import java.io.IOException; +import java.io.PrintWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.eclipse.jetty.http.pathmap.PathMappings; +import org.eclipse.jetty.http.pathmap.PathSpec; +import org.eclipse.jetty.server.LocalConnector; +import org.eclipse.jetty.server.Server; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; + +public class RegexServletTest +{ + private Server _server; + private LocalConnector _connector; + private ServletContextHandler _servletContextHandler; + + @BeforeEach + public void beforeEach() + { + _server = new Server(); + _connector = new LocalConnector(_server); + + _servletContextHandler = new ServletContextHandler(_server, "/ctx"); + _servletContextHandler.setServletHandler(new ServletHandler() + { + @Override + protected PathSpec asPathSpec(String pathSpec) + { + return PathMappings.asPathSpec(pathSpec); + } + }); + + _server.setHandler(_servletContextHandler); + _server.addConnector(_connector); + } + + @Test + public void testHello() throws Exception + { + _servletContextHandler.addServlet(new ServletHolder(new ServletContextHandlerTest.HelloServlet()), "^/[Hh]ello"); + _server.start(); + + assertThat(_connector.getResponse("GET /ctx/hello HTTP/1.0\r\n\r\n"), containsString("Hello World")); + assertThat(_connector.getResponse("GET /ctx/Hello HTTP/1.0\r\n\r\n"), containsString("Hello World")); + assertThat(_connector.getResponse("GET /ctx/HELLO HTTP/1.0\r\n\r\n"), containsString(" 404")); + } + + @Test + public void testMapping() throws Exception + { + _servletContextHandler.addServlet(new ServletHolder(new TestServlet()), "^/test/.*$"); + _server.start(); + + String response = _connector.getResponse("GET /ctx/test/info HTTP/1.0\r\n\r\n"); + assertThat(response, containsString(" 200 OK")); + assertThat(response, containsString("contextPath='/ctx'")); + assertThat(response, containsString("servletPath='/test/info'")); + assertThat(response, containsString("pathInfo='null'")); + assertThat(response, containsString("mapping.mappingMatch='null'")); + assertThat(response, containsString("mapping.matchValue=''")); + assertThat(response, containsString("mapping.pattern='^/test/.*$'")); + } + + @Test + public void testForward() throws Exception + { + _servletContextHandler.addServlet(new ServletHolder(new ForwardServlet()), "^/forward(/.*)?"); + _servletContextHandler.addServlet(new ServletHolder(new TestServlet()), "^/[Tt]est(/.*)?"); + _server.start(); + + String response = _connector.getResponse("GET /ctx/forward/ignore HTTP/1.0\r\n\r\n"); + assertThat(response, containsString(" 200 OK")); + assertThat(response, containsString("contextPath='/ctx'")); + assertThat(response, containsString("servletPath='/Test/info'")); + assertThat(response, containsString("pathInfo='null'")); + assertThat(response, containsString("mapping.mappingMatch='null'")); + assertThat(response, containsString("mapping.matchValue=''")); + assertThat(response, containsString("mapping.pattern='^/[Tt]est(/.*)?'")); + } + + @Test + public void testInclude() throws Exception + { + _servletContextHandler.addServlet(new ServletHolder(new IncludeServlet()), "^/include$"); + _servletContextHandler.addServlet(new ServletHolder(new TestServlet()), "^/[Tt]est(/.*)?"); + _server.start(); + + String response = _connector.getResponse("GET /ctx/include HTTP/1.0\r\n\r\n"); + assertThat(response, containsString(" 200 OK")); + assertThat(response, containsString("contextPath='/ctx'")); + assertThat(response, containsString("servletPath='/include'")); + assertThat(response, containsString("pathInfo='null'")); + assertThat(response, containsString("mapping.mappingMatch='null'")); + assertThat(response, containsString("mapping.matchValue=''")); + assertThat(response, containsString("mapping.pattern='^/include$'")); + } + + static class TestServlet extends HttpServlet + { + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException + { + resp.setStatus(200); + PrintWriter out = resp.getWriter(); + out.printf("contextPath='%s'%n", req.getContextPath()); + out.printf("servletPath='%s'%n", req.getServletPath()); + out.printf("pathInfo='%s'%n", req.getPathInfo()); + out.printf("mapping.mappingMatch='%s'%n", req.getHttpServletMapping().getMappingMatch()); + out.printf("mapping.matchValue='%s'%n", req.getHttpServletMapping().getMatchValue()); + out.printf("mapping.pattern='%s'%n", req.getHttpServletMapping().getPattern()); + } + } + + static class ForwardServlet extends HttpServlet + { + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException + { + req.getServletContext().getRequestDispatcher("/Test/info").forward(req, resp); + } + } + + static class IncludeServlet extends HttpServlet + { + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException + { + req.getServletContext().getRequestDispatcher("/Test/info").include(req, resp); + } + } +} diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/ModuleGraphWriter.java b/jetty-start/src/main/java/org/eclipse/jetty/start/ModuleGraphWriter.java index 6c9050959a6..f5a33f454d4 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/ModuleGraphWriter.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/ModuleGraphWriter.java @@ -29,6 +29,8 @@ public class ModuleGraphWriter { private String colorModuleBg; private String colorEnabledBg; + private String colorEdgeBefore; + private String colorEdgeAfter; private String colorTransitiveBg; private String colorCellBg; private String colorHeaderBg; @@ -38,6 +40,8 @@ public class ModuleGraphWriter { colorModuleBg = "#B8FFB8"; colorEnabledBg = "#66FFCC"; + colorEdgeAfter = "#00CC33"; + colorEdgeAfter = "#33CC00"; colorTransitiveBg = "#66CC66"; colorCellBg = "#FFFFFF80"; colorHeaderBg = "#00000020"; @@ -49,6 +53,8 @@ public class ModuleGraphWriter String prefix = "jetty.graph."; colorModuleBg = getProperty(props, prefix + "color.module.bg", colorModuleBg); colorEnabledBg = getProperty(props, prefix + "color.enabled.bg", colorEnabledBg); + colorEdgeBefore = getProperty(props, prefix + "color.edge.before", colorEdgeBefore); + colorEdgeAfter = getProperty(props, prefix + "color.edge.after", colorEdgeAfter); colorTransitiveBg = getProperty(props, prefix + "color.transitive.bg", colorTransitiveBg); colorCellBg = getProperty(props, prefix + "color.cell.bg", colorCellBg); colorHeaderBg = getProperty(props, prefix + "color.header.bg", colorHeaderBg); @@ -73,7 +79,7 @@ public class ModuleGraphWriter public void write(Modules modules, Path outputFile) throws IOException { try (BufferedWriter writer = Files.newBufferedWriter(outputFile, StandardCharsets.UTF_8, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE); - PrintWriter out = new PrintWriter(writer);) + PrintWriter out = new PrintWriter(writer)) { writeHeaderMessage(out, outputFile); @@ -245,13 +251,13 @@ public class ModuleGraphWriter depends = Module.normalizeModuleName(depends); out.printf(" \"%s\" -> \"%s\";%n", module.getName(), depends); } + for (String optional : module.getAfter()) + { + out.printf(" \"%s\" -> \"%s\" [ color=\"%s\" ];%n", module.getName(), optional, colorEdgeAfter); + } for (String before : module.getBefore()) { - out.printf(" \"%s\" << \"%s\";%n", module.getName(), before); - } - for (String after : module.getAfter()) - { - out.printf(" \"%s\" >> \"%s\";%n", module.getName(), after); + out.printf(" \"%s\" -> \"%s\" [ color=\"%s\" ];%n", before, module.getName(), colorEdgeBefore); } } } diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/ModuleGraphWriterTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/ModuleGraphWriterTest.java index 8482e98ddc3..431c9c3b1d5 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/ModuleGraphWriterTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/ModuleGraphWriterTest.java @@ -13,8 +13,12 @@ package org.eclipse.jetty.start; +import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; import java.nio.file.Path; +import java.time.Duration; import org.eclipse.jetty.start.config.CommandLineConfigSource; import org.eclipse.jetty.start.config.ConfigSources; @@ -28,6 +32,8 @@ import org.junit.jupiter.api.extension.ExtendWith; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertTimeout; +import static org.junit.jupiter.api.Assertions.assertTrue; @ExtendWith(WorkDirExtension.class) public class ModuleGraphWriterTest @@ -58,11 +64,51 @@ public class ModuleGraphWriterTest Modules modules = new Modules(basehome, args); modules.registerAll(); - Path outputFile = basehome.getBasePath("graph.dot"); + Path dotFile = basehome.getBasePath("graph.dot"); ModuleGraphWriter writer = new ModuleGraphWriter(); - writer.write(modules, outputFile); + writer.write(modules, dotFile); - assertThat("Output File Exists", FS.exists(outputFile), is(true)); + assertThat("Output File Exists", FS.exists(dotFile), is(true)); + + assertTimeout(Duration.ofSeconds(3), () -> + { + if (execDotCmd("dot", "-V")) + { + Path outputPng = testdir.getPath().resolve("output.png"); + assertTrue(execDotCmd("dot", "-Tpng", "-o" + outputPng, dotFile.toString())); + + assertThat("PNG File does not exist", FS.exists(outputPng)); + } + }); + } + + private boolean execDotCmd(String... args) + { + try + { + Process p = Runtime.getRuntime().exec(args); + + try (BufferedReader bri = new BufferedReader(new InputStreamReader(p.getInputStream(), StandardCharsets.UTF_8)); + BufferedReader bre = new BufferedReader(new InputStreamReader(p.getErrorStream(), StandardCharsets.UTF_8))) + { + String line; + while ((line = bri.readLine()) != null) + { + System.out.printf("[STDIN] %s%n", line); + } + while ((line = bre.readLine()) != null) + { + System.out.printf("[STDERR] %s%n", line); + } + } + p.waitFor(); + return true; + } + catch (IOException | InterruptedException e) + { + e.printStackTrace(); + return false; + } } } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ReservedThreadExecutor.java b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ReservedThreadExecutor.java index b9d88dc8a62..1e0e8377c43 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ReservedThreadExecutor.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ReservedThreadExecutor.java @@ -410,6 +410,11 @@ public class ReservedThreadExecutor extends AbstractLifeCycle implements TryExec { LOG.warn("Unable to run task", e); } + finally + { + // Clear any interrupted status. + Thread.interrupted(); + } } } finally @@ -431,4 +436,4 @@ public class ReservedThreadExecutor extends AbstractLifeCycle implements TryExec _thread); } } -} \ No newline at end of file +} diff --git a/pom.xml b/pom.xml index 552121e5590..69f00157917 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ 2.2.1 2.5.3 9.2 - 4.1.1 + 4.2.0 5.3.0 1.5 9.3 @@ -43,18 +43,18 @@ 7.0.3 3.0.2 2.11.0 - 1.44.1 + 1.45.0 2.9.0 - 31.0.1-jre + 31.1-jre 5.1.0 2.2 2.14.5 4.2.4 4.3.5.Final 11.0.15.Final - 2.13.1 - 2.13.1 - 2.13.1 + 2.13.2 + 2.13.2 + 2.13.2 1.2.2 1.3.5 3.0.3 @@ -84,7 +84,7 @@ 3.1.0.Final 1.1 1.0.7 - 0.11.0.2 + 0.12.0 4.0.6 1.2 5.9 @@ -101,7 +101,7 @@ 9.0.52 5.8.2 2.0.1 - 2.17.1 + 2.17.2 1.3.0-alpha14 3.0.3 10.3.6 @@ -120,8 +120,8 @@ 1.2.5 1.16.3 3.1.9.Final - 1.5.4.Final - 1.18.3.Final + 1.6.0.Final + 1.19.0.Final 2.4.7 @@ -141,8 +141,8 @@ 5.1.4 3.1.0 3.1.2 - 3.10.0 - 3.2.0 + 3.10.1 + 3.3.0 3.0.0-M2 2.10 3.0.0 @@ -152,10 +152,9 @@ 3.2.2 3.2.2 3.3.2 - 3.1.1 + 3.2.0 3.6.4 3.6.4 - 3.2.1 2.5.3 1.7.0 3.2.0 @@ -165,7 +164,7 @@ 3.2.1 3.3.2 4.5.3.0 - 2.9.0 + 2.10.0 false @@ -700,11 +699,6 @@ maven-plugin-plugin ${maven-plugin.plugin.version} - - org.apache.maven.plugins - maven-project-info-reports-plugin - ${maven.project-info-reports.plugin.version} - org.apache.maven.plugins maven-release-plugin @@ -2064,47 +2058,6 @@ - - checkstyle - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - ${maven.project-info-reports.plugin.version} - - - org.apache.maven.plugins - maven-checkstyle-plugin - - - - checkstyle - - - - - - - - - - org.apache.maven.plugins - maven-site-plugin - ${maven.site.plugin.version} - - - build-site - - site - - package - - - - - - config diff --git a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/ThirdPartyModulesTests.java b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/ThirdPartyModulesTests.java index 9b8d44154f3..15151871aa7 100644 --- a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/ThirdPartyModulesTests.java +++ b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/ThirdPartyModulesTests.java @@ -105,40 +105,6 @@ public class ThirdPartyModulesTests extends AbstractJettyHomeTest } } - @Test - public void testjminix() throws Exception - { - Path jettyBase = newTestJettyBaseDirectory(); - String jettyVersion = System.getProperty("jettyVersion"); - JettyHomeTester distribution = JettyHomeTester.Builder.newInstance() - .jettyVersion(jettyVersion) - .jettyBase(jettyBase) - .mavenLocalRepository(System.getProperty("mavenRepoPath")) - .build(); - - int httpPort = distribution.freePort(); - - String[] argsConfig = { - "--approve-all-licenses", - "--add-modules=jminix,http,logging-jcl-capture" - }; - - try (JettyHomeTester.Run runConfig = distribution.start(argsConfig)) - { - assertTrue(runConfig.awaitFor(2, TimeUnit.MINUTES)); - assertEquals(0, runConfig.getExitValue()); - - String[] argsStart = { - "jetty.http.port=" + httpPort - }; - - try (JettyHomeTester.Run runStart = distribution.start(argsStart)) - { - assertTrue(runStart.awaitConsoleLogsFor("Started Server@", 20, TimeUnit.SECONDS)); - } - } - } - @Test public void testjolokia() throws Exception { diff --git a/tests/test-webapps/pom.xml b/tests/test-webapps/pom.xml index 6f1cfabf7c1..d7a97ab965f 100644 --- a/tests/test-webapps/pom.xml +++ b/tests/test-webapps/pom.xml @@ -10,25 +10,10 @@ test-webapps-parent Jetty Tests :: WebApps :: Parent pom - - - - org.apache.maven.plugins - maven-deploy-plugin - - - true - - - - org.jacoco - jacoco-maven-plugin - - true - - - - + + true + true + test-webapp-rfc2616 test-http2-webapp