From 31d9df399ba6fa4a22f732fe29c2009cbdbf2500 Mon Sep 17 00:00:00 2001 From: ulrich Date: Sun, 09 Jan 2022 14:39:45 +0000 Subject: [PATCH] Logging entfernt --- src/de/uhilger/httpserver/template/TemplateActor.java | 14 ++++++-------- 1 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/de/uhilger/httpserver/template/TemplateActor.java b/src/de/uhilger/httpserver/template/TemplateActor.java index 87f51e6..b39e66b 100644 --- a/src/de/uhilger/httpserver/template/TemplateActor.java +++ b/src/de/uhilger/httpserver/template/TemplateActor.java @@ -21,14 +21,11 @@ import com.github.mustachejava.MustacheFactory; import com.sun.net.httpserver.HttpExchange; import de.uhilger.httpserver.base.HttpHelper; -import de.uhilger.httpserver.base.HttpResponder; import de.uhilger.httpserver.base.handler.FileHandler; import java.io.File; import java.io.IOException; -import java.io.OutputStream; import java.io.StringWriter; import java.util.Map; -import java.util.logging.Logger; /** * Der TemplateActor rendert den Inhalt einer Map in @@ -39,13 +36,11 @@ */ public class TemplateActor { - private static final Logger logger = Logger.getLogger(TemplateActor.class.getName()); - public static final String STR_DOT = "."; public static final String STR_EMPTY = ""; public static final String STR_SLASH = "/"; - public static final String ATTR_TEMPLATE = "template"; + //public static final String ATTR_TEMPLATE = "template"; //public static final String WELCOME_FILE = "index.htmi"; @@ -63,19 +58,22 @@ * @return das ausgefuellte Template * @throws IOException */ - public String render(HttpExchange exchange, Map data) throws IOException { + public String render(HttpExchange exchange, Object data, String template) throws IOException { MustacheFactory mf; Mustache m; HttpHelper helper = new HttpHelper(); Map attributes = exchange.getHttpContext().getAttributes(); String fileBase = helper.getAttrStr(attributes, FileHandler.ATTR_FILE_BASE, STR_EMPTY); File fileRoot = new File(fileBase); - String template = helper.getAttrStr(attributes, ATTR_TEMPLATE, STR_EMPTY); + //logger.fine("fileRoot: " + fileRoot.getAbsolutePath()); + //String template = helper.getAttrStr(attributes, ATTR_TEMPLATE, STR_EMPTY); File templateFile = new File(fileRoot, template); if(templateFile.exists()) { + //logger.fine("using template " + templateFile.getAbsolutePath()); mf = new NeonMustacheFactory(fileRoot); m = mf.compile(template); } else { + //logger.fine("template " + templateFile.getAbsolutePath() + " not found"); mf = new NeonMustacheFactory(); m = mf.compile(template); } -- Gitblit v1.9.3