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/NewMessage.java | |
parent | f2a2660e753fa11478fd3edadfdff9c000b22cc9 (diff) |
spring-jdbc
Diffstat (limited to 'src/main/java/com/juick/http/www/NewMessage.java')
-rw-r--r-- | src/main/java/com/juick/http/www/NewMessage.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/com/juick/http/www/NewMessage.java b/src/main/java/com/juick/http/www/NewMessage.java index 86725db7..22d743b3 100644 --- a/src/main/java/com/juick/http/www/NewMessage.java +++ b/src/main/java/com/juick/http/www/NewMessage.java @@ -30,6 +30,8 @@ import com.juick.xmpp.extensions.JuickMessage; import com.juick.xmpp.extensions.JuickUser; import com.juick.xmpp.extensions.Nickname; import com.juick.xmpp.extensions.XOOB; +import org.springframework.jdbc.core.JdbcTemplate; + import java.io.IOException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; @@ -48,7 +50,7 @@ import javax.servlet.http.HttpServletResponse; */ public class NewMessage { - protected void doGetNewMessage(Connection sql, HttpServletRequest request, HttpServletResponse response, com.juick.User visitor) throws ServletException, IOException { + protected void doGetNewMessage(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, com.juick.User visitor) throws ServletException, IOException { response.setContentType("text/html; charset=UTF-8"); PrintWriter out = response.getWriter(); try { @@ -88,7 +90,7 @@ public class NewMessage { } } - void printUserTags(Connection sql, PrintWriter out, com.juick.User visitor) { + void printUserTags(JdbcTemplate sql, PrintWriter out, com.juick.User visitor) { List<Tag> tags = TagQueries.getUserTagsAll(sql, visitor.getUID()); if (tags.isEmpty()) { @@ -134,7 +136,7 @@ public class NewMessage { out.println("</p>"); } - public void doPostMessage(Connection sql, HttpServletRequest request, HttpServletResponse response, Stream xmpp, com.juick.User visitor) throws ServletException, IOException { + public void doPostMessage(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, Stream xmpp, com.juick.User visitor) throws ServletException, IOException { String body = request.getParameter("body"); if (body == null || body.length() < 1 || body.length() > 4096) { response.sendError(400); @@ -143,7 +145,7 @@ public class NewMessage { body = body.replace("\r", ""); String tagsStr = request.getParameter("tags"); - List<com.juick.Tag> tags = new ArrayList<Tag>(); + List<com.juick.Tag> tags = new ArrayList<>(); String tagsArr[] = new String[1]; if (tagsStr != null && !tagsStr.isEmpty()) { tagsArr = tagsStr.split("[ \\,]"); @@ -282,7 +284,7 @@ public class NewMessage { } } - public void doPostComment(Connection sql, HttpServletRequest request, HttpServletResponse response, Stream xmpp, com.juick.User visitor) throws ServletException, IOException { + public void doPostComment(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, Stream xmpp, com.juick.User visitor) throws ServletException, IOException { int mid = Utils.parseInt(request.getParameter("mid"), 0); if (mid == 0) { response.sendError(400); @@ -383,7 +385,7 @@ public class NewMessage { Utils.sendTemporaryRedirect(response, "/" + msg.getUser().getUName() + "/" + mid + "#" + ridnew); } - public void doPostRecomm(Connection sql, HttpServletRequest request, HttpServletResponse response, Stream xmpp, com.juick.User visitor) throws ServletException, IOException { + public void doPostRecomm(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, Stream xmpp, com.juick.User visitor) throws ServletException, IOException { int mid = Utils.parseInt(request.getParameter("mid"), 0); if (mid == 0) { response.sendError(400); |