diff --git a/Jenkinsfile b/Jenkinsfile index 21133baa..d5757dba 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,6 @@ // Builds a module using https://github.com/jenkins-infra/pipeline-library buildPlugin(useContainerAgent: true, configurations: [ - [platform: 'linux', jdk: 11], - [platform: 'windows', jdk: 11], + [platform: 'windows', jdk: 17], [platform: 'linux', jdk: 17], [platform: 'linux', jdk: 21] ]) diff --git a/pom.xml b/pom.xml index c45b92ec..0edbaffc 100644 --- a/pom.xml +++ b/pom.xml @@ -52,17 +52,20 @@ jenkinsci/${project.artifactId}-plugin 5.2.7 4.7.2 - - 2.440.3 + + 2.472 + + 2254.vcff7a_d4969e5 false + 17 io.jenkins.tools.bom - bom-2.440.x - 3234.v5ca_5154341ef + bom-2.462.x + 3258.vcdcf15936a_fd pom import diff --git a/src/test/java/com/atlassian/httpclient/apache/httpcomponents/ApacheAsyncHttpClientTest.java b/src/test/java/com/atlassian/httpclient/apache/httpcomponents/ApacheAsyncHttpClientTest.java index 5a33cbfa..405bda4f 100644 --- a/src/test/java/com/atlassian/httpclient/apache/httpcomponents/ApacheAsyncHttpClientTest.java +++ b/src/test/java/com/atlassian/httpclient/apache/httpcomponents/ApacheAsyncHttpClientTest.java @@ -10,25 +10,24 @@ import hudson.ProxyConfiguration; import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.util.Base64; import java.util.Date; import java.util.Optional; import java.util.concurrent.TimeUnit; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import jenkins.model.Jenkins; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpStatus; +import org.eclipse.jetty.io.Content; import org.eclipse.jetty.server.ConnectionFactory; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; -import org.eclipse.jetty.server.handler.AbstractHandler; +import org.eclipse.jetty.util.Callback; import org.junit.After; import org.junit.Assert; import org.junit.Rule; @@ -151,7 +150,7 @@ public void simple_post_with_proxy() throws Exception { Assert.assertEquals("FOO", testHandler.postReceived); } - public class ProxyTestHandler extends AbstractHandler { + public static class ProxyTestHandler extends Handler.Abstract { String postReceived; @@ -164,55 +163,50 @@ public class ProxyTestHandler extends AbstractHandler { final String realm = "test_realm"; @Override - public void handle( - String target, - org.eclipse.jetty.server.Request jettyRequest, - HttpServletRequest request, - HttpServletResponse response) - throws IOException, ServletException { + public boolean handle( + org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response, Callback callback) + throws IOException { final String credentials = Base64.getEncoder().encodeToString((user + ":" + password).getBytes("UTF-8")); - jettyRequest.setHandled(true); - - String authorization = request.getHeader(HttpHeader.PROXY_AUTHORIZATION.asString()); + String authorization = request.getHeaders().get(HttpHeader.PROXY_AUTHORIZATION.asString()); if (authorization == null) { response.setStatus(HttpStatus.PROXY_AUTHENTICATION_REQUIRED_407); - response.setHeader(HttpHeader.PROXY_AUTHENTICATE.asString(), "Basic realm=\"" + realm + "\""); - return; + response.getHeaders().add(HttpHeader.PROXY_AUTHENTICATE.asString(), "Basic realm=\"" + realm + "\""); + callback.succeeded(); + return true; } else { String prefix = "Basic "; if (authorization.startsWith(prefix)) { String attempt = authorization.substring(prefix.length()); if (!credentials.equals(attempt)) { - return; + callback.succeeded(); + return true; } } } if (StringUtils.equalsIgnoreCase("post", request.getMethod())) { - postReceived = IOUtils.toString(request.getReader()); + postReceived = Content.Source.asString(request, StandardCharsets.UTF_8); } - response.getWriter().write(CONTENT_RESPONSE); + Content.Sink.write(response, true, CONTENT_RESPONSE, callback); + return true; } } - public class TestHandler extends AbstractHandler { + public static class TestHandler extends Handler.Abstract { String postReceived; @Override - public void handle( - String target, - org.eclipse.jetty.server.Request jettyRequest, - HttpServletRequest request, - HttpServletResponse response) - throws IOException, ServletException { - jettyRequest.setHandled(true); + public boolean handle( + org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response, Callback callback) + throws IOException { if (StringUtils.equalsIgnoreCase("post", request.getMethod())) { - postReceived = IOUtils.toString(request.getReader()); + postReceived = Content.Source.asString(request, StandardCharsets.UTF_8); } - response.getWriter().write(CONTENT_RESPONSE); + Content.Sink.write(response, true, CONTENT_RESPONSE, callback); + return true; } } diff --git a/src/test/java/hudson/plugins/jira/JiraSiteSecurity1029Test.java b/src/test/java/hudson/plugins/jira/JiraSiteSecurity1029Test.java index 06acae62..63d7d185 100644 --- a/src/test/java/hudson/plugins/jira/JiraSiteSecurity1029Test.java +++ b/src/test/java/hudson/plugins/jira/JiraSiteSecurity1029Test.java @@ -26,11 +26,11 @@ import jenkins.model.Jenkins; import jenkins.security.ApiTokenProperty; import net.sf.json.JSONObject; +import org.eclipse.jetty.ee8.servlet.DefaultServlet; +import org.eclipse.jetty.ee8.servlet.ServletContextHandler; +import org.eclipse.jetty.ee8.servlet.ServletHolder; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; -import org.eclipse.jetty.servlet.DefaultServlet; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.servlet.ServletHolder; import org.htmlunit.HttpMethod; import org.htmlunit.Page; import org.htmlunit.WebRequest;