@Test void testGetResource() { AliasedDirectoryResource resource = new AliasedDirectoryResource(null, "/alias"); assertNull(resource.getResource("resource")); }
@Override public URL getResource(String location) { URL result = null; if (location.startsWith(alias)) { location = location.substring(alias.length()); File file = new File(rootDirectory, location); if (file.exists()) { try { result = file.toURI().toURL(); } catch (MalformedURLException exception) { } } } return result; }
AliasedDirectoryResource implements Resource { @Override public URL getResource(String location) { URL result = null; if (location.startsWith(alias)) { location = location.substring(alias.length()); File file = new File(rootDirectory, location); if (file.exists()) { try { result = file.toURI().toURL(); } catch (MalformedURLException exception) { } } } return result; } }
AliasedDirectoryResource implements Resource { @Override public URL getResource(String location) { URL result = null; if (location.startsWith(alias)) { location = location.substring(alias.length()); File file = new File(rootDirectory, location); if (file.exists()) { try { result = file.toURI().toURL(); } catch (MalformedURLException exception) { } } } return result; } AliasedDirectoryResource();  AliasedDirectoryResource(File rootDirectory, String alias); }
AliasedDirectoryResource implements Resource { @Override public URL getResource(String location) { URL result = null; if (location.startsWith(alias)) { location = location.substring(alias.length()); File file = new File(rootDirectory, location); if (file.exists()) { try { result = file.toURI().toURL(); } catch (MalformedURLException exception) { } } } return result; } AliasedDirectoryResource();  AliasedDirectoryResource(File rootDirectory, String alias); @Override URL getResource(String location); @Override InputStream getResourceAsStream(String location); @Override Stream<String> getAllLocations(); String getAlias(); File getRootDirectory(); void setAlias(String alias); void setRootDirectory(File rootDirectory); }
AliasedDirectoryResource implements Resource { @Override public URL getResource(String location) { URL result = null; if (location.startsWith(alias)) { location = location.substring(alias.length()); File file = new File(rootDirectory, location); if (file.exists()) { try { result = file.toURI().toURL(); } catch (MalformedURLException exception) { } } } return result; } AliasedDirectoryResource();  AliasedDirectoryResource(File rootDirectory, String alias); @Override URL getResource(String location); @Override InputStream getResourceAsStream(String location); @Override Stream<String> getAllLocations(); String getAlias(); File getRootDirectory(); void setAlias(String alias); void setRootDirectory(File rootDirectory);  }