aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick/api/Main.java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/Main.java')
-rw-r--r--juick-api/src/main/java/com/juick/api/Main.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/juick-api/src/main/java/com/juick/api/Main.java b/juick-api/src/main/java/com/juick/api/Main.java
index 2bb42e3a..dffb9d66 100644
--- a/juick-api/src/main/java/com/juick/api/Main.java
+++ b/juick-api/src/main/java/com/juick/api/Main.java
@@ -477,6 +477,31 @@ public class Main extends HttpServlet {
Main.replyJSON(request, response, serializer.serialize(jmsg).toString());
}
+ @Override
+ protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ if (req.getCharacterEncoding() == null) {
+ req.setCharacterEncoding("UTF-8");
+ }
+
+ int vuid = Utils.getHttpAuthUID(jdbc, req);
+ if (vuid == 0) {
+ vuid = Utils.getVisitorQueryStringUID(jdbc, req);
+ }
+ if (vuid == 0) {
+ resp.sendError(401);
+ return;
+ }
+ String uri = req.getRequestURI();
+ switch (uri) {
+ case "/notifications":
+ notifications.doDelete(req, resp, vuid);
+ break;
+ default:
+ resp.sendError(400);
+ break;
+ }
+ }
+
public static void replyJSON(HttpServletRequest request, HttpServletResponse response, String json) throws IOException {
response.setContentType("application/json; charset=UTF-8");
response.setHeader("Access-Control-Allow-Origin", "*");