]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1796] support artifacts larger than 4G
authorBrett Porter <brett@apache.org>
Wed, 25 Jun 2014 04:22:18 +0000 (14:22 +1000)
committerBrett Porter <brett@apache.org>
Wed, 25 Jun 2014 04:22:18 +0000 (14:22 +1000)
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java

index d08a3700df268a24a9eaf424a771be0341966581..f359c9c77bfe3f0745deba67f6e09c093b6eedc7 100644 (file)
@@ -32,6 +32,7 @@ import javax.servlet.http.HttpServletResponse;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.util.Text;
+import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.webdav.DavException;
 import org.apache.jackrabbit.webdav.DavResource;
 import org.apache.jackrabbit.webdav.DavResourceFactory;
@@ -199,7 +200,7 @@ public class ArchivaDavResource
     {
         if ( !isCollection() )
         {
-            outputContext.setContentLength( localResource.length() );
+            outputContext.setProperty( DavConstants.HEADER_CONTENT_LENGTH, Long.toString( localResource.length() ) );
             outputContext.setContentType( mimeTypes.getMimeType( localResource.getName() ) );
         }
 
@@ -310,7 +311,7 @@ public class ArchivaDavResource
             }
 
             // TODO: a bad deployment shouldn't delete an existing file - do we need to write to a temporary location first?
-            long expectedContentLength = inputContext.getContentLength();
+            long expectedContentLength = Long.parseLong( inputContext.getProperty( DavConstants.HEADER_CONTENT_LENGTH ) );
             long actualContentLength = localFile.length();
             // length of -1 is given for a chunked request or unknown length, in which case we accept what was uploaded
             if ( expectedContentLength >= 0 && expectedContentLength != actualContentLength )