]> 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)
committerOlivier Lamy <olamy@apache.org>
Wed, 25 Jun 2014 06:23:53 +0000 (16:23 +1000)
[MRM-1796] support artifacts larger than 4G

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

index c1c73eee875de9753edd53914dcf235f7ee44443..2257467b42854eaba34472bce8c8180ca88c53f0 100644 (file)
@@ -35,6 +35,7 @@ import org.apache.archiva.webdav.util.MimeTypes;
 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;
@@ -211,7 +212,8 @@ public class ArchivaDavResource
     {
         if ( !isCollection() )
         {
-            outputContext.setContentLength( localResource.length() );
+            //outputContext.setContentLength( localResource.length() );
+            outputContext.setProperty( DavConstants.HEADER_CONTENT_LENGTH, Long.toString( localResource.length() ) );
             outputContext.setContentType( mimeTypes.getMimeType( localResource.getName() ) );
         }
 
@@ -329,7 +331,8 @@ 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 = 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 )