]> source.dussan.org Git - archiva.git/commitdiff
MRM-867 - 500 on HTTP HEAD
authorJames William Dumay <jdumay@apache.org>
Tue, 8 Jul 2008 01:28:19 +0000 (01:28 +0000)
committerJames William Dumay <jdumay@apache.org>
Tue, 8 Jul 2008 01:28:19 +0000 (01:28 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@674698 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaVirtualDavResource.java

index 0aadb3c732fe36fb4178c820221166d17bb1040d..0472b7f68ca7839e28a2f455fa1cf891e533d73f 100644 (file)
@@ -183,14 +183,17 @@ public class ArchivaDavResource
     public void spool( OutputContext outputContext )
         throws IOException
     {
-        if ( !isCollection() )
+        if ( !isCollection())
+        {
+            outputContext.setContentLength( localResource.length() );
+            outputContext.setContentType( mimeTypes.getMimeType( localResource.getName() ) );
+        }
+        
+        if ( !isCollection() && outputContext.hasStream() )
         {
             FileInputStream is = null;
             try
             {
-                outputContext.setContentLength( localResource.length() );
-                outputContext.setContentType( mimeTypes.getMimeType( localResource.getName() ) );
-
                 // Write content to stream
                 is = new FileInputStream( localResource );
                 IOUtils.copy( is, outputContext.getOutputStream() );
@@ -200,7 +203,7 @@ public class ArchivaDavResource
                 IOUtils.closeQuietly( is );
             }
         }
-        else
+        else if (outputContext.hasStream())
         {
             IndexWriter writer = new IndexWriter( this, localResource, logicalResource );
             writer.write( outputContext );
index af671f5875c649cd18b0dd6aab2dcec9fabe4621..f5ada0b7283b5f18a74cb0582793708bfe85714e 100644 (file)
@@ -94,19 +94,22 @@ public class ArchivaVirtualDavResource
     public void spool( OutputContext outputContext )
         throws IOException
     {
-        Collections.sort( localResources );
-        List<File> localResourceFiles = new ArrayList<File>();
-
-        for ( File resourceFile : localResources )
+        if (outputContext.hasStream())
         {
-            if ( resourceFile.exists() )
+            Collections.sort( localResources );
+            List<File> localResourceFiles = new ArrayList<File>();
+
+            for ( File resourceFile : localResources )
             {
-                localResourceFiles.add( resourceFile );
+                if ( resourceFile.exists() )
+                {
+                    localResourceFiles.add( resourceFile );
+                }
             }
-        }
 
-        IndexWriter writer = new IndexWriter( this, localResourceFiles, logicalResource );
-        writer.write( outputContext );
+            IndexWriter writer = new IndexWriter( this, localResourceFiles, logicalResource );
+            writer.write( outputContext );
+        }
     }
 
     public void addLockManager( LockManager arg0 )