summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2014-10-03 21:30:29 (GMT)
committerDavid A. Madore <david+git@madore.org>2014-10-03 21:32:45 (GMT)
commit4c2f3f483afb8835e0845046d575adc087dd17e4 (patch)
tree3a76d31d9b7986ec18dee2d953b095bfc1c61809
parent7e17584157bfe02fc2f9cb5d8102892297673911 (diff)
downloaddamlengine-4c2f3f483afb8835e0845046d575adc087dd17e4.zip
damlengine-4c2f3f483afb8835e0845046d575adc087dd17e4.tar.gz
damlengine-4c2f3f483afb8835e0845046d575adc087dd17e4.tar.bz2
Start writing a servlet version. NOT USABLE YET.
-rw-r--r--org/madore/damlengine/DamlEngine.java1
-rw-r--r--org/madore/damlengine/WeblogServlet.java36
2 files changed, 37 insertions, 0 deletions
diff --git a/org/madore/damlengine/DamlEngine.java b/org/madore/damlengine/DamlEngine.java
index a0299ad..9ac0c08 100644
--- a/org/madore/damlengine/DamlEngine.java
+++ b/org/madore/damlengine/DamlEngine.java
@@ -153,6 +153,7 @@ public final class DamlEngine {
fullProcess(in, out, null);
}
+ public static boolean runAsServlet = false;
public static Properties appProps;
public static Path basePath;
public static Path templatePath;
diff --git a/org/madore/damlengine/WeblogServlet.java b/org/madore/damlengine/WeblogServlet.java
new file mode 100644
index 0000000..181c782
--- /dev/null
+++ b/org/madore/damlengine/WeblogServlet.java
@@ -0,0 +1,36 @@
+package org.madore.damlengine;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ResourceBundle;
+import java.util.Date;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class WeblogServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 2014100301L;
+
+ @Override
+ public void doGet(HttpServletRequest request,
+ HttpServletResponse response)
+ throws IOException, ServletException
+ {
+ DamlEngine.runAsServlet = true;
+ response.setContentType("text/html; charset=utf-8");
+ response.setCharacterEncoding("UTF-8");
+ OutputStream out = response.getOutputStream();
+ final int number = 1729;
+ try {
+ WeblogSelect.fullProcess(new Context.WeblogSingleSelectionContext(number),
+ out);
+ } catch (Exception e) {
+ throw new ServletException("exception during WeblogSelect.fullProcess()", e);
+ }
+ }
+}