diff options
author | 2018-03-27 22:08:58 +0300 | |
---|---|---|
committer | 2018-03-27 22:08:58 +0300 | |
commit | cc551432bf80e4466b92c42a77a094f31408abeb (patch) | |
tree | 6e0cc704411b478ad9353228d43145395e926294 /juick-www/src/main/java/com/juick/www/controllers/Messages.java | |
parent | ed4067c05b68fdb70f8a1edbf520627cd96845d9 (diff) |
move url guessing logic from mapping to Filter
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/controllers/Messages.java')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/Messages.java | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/Messages.java b/juick-www/src/main/java/com/juick/www/controllers/Messages.java index ce21f97d..65e122a6 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/Messages.java +++ b/juick-www/src/main/java/com/juick/www/controllers/Messages.java @@ -81,37 +81,6 @@ public class Messages { .stream().sorted((e1, e2) -> Integer.compare(e2.getUsageCount(), e1.getUsageCount())).limit(20).map(t -> t.getTag().getName()).collect(Collectors.toList())); } - @GetMapping("/{anything}/**") - protected String parseAnyThing(@PathVariable String anything, - @RequestParam(required = false, defaultValue = "0") int before) throws IOException { - if (before == 0) { - boolean isPostNumber = WebUtils.isPostNumber(anything); - int messageId = isPostNumber ? - NumberUtils.toInt(anything) : 0; - - if (isPostNumber && anything.equals(Integer.toString(messageId))) { - if (messageId > 0) { - com.juick.User author = messagesService.getMessageAuthor(messageId); - - if (author != null) { - return "redirect:/" + author.getName() + "/" + anything; - } - } - } - com.juick.User user = userService.getUserByName(anything); - if (user.getUid() > 0) { - return "redirect:/" + user.getName() + "/"; - } - throw new HttpNotFoundException(); - } - com.juick.User user = userService.getUserByName(anything); - if (user.getUid() > 0) { - return "redirect:/" + user.getName() + "/?before=" + before; - } else { - throw new HttpNotFoundException(); - } - } - @GetMapping("/") protected String doGet( @RequestParam(required = false) String tag, |