private boolean tryPath ( StringBuilder prefix , String el , boolean dir ) { String path = prefix + "/" + el ; if ( dir && directoryBrowsingDisallowed ) { path += "/" + xsltdirMarkerName ; } if ( debug ( ) ) { debug ( "trypath: " + path ) ; } try { URL u = new URL ( path ) ; URLConnection uc = u . openConnection ( ) ; if ( ! ( uc instanceof HttpURLConnection ) ) { return false ; } HttpURLConnection huc = ( HttpURLConnection ) uc ; if ( huc . getResponseCode ( ) != 200 ) { return false ; } prefix . append ( "/" ) ; prefix . append ( el ) ; return true ; } catch ( final Throwable t ) { if ( debug ( ) ) { debug ( "trypath exception: " ) ; error ( t ) ; } } return false ; }
Try a path and see if it exists . If so append the element