aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/juick/www/NewMessage.java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/NewMessage.java')
-rw-r--r--juick-www/src/main/java/com/juick/www/NewMessage.java28
1 files changed, 14 insertions, 14 deletions
diff --git a/juick-www/src/main/java/com/juick/www/NewMessage.java b/juick-www/src/main/java/com/juick/www/NewMessage.java
index 29c834d6..f6e8ec47 100644
--- a/juick-www/src/main/java/com/juick/www/NewMessage.java
+++ b/juick-www/src/main/java/com/juick/www/NewMessage.java
@@ -151,7 +151,7 @@ public class NewMessage {
public void doPostMessage(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, XmppSession xmpp, com.juick.User visitor) throws ServletException, IOException {
String body = request.getParameter("body");
if (body == null || body.length() < 1 || body.length() > 4096) {
- response.sendError(400);
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
}
body = body.replace("\r", "");
@@ -180,7 +180,7 @@ public class NewMessage {
attachmentFName = Utils.receiveMultiPartFile(request, "attach");
} catch (Exception e) {
logger.error("MULTIPART ERROR", e);
- response.sendError(400);
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
}
@@ -191,7 +191,7 @@ public class NewMessage {
attachmentFName = Utils.downloadImage(imgUrl);
} catch (Exception e) {
logger.error("DOWNLOAD ERROR", e);
- response.sendError(500);
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
}
}
@@ -307,12 +307,12 @@ public class NewMessage {
public void doPostComment(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, XmppSession xmpp, com.juick.User visitor) throws ServletException, IOException {
int mid = NumberUtils.toInt(request.getParameter("mid"), 0);
if (mid == 0) {
- response.sendError(400);
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
}
com.juick.Message msg = MessagesQueries.getMessage(sql, mid);
if (msg == null) {
- response.sendError(404);
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
@@ -321,20 +321,20 @@ public class NewMessage {
if (rid > 0) {
reply = MessagesQueries.getReply(sql, mid, rid);
if (reply == null) {
- response.sendError(404);
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
}
String body = request.getParameter("body");
if (body == null || body.length() < 1 || body.length() > 4096) {
- response.sendError(400);
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
}
body = body.replace("\r", "");
if ((msg.ReadOnly && msg.getUser().getUid() != visitor.getUid()) || UserQueries.isInBLAny(sql, msg.getUser().getUid(), visitor.getUid()) || (reply != null && UserQueries.isInBLAny(sql, reply.getUser().getUid(), visitor.getUid()))) {
- response.sendError(403);
+ response.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
}
@@ -343,7 +343,7 @@ public class NewMessage {
attachmentFName = Utils.receiveMultiPartFile(request, "attach");
} catch (Exception e) {
logger.error("MULTIPART ERROR", e);
- response.sendError(400);
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
}
@@ -353,7 +353,7 @@ public class NewMessage {
attachmentFName = Utils.downloadImage(new URL(paramImg));
} catch (Exception e) {
logger.error("DOWNLOAD ERROR", e);
- response.sendError(500);
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
}
}
@@ -420,16 +420,16 @@ public class NewMessage {
public void doPostRecomm(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, XmppSession xmpp, com.juick.User visitor) throws ServletException, IOException {
int mid = NumberUtils.toInt(request.getParameter("mid"), 0);
if (mid == 0) {
- response.sendError(400);
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
}
com.juick.Message msg = MessagesQueries.getMessage(sql, mid);
if (msg == null) {
- response.sendError(404);
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
if (msg.getUser().getUid() == visitor.getUid()) {
- response.sendError(403);
+ response.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
}
@@ -451,7 +451,7 @@ public class NewMessage {
Utils.replyJSON(request, response, "{\"status\":\"ok\"}");
} else {
- response.sendError(500);
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
}
}