@ -439,17 +439,21 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
// attach default file name
// attach default file name
for ( int i = 0 ; i < defaultFiles . length ; i + + ) {
for ( int i = 0 ; i < defaultFiles . length ; i + + ) {
testpath = path + defaultFiles [ i ] ;
testpath = path + defaultFiles [ i ] ;
targetFile = getLocalizedFile ( testpath ) ;
targetFile = getOverlayedFile ( testpath ) ;
targetClass = rewriteClassFile ( new File ( htDefaultPath , testpath ) ) ;
targetClass = getOverlayedClass ( testpath ) ;
if ( ! ( targetFile . exists ( ) ) ) {
targetFile = new File ( htDocsPath , testpath ) ;
targetClass = rewriteClassFile ( targetFile ) ;
}
if ( targetFile . exists ( ) ) {
if ( targetFile . exists ( ) ) {
path = testpath ;
path = testpath ;
break ;
break ;
}
}
}
}
//no defaultfile, send a dirlisting
if ( targetFile = = null | | ! targetFile . exists ( ) ) {
targetFile = getOverlayedFile ( "/htdocsdefault/dir.html" ) ;
targetClass = getOverlayedClass ( "/htdocsdefault/dir.html" ) ;
if ( ! ( ( targetFile ! = null & & targetFile . exists ( ) ) & & ( targetClass ! = null & & targetClass . exists ( ) ) ) ) {
httpd . sendRespondError ( this . connectionProperties , out , 3 , 500 , "dir.html or dir.class not found." , null , null ) ;
}
}
} else {
} else {
//XXX: you cannot share a .png/.gif file with a name like a class in htroot.
//XXX: you cannot share a .png/.gif file with a name like a class in htroot.
if ( ! ( targetFile . exists ( ) ) & & ! ( ( path . endsWith ( "png" ) | | path . endsWith ( "gif" ) | | path . endsWith ( ".stream" ) ) & & targetClass ! = null ) ) {
if ( ! ( targetFile . exists ( ) ) & & ! ( ( path . endsWith ( "png" ) | | path . endsWith ( "gif" ) | | path . endsWith ( ".stream" ) ) & & targetClass ! = null ) ) {
@ -572,14 +576,15 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
path . endsWith ( "rss" ) | |
path . endsWith ( "rss" ) | |
path . endsWith ( "csv" ) | |
path . endsWith ( "csv" ) | |
path . endsWith ( "pac" ) | |
path . endsWith ( "pac" ) | |
path . endsWith ( "src" ) ) {
path . endsWith ( "src" ) | |
path . endsWith ( "/" ) ) {
targetFile = getLocalizedFile ( path ) ;
/ * targetFile = getLocalizedFile ( path ) ;
if ( ! ( targetFile . exists ( ) ) ) {
if ( ! ( targetFile . exists ( ) ) ) {
// try to find that file in the htDocsPath
// try to find that file in the htDocsPath
File trialFile = new File ( htDocsPath , path ) ;
File trialFile = new File ( htDocsPath , path ) ;
if ( trialFile . exists ( ) ) targetFile = trialFile ;
if ( trialFile . exists ( ) ) targetFile = trialFile ;
}
} * /
// call rewrite-class
// call rewrite-class
@ -879,6 +884,25 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
}
}
}
}
private File getOverlayedClass ( String path ) {
File targetClass ;
targetClass = rewriteClassFile ( new File ( htDefaultPath , path ) ) ; //works for default and localized files
if ( targetClass = = null | | ! targetClass . exists ( ) ) {
//works for htdocs
targetClass = rewriteClassFile ( new File ( htDocsPath , path ) ) ;
}
return targetClass ;
}
private File getOverlayedFile ( String path ) {
File targetFile ;
targetFile = getLocalizedFile ( path ) ;
if ( ! ( targetFile . exists ( ) ) ) {
targetFile = new File ( htDocsPath , path ) ;
}
return targetFile ;
}
private void forceConnectionClose ( ) {
private void forceConnectionClose ( ) {
if ( this . connectionProperties ! = null ) {
if ( this . connectionProperties ! = null ) {
this . connectionProperties . setProperty ( httpHeader . CONNECTION_PROP_PERSISTENT , "close" ) ;
this . connectionProperties . setProperty ( httpHeader . CONNECTION_PROP_PERSISTENT , "close" ) ;