public void generateDirectoryListing( UUID sid,
					  OutputStream out )
	throws IOException {


	String title = "Index of " + this.getRequestURI().getPath() + getFormattedLineBreak(2);

	if( this.isHTMLFormat() ) {

	    String cssPath = "/system/styles/directory.list.css";

	    StringBuffer htmlHeader = new StringBuffer();
	    htmlHeader.
		append( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" ).
		append( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \n"  ).
		append( "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"  ).
		append( "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"  ).
		append( "<head>\n"  ).
		append( "<title>Contents of " ).append( this.getRequestURI().getPath() ).append( "</title>\n"  ).
		append( "<link rel=\"icon\" href=\"/favicon.ico\" type=\"image/x-icon\" />\n"  ).
		append( "<link rel=\"stylesheet\" type=\"text/css\" href=\"" ).append( cssPath ).append( "\" />" ).
		append( "</head>\n"  ).
		append( "\n"  ).
		append( "<body>\n"  ).
		append( "\n"  ).
		// append( "<h3><img src=\"icon_mini.png\" alt=\"Icon\" id=\"icon_mini\" /> " ).append( title ).append( "</h3>\n"  ).
		append( "<h2>" ).append( title ).append( "</h2>\n"  ).
		append( "\n" );
		
	    out.write( htmlHeader.toString().getBytes() );
	    
	} else {
 
	    out.write( title.getBytes() );

	}



	// First make the '..' navigation file (if parent exists)
	if( this.isHTMLFormat() && !this.getRequestURI().getPath().equals("/") ) {
	    
	    String parentPath = new File(this.getRequestURI().getPath()).getParent();
	    String parentLink = "<a href=\"" + parentPath + "\">parent dir</a><br/><br/>\n";
	    out.write( parentLink.getBytes() );

	}

	if( this.isHTMLFormat() ) {
	 
	    String tableStart = "<table>\n";
	    out.write( tableStart.getBytes() );
	    
	}


	// Write temp file data into buffer
	int totalTextWidth = this.generateFileListing( out );
	

	Date currentDate = new Date( System.currentTimeMillis() );
	String footLine  = 		
	    getFormattedLineBreak(2) +
	    "Document generated " + this.getDateFormat().format( currentDate ) +
	    getFormattedLineBreak();

	if( this.isHTMLFormat() ) 
	    footLine += "<hr />\n";
	else
	    footLine += CustomUtil.repeat( "=", totalTextWidth ) + getFormattedLineBreak();


	footLine += this.getHTTPHandler().getSoftwareName() + getFormattedLineBreak();

	
	if( this.isHTMLFormat() ) {

	    String htmlFooter =
		"</table>\n" +
		footLine + 
		"</body>\n" +
		"</html>\n";
	    out.write( htmlFooter.getBytes() );

	} else {

	    out.write( footLine.getBytes() );
	    
	}

    }