Projects
openEuler:24.03:SP1:Everything
maven-site-plugin
_service:tar_scm:0001-Port-to-jetty-9.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:0001-Port-to-jetty-9.patch of Package maven-site-plugin
From 2765cae439a217a070dfde55993fa9f11e4e694d Mon Sep 17 00:00:00 2001 Date: Fri, 22 Feb 2013 10:56:19 +0100 Subject: [PATCH] Port to jetty 9 --- pom.xml | 34 +++++++++++++++++----- .../apache/maven/plugins/site/run/SiteRunMojo.java | 28 +++++++++--------- .../plugins/site/deploy/AuthAsyncProxyServlet.java | 6 ++-- .../site/deploy/SimpleDavServerHandler.java | 27 +++++++++++------ 4 files changed, 62 insertions(+), 33 deletions(-) diff --git a/pom.xml b/pom.xml index 39ff6ae..432b9c5 100644 --- a/pom.xml +++ b/pom.xml @@ -197,6 +197,7 @@ under the License. <wagonVersion>1.0</wagonVersion> <plexusVersion>1.5.4</plexusVersion> <scmVersion>1.4</scmVersion> + <jettyVersion>9.3.8.v20160314</jettyVersion> <!-- for ITs --> <javadocPluginVersion>2.9.1</javadocPluginVersion> <projectInfoReportsPluginVersion>2.7</projectInfoReportsPluginVersion> @@ -387,20 +388,39 @@ under the License. </dependency> <dependency> - <groupId>org.mortbay.jetty</groupId> - <artifactId>jetty</artifactId> - <version>6.1.25</version> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-server</artifactId> + <version>${jettyVersion}</version> </dependency> + + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-webapp</artifactId> + <version>${jettyVersion}</version> + </dependency> + + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-servlet</artifactId> + <version>${jettyVersion}</version> + </dependency> + <dependency> - <groupId>org.mortbay.jetty</groupId> + <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-util</artifactId> - <version>6.1.25</version> + <version>${jettyVersion}</version> </dependency> <dependency> - <groupId>org.mortbay.jetty</groupId> + <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-client</artifactId> - <version>6.1.25</version> + <version>${jettyVersion}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-proxy</artifactId> + <version>${jettyVersion}</version> <scope>test</scope> </dependency> diff --git a/src/main/java/org/apache/maven/plugins/site/run/SiteRunMojo.java b/src/main/java/org/apache/maven/plugins/site/run/SiteRunMojo.java index 17ebb3a..2048bec 100644 --- a/src/main/java/org/apache/maven/plugins/site/run/SiteRunMojo.java +++ b/src/main/java/org/apache/maven/plugins/site/run/SiteRunMojo.java @@ -38,12 +38,13 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.site.render.AbstractSiteRenderingMojo; import org.apache.maven.reporting.exec.MavenReportExecution; import org.codehaus.plexus.util.IOUtil; -import org.mortbay.jetty.Connector; -import org.mortbay.jetty.Handler; -import org.mortbay.jetty.Server; -import org.mortbay.jetty.handler.DefaultHandler; -import org.mortbay.jetty.nio.SelectChannelConnector; -import org.mortbay.jetty.webapp.WebAppContext; +import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.Handler; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.handler.DefaultHandler; +import org.eclipse.jetty.server.handler.HandlerList; +import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.webapp.WebAppContext; /** * Starts the site up, rendering documents as requested for faster editing. @@ -81,7 +82,7 @@ public class SiteRunMojo Server server = new Server(); server.setStopAtShutdown( true ); - Connector defaultConnector = getDefaultConnector(); + ServerConnector defaultConnector = getDefaultConnector( server ); server.setConnectors( new Connector[] { defaultConnector } ); WebAppContext webapp = createWebApplication(); @@ -90,10 +91,9 @@ public class SiteRunMojo DefaultHandler defaultHandler = new DefaultHandler(); defaultHandler.setServer( server ); - Handler[] handlers = new Handler[2]; - handlers[0] = webapp; - handlers[1] = defaultHandler; - server.setHandlers( handlers ); + HandlerList handlers = new HandlerList(); + handlers.setHandlers(new Handler[] { webapp, defaultHandler } ); + server.setHandler( handlers ); getLog().info( "Starting Jetty on http://localhost:" + port + "/" ); try @@ -224,11 +224,11 @@ public class SiteRunMojo return webapp; } - private Connector getDefaultConnector() + private ServerConnector getDefaultConnector( Server server ) { - Connector connector = new SelectChannelConnector(); + ServerConnector connector = new ServerConnector( server ); connector.setPort( port ); - connector.setMaxIdleTime( MAX_IDLE_TIME ); + connector.setIdleTimeout( MAX_IDLE_TIME ); return connector; } diff --git a/src/test/java/org/apache/maven/plugins/site/deploy/AuthAsyncProxyServlet.java b/src/test/java/org/apache/maven/plugins/site/deploy/AuthAsyncProxyServlet.java index 21775d4..5b6f06b 100644 --- a/src/test/java/org/apache/maven/plugins/site/deploy/AuthAsyncProxyServlet.java +++ b/src/test/java/org/apache/maven/plugins/site/deploy/AuthAsyncProxyServlet.java @@ -35,8 +35,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.maven.plugins.site.deploy.SimpleDavServerHandler.HttpRequest; -import org.mortbay.jetty.security.B64Code; -import org.mortbay.proxy.AsyncProxyServlet; +import org.eclipse.jetty.proxy.AsyncProxyServlet; +import org.eclipse.jetty.util.B64Code; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -108,7 +108,7 @@ public class AuthAsyncProxyServlet if ( proxyAuthorization != null && proxyAuthorization.startsWith( "Basic " ) ) { String proxyAuth = proxyAuthorization.substring( 6 ); - String authorization = B64Code.decode( proxyAuth ); + String authorization = B64Code.decode( proxyAuth, "UTF-8" ); String[] authTokens = authorization.split( ":" ); String user = authTokens[0]; String password = authTokens[1]; diff --git a/src/test/java/org/apache/maven/plugins/site/deploy/SimpleDavServerHandler.java b/src/test/java/org/apache/maven/plugins/site/deploy/SimpleDavServerHandler.java index 67b22c5..70b6d01 100644 --- a/src/test/java/org/apache/maven/plugins/site/deploy/SimpleDavServerHandler.java +++ b/src/test/java/org/apache/maven/plugins/site/deploy/SimpleDavServerHandler.java @@ -36,12 +36,13 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.SystemUtils; -import org.mortbay.jetty.Handler; -import org.mortbay.jetty.Request; -import org.mortbay.jetty.Server; -import org.mortbay.jetty.handler.AbstractHandler; -import org.mortbay.jetty.servlet.Context; -import org.mortbay.jetty.servlet.ServletHolder; +import org.eclipse.jetty.server.Handler; +import org.eclipse.jetty.server.Request; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.server.handler.AbstractHandler; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -100,6 +101,12 @@ public class SimpleDavServerHandler ( (Request) request ).setHandled( true ); } + + @Override + public void handle(String target, Request baseRequest, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException { + handle( target, request, response, 0 ); + } }; server = new Server( 0 ); server.setHandler( repoHandler ); @@ -112,16 +119,18 @@ public class SimpleDavServerHandler { siteTargetPath = null; server = new Server( 0 ); - Context context = new Context( server, "/", 0 ); + ServletContextHandler context = new ServletContextHandler(); + context.setContextPath( "/" ); context.addServlet( new ServletHolder( servlet ), "/" ); - + + server.setHandler(context); server.start(); } public int getPort() { - return server.getConnectors()[0].getLocalPort(); + return ( (ServerConnector)server.getConnectors()[0] ).getLocalPort(); } public void stop() -- 2.7.4
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2