diff options
author | Brett Porter <brett@apache.org> | 2009-07-16 06:57:47 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2009-07-16 06:57:47 +0000 |
commit | 1ef459b78ea7b680ffb372cab215a114e95ef27d (patch) | |
tree | 1b4428ffcd71b7b72341e38e23558b0100423418 | |
parent | 02aefefeab7f7292cd18f64021e05cf714e5de23 (diff) | |
download | archiva-1ef459b78ea7b680ffb372cab215a114e95ef27d.tar.gz archiva-1ef459b78ea7b680ffb372cab215a114e95ef27d.zip |
[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
7 files changed, 43 insertions, 90 deletions
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 @@ </dependency> <dependency> <groupId>org.mortbay.jetty</groupId> - <artifactId>servlet-api-2.5</artifactId> - <version>${jetty.version}</version> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.mortbay.jetty</groupId> - <artifactId>jsp-api-2.0</artifactId> + <artifactId>jsp-2.1-jetty</artifactId> <version>${jetty.version}</version> <scope>runtime</scope> </dependency> @@ -74,64 +68,6 @@ <scope>runtime</scope> </dependency> <dependency> - <groupId>commons-el</groupId> - <artifactId>commons-el</artifactId> - <version>1.0</version> - <scope>runtime</scope> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>tomcat</groupId> - <artifactId>jasper-compiler</artifactId> - <version>5.5.15</version> - <scope>runtime</scope> - <exclusions> - <exclusion> - <groupId>javax.servlet</groupId> - <artifactId>jsp-api</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>tomcat</groupId> - <artifactId>jasper-runtime</artifactId> - <version>5.5.15</version> - <scope>runtime</scope> - <exclusions> - <exclusion> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl104-over-slf4j</artifactId> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-simple</artifactId> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>tomcat</groupId> - <artifactId>jasper-compiler-jdt</artifactId> - <version>5.5.15</version> - <scope>runtime</scope> - <exclusions> - <exclusion> - <groupId>org.eclipse.jdt</groupId> - <artifactId>core</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.2.1</version> 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<File> mergedRepositoryContents = new ArrayList<File>(); - 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("<html>"); writer.println("<head>"); - writer.println("<title>Collection: " + logicalResource + "</title>"); + writer.println("<title>Collection: /" + logicalResource + "</title>"); writer.println("</head>"); writer.println("<body>"); - writer.println("<h3>Collection: " + logicalResource + "</h3>"); + writer.println("<h3>Collection: /" + logicalResource + "</h3>"); //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: @@ -1083,7 +1083,7 @@ <maven.version>2.0.8</maven.version> <wagon.version>1.0-beta-5</wagon.version> <redback.version>1.2.1</redback.version> - <jetty.version>6.1.6</jetty.version> + <jetty.version>6.1.19</jetty.version> <binder.version>0.9</binder.version> <spring.version>2.5.6</spring.version> </properties> |