summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web/archiva-webdav
diff options
context:
space:
mode:
authorJames William Dumay <jdumay@apache.org>2008-07-08 01:28:19 +0000
committerJames William Dumay <jdumay@apache.org>2008-07-08 01:28:19 +0000
commitc74f7ea2b9f6359b74e8dc9777f83e8decafec2e (patch)
tree2e09f8686266c5155c4566ca6028b6c2661e6579 /archiva-modules/archiva-web/archiva-webdav
parent1d5a1c02e257118ba35365cb94a267f6731bfcef (diff)
downloadarchiva-c74f7ea2b9f6359b74e8dc9777f83e8decafec2e.tar.gz
archiva-c74f7ea2b9f6359b74e8dc9777f83e8decafec2e.zip
MRM-867 - 500 on HTTP HEAD
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@674698 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web/archiva-webdav')
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java13
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaVirtualDavResource.java21
2 files changed, 20 insertions, 14 deletions
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java
index 0aadb3c73..0472b7f68 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java
@@ -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 );
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaVirtualDavResource.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaVirtualDavResource.java
index af671f587..f5ada0b72 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaVirtualDavResource.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaVirtualDavResource.java
@@ -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 )