From 42718787291bed507caf4f7ae13f6c41f9b8d7ff Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 23 Nov 2016 12:08:45 +0300 Subject: using HttpServletResponse status codes --- juick-api/src/main/java/com/juick/api/Notifications.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'juick-api/src/main/java/com/juick/api/Notifications.java') diff --git a/juick-api/src/main/java/com/juick/api/Notifications.java b/juick-api/src/main/java/com/juick/api/Notifications.java index 707df6e4..dbd128b0 100644 --- a/juick-api/src/main/java/com/juick/api/Notifications.java +++ b/juick-api/src/main/java/com/juick/api/Notifications.java @@ -33,7 +33,7 @@ public class Notifications { public void doGet(HttpServletRequest request, HttpServletResponse response, int vuid) throws IOException { User visitor = UserQueries.getUserByUID(jdbc, vuid).orElse(new User()); if ((visitor.getUid() == 0) || !(visitor.getName().equals("juick"))) { - response.sendError(403); + response.sendError(HttpServletResponse.SC_FORBIDDEN); return; } String type = request.getParameter("type"); @@ -54,7 +54,7 @@ public class Notifications { Main.replyJSON(request, response, mapper.writeValueAsString(mpnsTokens)); break; default: - response.sendError(400); + response.sendError(HttpServletResponse.SC_BAD_REQUEST); } } else { @@ -84,11 +84,11 @@ public class Notifications { Main.replyJSON(request, response, mapper.writeValueAsString(mpnsTokens)); break; default: - response.sendError(400); + response.sendError(HttpServletResponse.SC_BAD_REQUEST); } } } else { - response.sendError(400); + response.sendError(HttpServletResponse.SC_BAD_REQUEST); } } } @@ -96,7 +96,7 @@ public class Notifications { public void doDelete(HttpServletRequest request, HttpServletResponse response, int vuid) throws IOException { User visitor = UserQueries.getUserByUID(jdbc, vuid).orElse(new User()); if ((visitor.getUid() == 0) || !(visitor.getName().equals("juick"))) { - response.sendError(403); + response.sendError(HttpServletResponse.SC_FORBIDDEN); return; } ObjectMapper mapper = new ObjectMapper(); -- cgit v1.2.3