private void locateUriRoot ( File f ) { String tUriBase = uriBase ; if ( tUriBase == null ) { tUriBase = "/" ; } try { if ( f . exists ( ) ) { f = new File ( f . getCanonicalPath ( ) ) ; while ( f != null ) { File g = new File ( f , "WEB-INF" ) ; if ( g . exists ( ) && g . isDirectory ( ) ) { uriRoot = f . getCanonicalPath ( ) ; uriBase = tUriBase ; if ( log . isLoggable ( Level . INFO ) ) { log . info ( Localizer . getMessage ( "jspc.implicit.uriRoot" , uriRoot ) ) ; } break ; } if ( f . exists ( ) && f . isDirectory ( ) ) { tUriBase = "/" + f . getName ( ) + "/" + tUriBase ; } String fParent = f . getParent ( ) ; if ( fParent == null ) { break ; } else { f = new File ( fParent ) ; } // If there is no acceptible candidate, uriRoot will // remain null to indicate to the CompilerContext to // use the current working/user dir. } if ( uriRoot != null ) { File froot = new File ( uriRoot ) ; uriRoot = froot . getCanonicalPath ( ) ; } } } catch ( IOException ioe ) { // since this is an optional default and a null value // for uriRoot has a non-error meaning, we can just // pass straight through } }
Find the WEB - INF dir by looking up in the directory tree . This is used if no explicit docbase is set but only files . XXX Maybe we should require the docbase .