@Test void testCorrectRedirect() throws AccessDeniedException { when(menuReaderService.getMenu()).thenReturn(Optional.of(menu)); String url = "https: RedirectView response = (RedirectView) redirectController.redirect(url); assertEquals(url, response.getUrl()); }
@GetMapping public View redirect(@RequestParam("url") String url) throws AccessDeniedException { if (!menuReaderService .getMenu() .filter(menu -> menu.contains(node -> nodeMatches(node, url))) .isPresent()) { throw new AccessDeniedException("URL not present in menu!"); } return new RedirectView(url, false, false, false); }
RedirectController extends PluginController { @GetMapping public View redirect(@RequestParam("url") String url) throws AccessDeniedException { if (!menuReaderService .getMenu() .filter(menu -> menu.contains(node -> nodeMatches(node, url))) .isPresent()) { throw new AccessDeniedException("URL not present in menu!"); } return new RedirectView(url, false, false, false); } }
RedirectController extends PluginController { @GetMapping public View redirect(@RequestParam("url") String url) throws AccessDeniedException { if (!menuReaderService .getMenu() .filter(menu -> menu.contains(node -> nodeMatches(node, url))) .isPresent()) { throw new AccessDeniedException("URL not present in menu!"); } return new RedirectView(url, false, false, false); } RedirectController(MenuReaderService menuReaderService); }
RedirectController extends PluginController { @GetMapping public View redirect(@RequestParam("url") String url) throws AccessDeniedException { if (!menuReaderService .getMenu() .filter(menu -> menu.contains(node -> nodeMatches(node, url))) .isPresent()) { throw new AccessDeniedException("URL not present in menu!"); } return new RedirectView(url, false, false, false); } RedirectController(MenuReaderService menuReaderService); @GetMapping View redirect(@RequestParam("url") String url); }
RedirectController extends PluginController { @GetMapping public View redirect(@RequestParam("url") String url) throws AccessDeniedException { if (!menuReaderService .getMenu() .filter(menu -> menu.contains(node -> nodeMatches(node, url))) .isPresent()) { throw new AccessDeniedException("URL not present in menu!"); } return new RedirectView(url, false, false, false); } RedirectController(MenuReaderService menuReaderService); @GetMapping View redirect(@RequestParam("url") String url); static final String ID; static final String URI; }