public boolean locateFileToServe ( FileRequestContext context ) throws IOException { context . file = new File ( contentDir , context . path ) ; // if the path is not on the file system, send a 404. if ( ! context . file . exists ( ) ) { context . response . sendError ( HttpServletResponse . SC_NOT_FOUND ) ; return true ; } // redirect welcome files if needed. if ( handleWelcomeRedirect ( context ) ) return true ; // if the requested file is a directory, try to find the welcome file. if ( context . file . isDirectory ( ) ) { context . file = new File ( context . file , "index.html" ) ; } // if the file does not exist, then terminate with a 404. if ( ! context . file . exists ( ) ) { context . response . sendError ( HttpServletResponse . SC_NOT_FOUND ) ; return true ; } return false ; }
Locates the file to serve . Returns true if locating the file caused the request to be handled .