summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2014-10-09 20:02:12 +0200
committerDavid A. Madore <david+git@madore.org>2014-10-09 20:02:12 +0200
commit827925b57dc5ba84e480cf9c66ff2cb13a096780 (patch)
tree6bf7bed3a00efef41f2a0ba1ebb738d8891f7394
parent0abe0182eda83e0b4e41b98a5b22071d90b46c1a (diff)
downloaddamlengine-827925b57dc5ba84e480cf9c66ff2cb13a096780.tar.gz
damlengine-827925b57dc5ba84e480cf9c66ff2cb13a096780.tar.bz2
damlengine-827925b57dc5ba84e480cf9c66ff2cb13a096780.zip
Make up my mind as to what URLs should look like.
-rw-r--r--org/madore/damlengine/WeblogServlet.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/org/madore/damlengine/WeblogServlet.java b/org/madore/damlengine/WeblogServlet.java
index d3b2523..2722616 100644
--- a/org/madore/damlengine/WeblogServlet.java
+++ b/org/madore/damlengine/WeblogServlet.java
@@ -34,7 +34,7 @@ import javax.servlet.http.HttpServletResponse;
public class WeblogServlet extends HttpServlet {
- private static final long serialVersionUID = 2014100704L;
+ private static final long serialVersionUID = 2014100901L;
@Override
public void init(ServletConfig cfg)
@@ -65,18 +65,21 @@ public class WeblogServlet extends HttpServlet {
Matcher matcher;
if ( pathInfo == null )
return new NoSuchPath();
- if ( (matcher=Pattern.compile("/(\\d{1,7})").matcher(pathInfo)).matches() ) {
+ if ( (matcher=Pattern.compile("/d\\.(\\d{4}-\\d{2}-\\d{2})\\.(\\d{4})\\.html").matcher(pathInfo)).matches() ) {
+ final String date;
final int number;
try {
- number = Integer.parseInt(matcher.group(1));
+ date = matcher.group(1);
+ number = Integer.parseInt(matcher.group(2));
} catch (NumberFormatException e) {
return new NoSuchPath();
}
try {
final Connection conn = WeblogDatabaseConnection.getConnection();
final PreparedStatement selSt
- = conn.prepareStatement("SELECT id , extract(epoch from mdate) FROM entries WHERE id=?");
- selSt.setInt(1,number);
+ = conn.prepareStatement("SELECT id , extract(epoch from mdate) FROM entries WHERE edate=? AND id=?");
+ selSt.setString(1,date);
+ selSt.setInt(2,number);
final ResultSet selRes = selSt.executeQuery();
if ( selRes.next() ) {
int id = selRes.getInt(1);