diff options
author | Vitaly Takmazov | 2016-02-02 14:36:04 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-02-02 14:36:04 +0300 |
commit | bd3892546b51f0d31e959d45c138b009d35b2692 (patch) | |
tree | 3c3945f114472344cc3a8866391fa08f02975143 /src/main/java/com/juick/http/www/RSS.java | |
parent | f2a2660e753fa11478fd3edadfdff9c000b22cc9 (diff) |
spring-jdbc
Diffstat (limited to 'src/main/java/com/juick/http/www/RSS.java')
-rw-r--r-- | src/main/java/com/juick/http/www/RSS.java | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/main/java/com/juick/http/www/RSS.java b/src/main/java/com/juick/http/www/RSS.java index 72893915..c9c9df18 100644 --- a/src/main/java/com/juick/http/www/RSS.java +++ b/src/main/java/com/juick/http/www/RSS.java @@ -19,6 +19,8 @@ package com.juick.http.www; import com.juick.Message; import com.juick.server.MessagesQueries; +import org.springframework.jdbc.core.JdbcTemplate; + import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; @@ -39,7 +41,8 @@ public class RSS { private static final SimpleDateFormat sdfSQL = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private static final SimpleDateFormat sdfRSS = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z"); - protected void doGet(Connection sql, HttpServletRequest request, HttpServletResponse response, int uid, String uname) throws ServletException, IOException { + protected void doGet(JdbcTemplate sql, HttpServletRequest request, + HttpServletResponse response, int uid, String uname) throws ServletException, IOException { List<Integer> mids = MessagesQueries.getUserBlog(sql, uid, 0, 0); if (mids.isEmpty()) { response.sendError(404); @@ -72,16 +75,7 @@ public class RSS { } out.println("]]></title>"); out.println("<description><![CDATA[" + PageTemplates.formatMessage(msg.getText()) + "]]></description>"); - - synchronized (sdfSQL) { - try { - Date date = sdfSQL.parse(msg.TimestampString); - out.println("<pubDate>" + sdfRSS.format(date) + "</pubDate>"); - } catch (Exception e) { - System.err.println("PARSE EXCEPTION: " + msg.TimestampString); - } - } - + out.println("<pubDate>" + sdfRSS.format(msg.getDate()) + "</pubDate>"); out.println("<comments>http://juick.com/" + msg.getUser().getUName() + "/" + msg.getMID() + "</comments>"); if (!msg.Tags.isEmpty()) { for (int n = 0; n < msg.Tags.size(); n++) { |