From cc551432bf80e4466b92c42a77a094f31408abeb Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 27 Mar 2018 22:08:58 +0300 Subject: move url guessing logic from mapping to Filter --- .../java/com/juick/www/controllers/Messages.java | 31 ---------------------- 1 file changed, 31 deletions(-) (limited to 'juick-www/src/main/java/com/juick/www/controllers/Messages.java') 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, -- cgit v1.2.3