@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) public boolean setDocBase ( String basePath ) { proxyDirContext = null ; if ( basePath == null ) return false ; Hashtable env = new Hashtable ( ) ; File file = new File ( basePath ) ; if ( ! file . exists ( ) ) return false ; if ( ! file . isDirectory ( ) ) return false ; env . put ( ProxyDirContext . CONTEXT , file . getPath ( ) ) ; FileDirContext fileContext = new FileDirContext ( env ) ; fileContext . setDocBase ( file . getPath ( ) ) ; proxyDirContext = new ProxyDirContext ( env , fileContext ) ; /* Can't figure this one out InitialContext cx = null; try { cx.rebind(RESOURCES_JNDI_NAME, obj); } catch (NamingException e) { e.printStackTrace(); } */ // Load the proxy dir context. return true ; }
Set the local file path to serve files from .