diff options
Diffstat (limited to 'org/madore/damlengine/WeblogServlet.java')
-rw-r--r-- | org/madore/damlengine/WeblogServlet.java | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/org/madore/damlengine/WeblogServlet.java b/org/madore/damlengine/WeblogServlet.java index 6b9b738..9cf1a75 100644 --- a/org/madore/damlengine/WeblogServlet.java +++ b/org/madore/damlengine/WeblogServlet.java @@ -28,7 +28,7 @@ import javax.servlet.http.HttpServletResponse; public class WeblogServlet extends HttpServlet { - private static final long serialVersionUID = 2014100406L; + private static final long serialVersionUID = 2014100407L; @Override public void doGet(HttpServletRequest request, @@ -36,22 +36,23 @@ public class WeblogServlet extends HttpServlet { throws IOException, ServletException { - DamlEngine.runAsServlet = true; - DamlEngine.appProps = new Properties(); - ServletConfig cfg = getServletConfig(); - for (Enumeration<String> e = cfg.getInitParameterNames() ; e.hasMoreElements() ; ) { - String k = e.nextElement(); - DamlEngine.appProps.setProperty(k, cfg.getInitParameter(k)); - } - - if ( DamlEngine.appProps.getProperty("base_path") != null ) - DamlEngine.basePath = Paths.get(DamlEngine.appProps.getProperty("base_path")); - if ( DamlEngine.basePath == null ) - DamlEngine.basePath = Paths.get(getServletContext().getRealPath("/")); - if ( DamlEngine.appProps.getProperty("template_path") != null ) - DamlEngine.templatePath = Paths.get(DamlEngine.appProps.getProperty("template_path")); - if ( DamlEngine.templatePath == null ) - DamlEngine.templatePath = DamlEngine.basePath.resolve("templates"); + synchronized ( DamlEngine.class ) { if ( DamlEngine.appProps == null ) { + DamlEngine.runAsServlet = true; + DamlEngine.appProps = new Properties(); + ServletConfig cfg = getServletConfig(); + for (Enumeration<String> e = cfg.getInitParameterNames() ; e.hasMoreElements() ; ) { + String k = e.nextElement(); + DamlEngine.appProps.setProperty(k, cfg.getInitParameter(k)); + } + if ( DamlEngine.appProps.getProperty("base_path") != null ) + DamlEngine.basePath = Paths.get(DamlEngine.appProps.getProperty("base_path")); + if ( DamlEngine.basePath == null ) + DamlEngine.basePath = Paths.get(getServletContext().getRealPath("/")); + if ( DamlEngine.appProps.getProperty("template_path") != null ) + DamlEngine.templatePath = Paths.get(DamlEngine.appProps.getProperty("template_path")); + if ( DamlEngine.templatePath == null ) + DamlEngine.templatePath = DamlEngine.basePath.resolve("templates"); + } } response.setContentType("text/html; charset=utf-8"); response.setCharacterEncoding("UTF-8"); |