]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1217] Switch to Jetty 6.1.19
authorBrett Porter <brett@apache.org>
Thu, 16 Jul 2009 06:57:47 +0000 (06:57 +0000)
committerBrett Porter <brett@apache.org>
Thu, 16 Jul 2009 06:57:47 +0000 (06:57 +0000)
[MRM-1218] Upgrade to JSP 2.1

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@794554 13f79535-47bb-0310-9956-ffa450edef68

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

index ef54b960157fa439efdc3a1da3ef8fb3451f38f2..badd17e859c9db3dcd03d144f21253a8e76b51bc 100644 (file)
     </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>    
       <version>1.6.5</version>
       <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>
index 730371db3f35017b175856fb9c13de633820711e..2a5f3466b24954e4ed5b8f6d703ca53af2ac3d4c 100644 (file)
@@ -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
index 4df207416b475f7e55047d95c3645e407dbdc02d..6fd36c07c36c98529a251bd841c68184d62a0d83 100644 (file)
@@ -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, "\\", "/" );
index c5eeb4a2020a35aa15bd100cbd3fd7612da3aaff..81d0c4b05c6c3d73764ff2b89ce36054bc81509a 100644 (file)
@@ -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 );
 
index fe1a6be639bdf24dd4caad7c649713ede4dc3a10..190855ffa2830842848df624a1492f1d34cdf4c9 100644 (file)
@@ -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 )
index f8441f7551db3940d5a06450d61fc8d56a37daf7..504f1a049d874acdb19dcaad3f616f175115282b 100644 (file)
@@ -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 ec9188bcd4200c9944bd33c24d2515bd9efad9fa..52ab923d11341f597f55fc72d6a43d12fe33611d 100644 (file)
--- a/pom.xml
+++ b/pom.xml
     <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>