summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2014-10-07 14:02:40 +0200
committerDavid A. Madore <david+git@madore.org>2014-10-07 14:02:40 +0200
commit2b09cdd9abce74d1a3e51ed1d02447c8ca243851 (patch)
tree97f0fd0c13f745e3600057cae4056a93354a8407
parente915feb1602a7d88c39623da055fe68af422d27c (diff)
downloaddamlengine-2b09cdd9abce74d1a3e51ed1d02447c8ca243851.tar.gz
damlengine-2b09cdd9abce74d1a3e51ed1d02447c8ca243851.tar.bz2
damlengine-2b09cdd9abce74d1a3e51ed1d02447c8ca243851.zip
Move servlet initialization in the .init() method.
-rw-r--r--org/madore/damlengine/WeblogServlet.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/org/madore/damlengine/WeblogServlet.java b/org/madore/damlengine/WeblogServlet.java
index 9cf1a75..4baf055 100644
--- a/org/madore/damlengine/WeblogServlet.java
+++ b/org/madore/damlengine/WeblogServlet.java
@@ -28,18 +28,16 @@ import javax.servlet.http.HttpServletResponse;
public class WeblogServlet extends HttpServlet {
- private static final long serialVersionUID = 2014100407L;
+ private static final long serialVersionUID = 2014100701L;
@Override
- public void doGet(HttpServletRequest request,
- HttpServletResponse response)
- throws IOException, ServletException
+ public void init(ServletConfig cfg)
+ throws ServletException
{
-
+ super.init(cfg); // Important!
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));
@@ -53,7 +51,13 @@ public class WeblogServlet extends HttpServlet {
if ( DamlEngine.templatePath == null )
DamlEngine.templatePath = DamlEngine.basePath.resolve("templates");
} }
+ }
+ @Override
+ public void doGet(HttpServletRequest request,
+ HttpServletResponse response)
+ throws IOException, ServletException
+ {
response.setContentType("text/html; charset=utf-8");
response.setCharacterEncoding("UTF-8");
OutputStream out = response.getOutputStream();