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() );
IOUtils.closeQuietly( is );
}
}
- else
+ else if (outputContext.hasStream())
{
IndexWriter writer = new IndexWriter( this, localResource, logicalResource );
writer.write( outputContext );
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 )