diff options
author | Vitaly Takmazov | 2016-11-23 12:08:45 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-11-23 12:08:45 +0300 |
commit | 42718787291bed507caf4f7ae13f6c41f9b8d7ff (patch) | |
tree | 2ba7bb057a6a740e98c5f4d6dae813af1a6b977f /juick-www/src/main/java/com/juick/www/Settings.java | |
parent | aa3c1a06ed46f49b617e2956b6cf9a1b0d367fb0 (diff) |
using HttpServletResponse status codes
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/Settings.java')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/Settings.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/juick-www/src/main/java/com/juick/www/Settings.java b/juick-www/src/main/java/com/juick/www/Settings.java index 5c25564f..89eb6718 100644 --- a/juick-www/src/main/java/com/juick/www/Settings.java +++ b/juick-www/src/main/java/com/juick/www/Settings.java @@ -118,7 +118,7 @@ public class Settings { protected void doPost(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, PebbleException { com.juick.User visitor = Utils.getVisitorUser(sql, request, response); if (visitor.getUid() == 0) { - response.sendError(400); + response.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } List<String> pages = Arrays.asList("main", "password", "about", "email", "email-add", "email-del", @@ -126,7 +126,7 @@ public class Settings { "facebook-enable", "vk-del"); String page = request.getParameter("page"); if (StringUtils.isEmpty(page) || !pages.contains(page)) { - response.sendError(400); + response.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } String result = ""; @@ -191,7 +191,7 @@ public class Settings { result = String.format("<p>New secret email: <strong>%s@mail.juick.com</strong></p>" + "<p><a href=\"/settings\">Back</a>.</p>", newHash); } else { - response.sendError(500); + response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); return; } break; @@ -218,7 +218,7 @@ public class Settings { } catch (MessagingException ex) { logger.error("mail exception", ex); - response.sendError(500); + response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); return; } } @@ -277,7 +277,7 @@ public class Settings { result = "<p><a href=\"/settings\">Back</a></p>"; break; default: - response.sendError(400); + response.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } response.setContentType("text/html; charset=UTF-8"); |