From: Brett Porter Date: Thu, 16 Jul 2009 06:57:47 +0000 (+0000) Subject: [MRM-1217] Switch to Jetty 6.1.19 X-Git-Tag: archiva-1.2.2~39 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1ef459b78ea7b680ffb372cab215a114e95ef27d;p=archiva.git [MRM-1217] Switch to Jetty 6.1.19 [MRM-1218] Upgrade to JSP 2.1 git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@794554 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-jetty/pom.xml b/archiva-jetty/pom.xml index ef54b9601..badd17e85 100644 --- a/archiva-jetty/pom.xml +++ b/archiva-jetty/pom.xml @@ -39,13 +39,7 @@ org.mortbay.jetty - servlet-api-2.5 - ${jetty.version} - runtime - - - org.mortbay.jetty - jsp-api-2.0 + jsp-2.1-jetty ${jetty.version} runtime @@ -73,64 +67,6 @@ 1.6.5 runtime - - commons-el - commons-el - 1.0 - runtime - - - commons-logging - commons-logging - - - - - tomcat - jasper-compiler - 5.5.15 - runtime - - - javax.servlet - jsp-api - - - - - tomcat - jasper-runtime - 5.5.15 - runtime - - - javax.servlet - servlet-api - - - - - org.slf4j - jcl104-over-slf4j - runtime - - - org.slf4j - slf4j-simple - runtime - - - tomcat - jasper-compiler-jdt - 5.5.15 - runtime - - - org.eclipse.jdt - core - - - commons-dbcp commons-dbcp diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java index 730371db3..2a5f3466b 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java @@ -380,6 +380,10 @@ public class ArchivaDavResourceFactory } String logicalResource = RepositoryPathUtil.getLogicalResource( archivaLocator.getResourcePath() ); + if ( logicalResource.endsWith( "/" ) ) + { + logicalResource = logicalResource.substring( 1 ); + } resourcesInAbsolutePath.add( new File( managedRepository.getRepoRoot(), logicalResource ).getAbsolutePath() ); } catch ( DavException e ) @@ -409,12 +413,16 @@ public class ArchivaDavResourceFactory DavResource resource = null; if ( isAuthorized( request, managedRepository.getId() ) ) { - LogicalResource logicalResource = - new LogicalResource( RepositoryPathUtil.getLogicalResource( archivaLocator.getResourcePath() ) ); + String path = RepositoryPathUtil.getLogicalResource( archivaLocator.getResourcePath() ); + if ( path.startsWith( "/" ) ) + { + path = path.substring( 1 ); + } + LogicalResource logicalResource = new LogicalResource( path ); - File resourceFile = new File( managedRepository.getRepoRoot(), logicalResource.getPath() ); + File resourceFile = new File( managedRepository.getRepoRoot(), path ); resource = - new ArchivaDavResource( resourceFile.getAbsolutePath(), logicalResource.getPath(), + new ArchivaDavResource( resourceFile.getAbsolutePath(), path, managedRepository.getRepository(), request.getRemoteAddr(), activePrincipal, request.getDavSession(), archivaLocator, this, mimeTypes, auditListeners, scheduler ); @@ -520,6 +528,10 @@ public class ArchivaDavResourceFactory } String logicalResource = RepositoryPathUtil.getLogicalResource( locator.getResourcePath() ); + if ( logicalResource.startsWith( "/" ) ) + { + logicalResource = logicalResource.substring( 1 ); + } File resourceFile = new File( managedRepository.getRepoRoot(), logicalResource ); DavResource resource = new ArchivaDavResource( resourceFile.getAbsolutePath(), logicalResource, managedRepository.getRepository(), @@ -810,8 +822,12 @@ public class ArchivaDavResourceFactory throws DavException { List mergedRepositoryContents = new ArrayList(); - LogicalResource logicalResource = - new LogicalResource( RepositoryPathUtil.getLogicalResource( locator.getResourcePath() ) ); + String path = RepositoryPathUtil.getLogicalResource( locator.getResourcePath() ); + if ( path.startsWith( "/" ) ) + { + path = path.substring( 1 ); + } + LogicalResource logicalResource = new LogicalResource( path ); // flow: // if the current user logged in has permission to any of the repositories, allow user to diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java index 4df207416..6fd36c07c 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java @@ -78,16 +78,16 @@ public class IndexWriter { writer.println(""); writer.println(""); - writer.println("Collection: " + logicalResource + ""); + writer.println("Collection: /" + logicalResource + ""); writer.println(""); writer.println(""); - writer.println("

Collection: " + logicalResource + "

"); + writer.println("

Collection: /" + logicalResource + "

"); //Check if not root - if (!"/".equals(logicalResource)) + if (logicalResource.length() > 0) { File file = new File(logicalResource); - String parentName = file.getParent().equals("") ? "/" : file.getParent(); + String parentName = file.getParent() == null ? "/" : file.getParent(); //convert to unix path in case archiva is hosted on windows parentName = StringUtils.replace(parentName, "\\", "/" ); diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java index c5eeb4a20..81d0c4b05 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java @@ -19,8 +19,7 @@ package org.apache.maven.archiva.webdav; * under the License. */ -import com.meterware.httpunit.WebConversation; -import com.meterware.httpunit.WebResponse; +import java.io.File; import org.apache.commons.io.FileUtils; import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration; @@ -29,15 +28,14 @@ import org.apache.maven.archiva.policies.CachedFailuresPolicy; import org.apache.maven.archiva.policies.ChecksumPolicy; import org.apache.maven.archiva.policies.ReleasesPolicy; import org.apache.maven.archiva.policies.SnapshotsPolicy; -import org.mortbay.jetty.Connector; import org.mortbay.jetty.Server; -import org.mortbay.jetty.bio.SocketConnector; import org.mortbay.jetty.handler.ContextHandler; import org.mortbay.jetty.handler.ContextHandlerCollection; import org.mortbay.jetty.servlet.DefaultServlet; import org.mortbay.jetty.servlet.ServletHandler; -import java.io.File; +import com.meterware.httpunit.WebConversation; +import com.meterware.httpunit.WebResponse; /** * AbstractRepositoryServletProxiedTestCase @@ -121,15 +119,10 @@ public abstract class AbstractRepositoryServletProxiedTestCase repo.root.mkdirs(); } - repo.server = new Server(); + repo.server = new Server( 0 ); ContextHandlerCollection contexts = new ContextHandlerCollection(); repo.server.setHandler( contexts ); - SocketConnector connector = new SocketConnector(); - connector.setPort( 0 ); // 0 means, choose and empty port. (we'll find out which, later) - - repo.server.setConnectors( new Connector[] { connector } ); - ContextHandler context = new ContextHandler(); context.setContextPath( repo.context ); context.setResourceBase( repo.root.getAbsolutePath() ); @@ -142,7 +135,7 @@ public abstract class AbstractRepositoryServletProxiedTestCase repo.server.start(); - int port = connector.getLocalPort(); + int port = repo.server.getConnectors()[0].getLocalPort(); repo.url = "http://localhost:" + port + repo.context; System.out.println( "Remote HTTP Server started on " + repo.url ); diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletTestCase.java index fe1a6be63..190855ffa 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletTestCase.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletTestCase.java @@ -87,7 +87,15 @@ public abstract class AbstractRepositoryServletTestCase protected void assertResponseOK( WebResponse response ) { assertNotNull( "Should have recieved a response", response ); - Assert.assertEquals( "Should have been an OK response code.", HttpServletResponse.SC_OK, response.getResponseCode() ); + Assert.assertEquals( "Should have been an OK response code", HttpServletResponse.SC_OK, + response.getResponseCode() ); + } + + protected void assertResponseOK( WebResponse response, String path ) + { + assertNotNull( "Should have recieved a response", response ); + Assert.assertEquals( "Should have been an OK response code for path: " + path, HttpServletResponse.SC_OK, + response.getResponseCode() ); } protected void assertResponseNotFound( WebResponse response ) diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletProxiedPassthroughTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletProxiedPassthroughTest.java index f8441f755..504f1a049 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletProxiedPassthroughTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletProxiedPassthroughTest.java @@ -143,7 +143,7 @@ public class RepositoryServletProxiedPassthroughTest assertEquals( "Expected managed file contents", expectedManagedContents, response.getText() ); break; case EXPECT_REMOTE_CONTENTS: - assertResponseOK( response ); + assertResponseOK( response, path ); assertEquals( "Expected remote file contents", expectedRemoteContents, response.getText() ); break; case EXPECT_NOT_FOUND: diff --git a/pom.xml b/pom.xml index ec9188bcd..52ab923d1 100644 --- a/pom.xml +++ b/pom.xml @@ -1083,7 +1083,7 @@ 2.0.8 1.0-beta-5 1.2.1 - 6.1.6 + 6.1.19 0.9 2.5.6