summaryrefslogtreecommitdiffstats
path: root/org/madore
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2014-10-07 14:38:33 +0200
committerDavid A. Madore <david+git@madore.org>2014-10-07 14:38:33 +0200
commitcfbf81150814c26e733480fa01a2eeb4541c068d (patch)
treec17f1340febd285ee72d429232f753418f744c2e /org/madore
parent2b09cdd9abce74d1a3e51ed1d02447c8ca243851 (diff)
downloaddamlengine-cfbf81150814c26e733480fa01a2eeb4541c068d.tar.gz
damlengine-cfbf81150814c26e733480fa01a2eeb4541c068d.tar.bz2
damlengine-cfbf81150814c26e733480fa01a2eeb4541c068d.zip
WeblogServlet: Take an entry number as input (request path).
Diffstat (limited to 'org/madore')
-rw-r--r--org/madore/damlengine/WeblogServlet.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/org/madore/damlengine/WeblogServlet.java b/org/madore/damlengine/WeblogServlet.java
index 4baf055..f9d23e3 100644
--- a/org/madore/damlengine/WeblogServlet.java
+++ b/org/madore/damlengine/WeblogServlet.java
@@ -1,5 +1,7 @@
package org.madore.damlengine;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
import java.util.Properties;
import java.util.Enumeration;
import java.io.IOException;
@@ -58,10 +60,20 @@ public class WeblogServlet extends HttpServlet {
HttpServletResponse response)
throws IOException, ServletException
{
+ Matcher matcher;
+ int number = -1;
+ if ( (matcher=Pattern.compile("/(\\d{1,7})").matcher(request.getPathInfo())).matches() ) {
+ try {
+ number = Integer.parseInt(matcher.group(1));
+ } catch (NumberFormatException e) { }
+ }
+ if ( number == -1 ) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
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);