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-www/src/main/java/com/juick/www/Settings.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'juick-www/src/main/java/com/juick/www/Settings.java') 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 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("

New secret email: %s@mail.juick.com

" + "

Back.

", 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 = "

Back

"; break; default: - response.sendError(400); + response.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } response.setContentType("text/html; charset=UTF-8"); -- cgit v1.2.3