You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by br...@apache.org on 2009/07/16 08:57:47 UTC

svn commit: r794554 - in /archiva/trunk: ./ archiva-jetty/ archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/ archiva-...

Author: brett
Date: Thu Jul 16 06:57:47 2009
New Revision: 794554

URL: http://svn.apache.org/viewvc?rev=794554&view=rev
Log:
[MRM-1217] Switch to Jetty 6.1.19
[MRM-1218] Upgrade to JSP 2.1

Modified:
    archiva/trunk/archiva-jetty/pom.xml
    archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletTestCase.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletProxiedPassthroughTest.java
    archiva/trunk/pom.xml

Modified: archiva/trunk/archiva-jetty/pom.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-jetty/pom.xml?rev=794554&r1=794553&r2=794554&view=diff
==============================================================================
--- archiva/trunk/archiva-jetty/pom.xml (original)
+++ archiva/trunk/archiva-jetty/pom.xml Thu Jul 16 06:57:47 2009
@@ -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>

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java?rev=794554&r1=794553&r2=794554&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java Thu Jul 16 06:57:47 2009
@@ -380,6 +380,10 @@
                 }
 
                 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 @@
         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 @@
         }
 
         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 @@
         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

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java?rev=794554&r1=794553&r2=794554&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java Thu Jul 16 06:57:47 2009
@@ -78,16 +78,16 @@
     {
         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, "\\", "/" );

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java?rev=794554&r1=794553&r2=794554&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java Thu Jul 16 06:57:47 2009
@@ -19,8 +19,7 @@
  * 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.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 @@
             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 @@
 
         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 );
 

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletTestCase.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletTestCase.java?rev=794554&r1=794553&r2=794554&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletTestCase.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/AbstractRepositoryServletTestCase.java Thu Jul 16 06:57:47 2009
@@ -87,7 +87,15 @@
     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 )

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletProxiedPassthroughTest.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletProxiedPassthroughTest.java?rev=794554&r1=794553&r2=794554&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletProxiedPassthroughTest.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletProxiedPassthroughTest.java Thu Jul 16 06:57:47 2009
@@ -143,7 +143,7 @@
                 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:

Modified: archiva/trunk/pom.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/pom.xml?rev=794554&r1=794553&r2=794554&view=diff
==============================================================================
--- archiva/trunk/pom.xml (original)
+++ archiva/trunk/pom.xml Thu Jul 16 06:57:47 2009
@@ -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>