aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/api/Messages.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2015-11-04 15:18:41 +0300
committerGravatar Vitaly Takmazov2015-11-04 15:18:41 +0300
commit63b14e7818a20d598e4634a0ee686376d7f687b2 (patch)
tree764d2924e34440e77945b1edd8501ee0aa6c1181 /src/main/java/com/juick/api/Messages.java
parent9325971f2f6e2bf83e3d4d69bae3f8e63226bc63 (diff)
drop gson, refactoring
Diffstat (limited to 'src/main/java/com/juick/api/Messages.java')
-rw-r--r--src/main/java/com/juick/api/Messages.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/com/juick/api/Messages.java b/src/main/java/com/juick/api/Messages.java
index b7a55361..548e816f 100644
--- a/src/main/java/com/juick/api/Messages.java
+++ b/src/main/java/com/juick/api/Messages.java
@@ -1,5 +1,6 @@
package com.juick.api;
+import com.juick.json.MessageSerializer;
import com.juick.server.MessagesQueries;
import com.juick.xmpp.JID;
import com.juick.xmpp.Message;
@@ -19,6 +20,8 @@ import javax.servlet.http.HttpServletResponse;
public class Messages {
Connection sql;
+
+ MessageSerializer messageSerializer = new MessageSerializer();
public Messages(Connection sql) {
this.sql = sql;
@@ -31,7 +34,7 @@ public class Messages {
if (mids != null && !mids.isEmpty()) {
ArrayList<com.juick.Message> msgs = MessagesQueries.getMessages(sql, mids);
if (msgs != null && !msgs.isEmpty()) {
- String json = com.juick.json.Messages.arrayToString(msgs);
+ String json = messageSerializer.serializeList(msgs);
Main.replyJSON(request, response, json);
} else {
response.sendError(404);
@@ -48,7 +51,7 @@ public class Messages {
if (mids != null && !mids.isEmpty()) {
ArrayList<com.juick.Message> msgs = MessagesQueries.getMessages(sql, mids);
if (msgs != null && !msgs.isEmpty()) {
- String json = com.juick.json.Messages.arrayToString(msgs);
+ String json = messageSerializer.serializeList(msgs);
Main.replyJSON(request, response, json);
} else {
response.sendError(404);