diff options
author | 2017-04-05 14:50:48 +0300 | |
---|---|---|
committer | 2017-04-05 14:50:48 +0300 | |
commit | 0c2803b09b75b5aac26ad9d1e5061f77bf003d64 (patch) | |
tree | 4aaff710277d51e80483400a0ebcb47f0e21b7d4 /juick-www/src/main/java/com/juick/www/controllers/Home.java | |
parent | 8cad49e82db4847035a84f9de44878d9abe6299c (diff) |
juick-www: GetMapping and PostMapping
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/controllers/Home.java')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/Home.java | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/Home.java b/juick-www/src/main/java/com/juick/www/controllers/Home.java index 4f597d5a..a362901c 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/Home.java +++ b/juick-www/src/main/java/com/juick/www/controllers/Home.java @@ -29,10 +29,7 @@ import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -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 javax.inject.Inject; import javax.servlet.http.HttpServletRequest; @@ -59,7 +56,7 @@ public class Home { @Inject WebApp webApp; - @RequestMapping(value = "/{anything}/**", method = RequestMethod.GET) + @GetMapping("/{anything}/**") protected void parseAnyThing(HttpServletResponse response, @PathVariable String anything, @RequestParam(required = false, defaultValue = "0") int before) throws IOException { if (before == 0) { @@ -88,14 +85,12 @@ public class Home { com.juick.User user = userService.getUserByName(anything); if (user.getUid() > 0) { Utils.sendPermanentRedirect(response, "/" + user.getName() + "/?before=" + before); - return; } else { response.sendError(HttpServletResponse.SC_NOT_FOUND); - return; } } - @RequestMapping(value = "/", method = RequestMethod.GET) + @GetMapping("/") protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { String tag = request.getParameter("tag"); if (tag != null) { |