summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);