1 package net.pterodactylus.sone.main;
5 import net.pterodactylus.sone.template.FilesystemTemplate;
6 import net.pterodactylus.sone.web.ReloadingPage;
7 import net.pterodactylus.util.template.FilesystemTemplateProvider;
8 import net.pterodactylus.util.template.Template;
9 import net.pterodactylus.util.template.TemplateProvider;
10 import net.pterodactylus.util.web.Page;
11 import net.pterodactylus.util.web.Request;
14 * {@link Loaders} implementation that loads all resources from the filesystem.
16 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
18 public class DebugLoaders implements Loaders {
20 private final String filesystemPath;
22 public DebugLoaders(String filesystemPath) {
23 this.filesystemPath = filesystemPath;
27 public Template loadTemplate(String path) {
28 return new FilesystemTemplate(new File(filesystemPath, path).getAbsolutePath());
32 public <REQ extends Request> Page<REQ> loadStaticPage(String basePath, String prefix, String mimeType) {
33 return new ReloadingPage<REQ>(basePath, new File(filesystemPath, prefix).getAbsolutePath(), mimeType);
37 public TemplateProvider getTemplateProvider() {
38 return new FilesystemTemplateProvider(new File(filesystemPath, "/templates/").getAbsolutePath());