From 0c2803b09b75b5aac26ad9d1e5061f77bf003d64 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 5 Apr 2017 14:50:48 +0300 Subject: juick-www: GetMapping and PostMapping --- .../src/main/java/com/juick/www/controllers/NewMessage.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'juick-www/src/main/java/com/juick/www/controllers/NewMessage.java') diff --git a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java index fcd27710..2c92f9d8 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java +++ b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java @@ -35,9 +35,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.core.env.Environment; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import rocks.xmpp.addr.Jid; import rocks.xmpp.core.stanza.model.Message; @@ -86,7 +84,7 @@ public class NewMessage { private static final Logger logger = LoggerFactory.getLogger(NewMessage.class); - @RequestMapping(value = "/post", method = RequestMethod.GET) + @GetMapping("/post") protected void doGetNewMessage(HttpServletRequest request, HttpServletResponse response) throws IOException { com.juick.User visitor = UserUtils.getCurrentUser(); if (visitor.getUid() == 0) { @@ -181,7 +179,7 @@ public class NewMessage { out.println("

"); } - @RequestMapping(value = "/post", method = RequestMethod.POST) + @PostMapping("/post") public void doPostMessage(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) String img, @RequestParam(required = false) MultipartFile attach) throws IOException { @@ -314,7 +312,7 @@ public class NewMessage { } } - @RequestMapping(value = "/comment", method = RequestMethod.POST) + @PostMapping("/comment") public void doPostComment(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) String img, @RequestParam(required = false) MultipartFile attach) throws IOException { @@ -432,7 +430,7 @@ public class NewMessage { Utils.sendTemporaryRedirect(response, "/" + msg.getUser().getName() + "/" + mid + "#" + ridnew); } - @RequestMapping(value = "/like", method = RequestMethod.POST) + @PostMapping("/like") public void doPostRecomm(HttpServletRequest request, HttpServletResponse response) throws IOException { com.juick.User visitor = UserUtils.getCurrentUser(); if (visitor.getUid() == 0) { -- cgit v1.2.3