Port to jetty 9

This commit is contained in:
Michal Srb 2013-03-01 15:32:39 +01:00 committed by Mikolaj Izdebski
parent c7d2706b17
commit e173366260
3 changed files with 107 additions and 38 deletions

View File

@ -1,12 +1,12 @@
From e7c5fab3875a9e4089277e7d7c9711d974b63601 Mon Sep 17 00:00:00 2001
From a98d4de91d767519ed9f4680607d466ba170e45d Mon Sep 17 00:00:00 2001
From: Michal Srb <msrb@redhat.com>
Date: Wed, 27 Feb 2013 12:38:47 +0100
Subject: [PATCH] Port to jetty 8
Subject: [PATCH] Port to jetty 9
---
wagon-provider-test/pom.xml | 30 ++++++++-
.../apache/maven/wagon/http/HttpWagonTestCase.java | 77 +++++++++++-----------
2 files changed, 67 insertions(+), 40 deletions(-)
wagon-provider-test/pom.xml | 30 ++++++-
.../apache/maven/wagon/http/HttpWagonTestCase.java | 97 +++++++++++-----------
2 files changed, 78 insertions(+), 49 deletions(-)
diff --git a/wagon-provider-test/pom.xml b/wagon-provider-test/pom.xml
index 1bc9826..efa730d 100644
@ -50,10 +50,10 @@ index 1bc9826..efa730d 100644
</dependencies>
diff --git a/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java b/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java
index 4ee5475..66c77c9 100644
index 4ee5475..96728d3 100644
--- a/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java
+++ b/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java
@@ -34,20 +34,23 @@
@@ -34,20 +34,25 @@
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringOutputStream;
import org.codehaus.plexus.util.StringUtils;
@ -72,10 +72,12 @@ index 4ee5475..66c77c9 100644
-import org.mortbay.jetty.servlet.DefaultServlet;
-import org.mortbay.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.AbstractHttpConnection;
+import org.eclipse.jetty.server.HttpConnection;
+import org.eclipse.jetty.server.HttpChannel;
+import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.server.Response;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.NetworkConnector;
+import org.eclipse.jetty.server.UserIdentity;
+import org.eclipse.jetty.server.handler.AbstractHandler;
+import org.eclipse.jetty.server.handler.HandlerCollection;
@ -91,7 +93,7 @@ index 4ee5475..66c77c9 100644
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
@@ -95,7 +98,7 @@ protected void setupWagonTestingFixtures()
@@ -95,7 +100,7 @@ protected void setupWagonTestingFixtures()
server = new Server( 0 );
PutHandler putHandler = new PutHandler( repositoryDirectory );
@ -100,7 +102,14 @@ index 4ee5475..66c77c9 100644
createContext( server, repositoryDirectory );
@@ -119,8 +122,8 @@ protected final int getTestRepositoryPort()
@@ -113,14 +118,14 @@ protected final int getTestRepositoryPort()
{
return 0;
}
- return server.getConnectors()[0].getLocalPort();
+ return ((NetworkConnector) (server.getConnectors()[0])).getLocalPort();
}
protected void createContext( Server server, File repositoryDirectory )
throws IOException
{
@ -111,7 +120,34 @@ index 4ee5475..66c77c9 100644
ServletHolder servletHolder = new ServletHolder( new DefaultServlet() );
root.addServlet( servletHolder, "/*" );
}
@@ -368,7 +371,7 @@ public void testGzipGet()
@@ -160,7 +165,7 @@ public void testHttpHeaders()
server.start();
wagon.connect(
- new Repository( "id", getProtocol() + "://localhost:" + server.getConnectors()[0].getLocalPort() ) );
+ new Repository( "id", getProtocol() + "://localhost:" + ((NetworkConnector) (server.getConnectors()[0])).getLocalPort() ) );
wagon.getToStream( "resource", new StringOutputStream() );
@@ -192,7 +197,7 @@ public void testHttpHeadersWithCommonMethods()
server.start();
wagon.connect(
- new Repository( "id", getProtocol() + "://localhost:" + server.getConnectors()[0].getLocalPort() ) );
+ new Repository( "id", getProtocol() + "://localhost:" + ((NetworkConnector) (server.getConnectors()[0])).getLocalPort() ) );
wagon.getToStream( "resource", new StringOutputStream() );
@@ -211,7 +216,7 @@ protected void addConnectors( Server server )
protected String getRepositoryUrl( Server server )
{
- int localPort = server.getConnectors()[0].getLocalPort();
+ int localPort = ((NetworkConnector) (server.getConnectors()[0])).getLocalPort();
return getProtocol() + "://localhost:" + localPort;
}
@@ -368,7 +373,7 @@ public void testGzipGet()
Server server = new Server( getTestRepositoryPort() );
String localRepositoryPath = FileTestUtils.getTestOutputDir().toString();
@ -120,7 +156,43 @@ index 4ee5475..66c77c9 100644
root.setResourceBase( localRepositoryPath );
ServletHolder servletHolder = new ServletHolder( new DefaultServlet() );
servletHolder.setInitParameter( "gzip", "true" );
@@ -901,13 +904,13 @@ public void testRedirectPutFileRelativeUrl()
@@ -471,7 +476,7 @@ public void testRedirectGetToStream()
protocol = "https";
}
- String redirectUrl = protocol + "://localhost:" + server.getConnectors()[0].getLocalPort();
+ String redirectUrl = protocol + "://localhost:" + ((NetworkConnector) (server.getConnectors()[0])).getLocalPort();
RedirectHandler redirectHandler = new RedirectHandler( "Found", 303, redirectUrl, null );
@@ -537,7 +542,7 @@ public void testRedirectGet()
protocol = "https";
}
- String redirectUrl = protocol + "://localhost:" + server.getConnectors()[0].getLocalPort();
+ String redirectUrl = protocol + "://localhost:" + ((NetworkConnector) (server.getConnectors()[0])).getLocalPort();
RedirectHandler redirectHandler = new RedirectHandler( "Found", 303, redirectUrl, null );
@@ -605,7 +610,7 @@ public void testRedirectPutFromStreamWithFullUrl()
protocol = "https";
}
- String redirectUrl = protocol + "://localhost:" + realServer.getConnectors()[0].getLocalPort();
+ String redirectUrl = protocol + "://localhost:" + ((NetworkConnector) (realServer.getConnectors()[0])).getLocalPort();
RedirectHandler redirectHandler = new RedirectHandler( "Found", 303, redirectUrl, repositoryDirectory );
@@ -776,7 +781,7 @@ public void testRedirectPutFileWithFullUrl()
protocol = "https";
}
- String redirectUrl = protocol + "://localhost:" + realServer.getConnectors()[0].getLocalPort();
+ String redirectUrl = protocol + "://localhost:" + ((NetworkConnector) (realServer.getConnectors()[0])).getLocalPort();
RedirectHandler redirectHandler = new RedirectHandler( "Found", 303, redirectUrl, repositoryDirectory );
@@ -901,13 +906,13 @@ public void testRedirectPutFileRelativeUrl()
this.repositoryDirectory = repositoryDirectory;
}
@ -136,7 +208,16 @@ index 4ee5475..66c77c9 100644
handlerRequestResponses.add(
new HandlerRequestResponse( req.getMethod(), ( (Response) resp ).getStatus(),
req.getRequestURI() ) );
@@ -1062,7 +1065,7 @@ public void runTestSecuredGet( AuthenticationInfo authInfo )
@@ -935,7 +940,7 @@ private void runTestProxiedRequest( ProxyInfo proxyInfo, TestHeaderHandler handl
proxyServer.start();
- proxyInfo.setPort( proxyServer.getConnectors()[0].getLocalPort() );
+ proxyInfo.setPort( ((NetworkConnector) (proxyServer.getConnectors()[0])).getLocalPort() );
System.out.println(
"start proxy on host/port " + proxyInfo.getHost() + "/" + proxyInfo.getPort() + " with non proxyHosts "
@@ -1062,7 +1067,7 @@ public void runTestSecuredGet( AuthenticationInfo authInfo )
assertEquals( "top secret", IOUtil.toString( in ) );
@ -145,7 +226,7 @@ index 4ee5475..66c77c9 100644
testPreemptiveAuthenticationGet( securityHandler, supportPreemptiveAuthenticationGet() );
}
@@ -1113,7 +1116,7 @@ public void runTestSecuredGetToStream( AuthenticationInfo authInfo )
@@ -1113,7 +1118,7 @@ public void runTestSecuredGetToStream( AuthenticationInfo authInfo )
assertEquals( "top secret", out.toString() );
@ -154,7 +235,7 @@ index 4ee5475..66c77c9 100644
testPreemptiveAuthenticationGet( securityHandler, supportPreemptiveAuthenticationGet() );
}
finally
@@ -1203,9 +1206,9 @@ private Server createSecurityServer( String localRepositoryPath )
@@ -1203,9 +1208,9 @@ private Server createSecurityServer( String localRepositoryPath )
SecurityHandler sh = createSecurityHandler();
@ -166,7 +247,7 @@ index 4ee5475..66c77c9 100644
root.setResourceBase( localRepositoryPath );
ServletHolder servletHolder = new ServletHolder( new DefaultServlet() );
root.addServlet( servletHolder, "/*" );
@@ -1566,7 +1569,7 @@ public void setStatusToReturn( int status )
@@ -1566,7 +1571,7 @@ public void setStatusToReturn( int status )
this.status = status;
}
@ -175,7 +256,7 @@ index 4ee5475..66c77c9 100644
throws IOException, ServletException
{
if ( status != 0 )
@@ -1622,11 +1625,11 @@ public PutHandler( File repositoryDirectory )
@@ -1622,11 +1627,11 @@ public PutHandler( File repositoryDirectory )
this.resourceBase = repositoryDirectory;
}
@ -185,11 +266,11 @@ index 4ee5475..66c77c9 100644
{
Request base_request =
- request instanceof Request ? (Request) request : HttpConnection.getCurrentConnection().getRequest();
+ request instanceof Request ? (Request) request : AbstractHttpConnection.getCurrentConnection().getRequest();
+ request instanceof Request ? (Request) request : HttpConnection.getCurrentConnection().getHttpChannel().getRequest();
if ( base_request.isHandled() || !"PUT".equals( base_request.getMethod() ) )
{
@@ -1671,7 +1674,7 @@ public void handle( String target, HttpServletRequest request, HttpServletRespon
@@ -1671,7 +1676,7 @@ public void handle( String target, HttpServletRequest request, HttpServletRespon
List<HandlerRequestResponse> handlerRequestResponses = new ArrayList<HandlerRequestResponse>();
@ -198,7 +279,7 @@ index 4ee5475..66c77c9 100644
throws IOException, ServletException
{
System.out.println( " handle proxy request" );
@@ -1687,7 +1690,7 @@ public void handle( String target, HttpServletRequest request, HttpServletRespon
@@ -1687,7 +1692,7 @@ public void handle( String target, HttpServletRequest request, HttpServletRespon
}
handlerRequestResponses.add(
new HandlerRequestResponse( request.getMethod(), 200, request.getRequestURI() ) );
@ -207,7 +288,7 @@ index 4ee5475..66c77c9 100644
}
}
@@ -1702,7 +1705,7 @@ public TestHeaderHandler()
@@ -1702,7 +1707,7 @@ public TestHeaderHandler()
{
}
@ -216,7 +297,7 @@ index 4ee5475..66c77c9 100644
throws IOException, ServletException
{
headers = new HashMap();
@@ -1737,31 +1740,29 @@ protected TestSecurityHandler createSecurityHandler()
@@ -1737,31 +1742,29 @@ protected TestSecurityHandler createSecurityHandler()
cm.setPathSpec( "/*" );
TestSecurityHandler sh = new TestSecurityHandler();

View File

@ -9,7 +9,7 @@ License: ASL 2.0
URL: http://maven.apache.org/wagon
Source0: http://repo1.maven.org/maven2/org/apache/maven/wagon/wagon/%{version}/wagon-%{version}-source-release.zip
Patch0: 0001-Port-to-jetty-8.patch
Patch0: 0001-Port-to-jetty-9.patch
BuildArch: noarch
@ -121,6 +121,9 @@ Javadoc for %{name}.
%doc LICENSE NOTICE DEPENDENCIES
%changelog
* Fri Mar 01 2013 Michal Srb <msrb@redhat.com> - 0:2.4-1
- Port to jetty 9
* Thu Feb 28 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 0:2.4-1
- Simplify build-requires

View File

@ -1,15 +0,0 @@
--- wagon-providers/wagon-http-shared/pom.xml.orig 2009-06-26 03:35:55.126611000 +0800
+++ wagon-providers/wagon-http-shared/pom.xml 2010-05-14 17:20:51.094694917 +0800
@@ -36,9 +36,9 @@
<dependencies>
<dependency>
- <groupId>nekohtml</groupId>
- <artifactId>xercesMinimal</artifactId>
- <version>1.9.6.2</version>
+ <groupId>xerces</groupId>
+ <artifactId>xerces</artifactId>
+ <version>2.9.0</version>
</dependency>
<dependency>
<groupId>nekohtml</groupId>