Skip to content

Instantly share code, notes, and snippets.

@rbackhouse
Created February 28, 2011 20:48
Show Gist options
  • Save rbackhouse/848002 to your computer and use it in GitHub Desktop.
Save rbackhouse/848002 to your computer and use it in GitHub Desktop.
File Based Resource Loader extending CachingResourceLoader
import java.io.File;
import java.io.IOException;
import java.net.URL;
public class FileBasedResourceLoader extends CachingResourceLoader {
private File root = null;
public FileBasedResourceLoader(File root) {
this.root = root;
}
protected URL _getResource(String path) throws IOException {
File resourceFile = new File(root, path);
if (resourceFile.exists()) {
timestampLookup.put(path, resourceFile.toURI().toURL());
return resourceFile.toURI().toURL();
} else {
return null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment