diff options
author | 2016-11-23 12:08:45 +0300 | |
---|---|---|
committer | 2016-11-23 12:08:45 +0300 | |
commit | 42718787291bed507caf4f7ae13f6c41f9b8d7ff (patch) | |
tree | 2ba7bb057a6a740e98c5f4d6dae813af1a6b977f /juick-api/src/main/java/com/juick/api/Messages.java | |
parent | aa3c1a06ed46f49b617e2956b6cf9a1b0d367fb0 (diff) |
using HttpServletResponse status codes
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/Messages.java')
-rw-r--r-- | juick-api/src/main/java/com/juick/api/Messages.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/juick-api/src/main/java/com/juick/api/Messages.java b/juick-api/src/main/java/com/juick/api/Messages.java index 93abb06b..024a79c1 100644 --- a/juick-api/src/main/java/com/juick/api/Messages.java +++ b/juick-api/src/main/java/com/juick/api/Messages.java @@ -76,13 +76,13 @@ public class Messages { if (tagObject != null) { mids = MessagesQueries.getUserTag(sql, user.getUid(), tagObject.TID, 0, before_mid); } else { - response.sendError(404); + response.sendError(HttpServletResponse.SC_NOT_FOUND); } } else { mids = MessagesQueries.getUserBlog(sql, user.getUid(), 0, before_mid); } } else { - response.sendError(404); + response.sendError(HttpServletResponse.SC_NOT_FOUND); } } else { if (!StringUtils.isEmpty(popular)) { @@ -94,7 +94,7 @@ public class Messages { if (tagObject != null) { mids = MessagesQueries.getTag(sql, tagObject.TID, vuid, before_mid, 20); } else { - response.sendError(404); + response.sendError(HttpServletResponse.SC_NOT_FOUND); } } else { mids = MessagesQueries.getAll(sql, vuid, before_mid); @@ -108,14 +108,14 @@ public class Messages { com.juick.Message msg = MessagesQueries.getMessage(sql, mid); if (msg != null) { if (!MessagesQueries.canViewThread(sql, mid, vuid)) { - response.sendError(403); + response.sendError(HttpServletResponse.SC_FORBIDDEN); } else { List<com.juick.Message> replies = MessagesQueries.getReplies(sql, mid); replies.add(0, msg); feedMessages(request, response, replies); } } else { - response.sendError(404); + response.sendError(HttpServletResponse.SC_NOT_FOUND); } } @@ -131,10 +131,10 @@ public class Messages { String json = messageSerializer.serializeList(msgs); Main.replyJSON(request, response, json); } else { - response.sendError(404); + response.sendError(HttpServletResponse.SC_NOT_FOUND); } } else { - response.sendError(404); + response.sendError(HttpServletResponse.SC_NOT_FOUND); } } @@ -146,7 +146,7 @@ public class Messages { if (user != null && user.getUid() == vuid && MessagesQueries.setMessagePrivacy(sql, mid)) { Main.replyJSON(request, response, "{\"status\":\"ok\"}"); } else { - response.sendError(400); + response.sendError(HttpServletResponse.SC_BAD_REQUEST); } } |