diff options
author | Vitaly Takmazov | 2015-11-04 15:18:41 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2015-11-04 15:18:41 +0300 |
commit | 63b14e7818a20d598e4634a0ee686376d7f687b2 (patch) | |
tree | 764d2924e34440e77945b1edd8501ee0aa6c1181 /src/main/java/com/juick/api/Users.java | |
parent | 9325971f2f6e2bf83e3d4d69bae3f8e63226bc63 (diff) |
drop gson, refactoring
Diffstat (limited to 'src/main/java/com/juick/api/Users.java')
-rw-r--r-- | src/main/java/com/juick/api/Users.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/com/juick/api/Users.java b/src/main/java/com/juick/api/Users.java index cdd48fd6..37c9ca49 100644 --- a/src/main/java/com/juick/api/Users.java +++ b/src/main/java/com/juick/api/Users.java @@ -1,6 +1,7 @@ package com.juick.api; import com.juick.User; +import com.juick.json.UserSerializer; import com.juick.server.UserQueries; import java.io.IOException; import java.sql.Connection; @@ -18,6 +19,8 @@ import javax.servlet.http.HttpServletResponse; public class Users { Connection sql; + + UserSerializer userSerializer = new UserSerializer(); public Users(Connection sql) { this.sql = sql; @@ -55,7 +58,7 @@ public class Users { } if (!users.isEmpty()) { - String json = com.juick.json.Users.arrayToString(users); + String json = userSerializer.serializeList(users); Main.replyJSON(request, response, json); } else { response.sendError(404); @@ -81,7 +84,7 @@ public class Users { if (uids.size() > 0) { ArrayList<com.juick.User> users = UserQueries.getUsersByID(sql, uids); if (users.size() > 0) { - String json = com.juick.json.Users.arrayToString(users); + String json = userSerializer.serializeList(users); Main.replyJSON(request, response, json); return; } @@ -109,7 +112,7 @@ public class Users { if (uids.size() > 0) { ArrayList<com.juick.User> users = UserQueries.getUsersByID(sql, uids); if (users.size() > 0) { - String json = com.juick.json.Users.arrayToString(users); + String json = userSerializer.serializeList(users); Main.replyJSON(request, response, json); return; } |