summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine/WeblogServlet.java
diff options
context:
space:
mode:
Diffstat (limited to 'org/madore/damlengine/WeblogServlet.java')
-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);