diff -r 835dd169642a -r cc7f082c5ef3 src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java --- a/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java Wed May 13 18:55:05 2020 +0200 +++ b/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java Wed May 13 21:10:23 2020 +0200 @@ -71,6 +71,8 @@ */ private final Map> mappings = new HashMap<>(); + private final List subMenu = new ArrayList<>(); + /** * Gives implementing modules access to the {@link ModuleManager}. * @@ -174,6 +176,14 @@ ); } + final var menuKey = mapping.get().menuKey(); + if (!menuKey.isBlank()) { + subMenu.add(new MenuEntry( + new ResourceKey(moduleInfo.getBundleBaseName(), menuKey), + moduleInfo.getModulePath() + requestPath, + mapping.get().menuSequence())); + } + LOG.debug("{} {} maps to {}::{}", mapping.get().method(), requestPath, @@ -234,13 +244,16 @@ throws IOException, ServletException { req.setAttribute(Constants.REQ_ATTR_MENU, getModuleManager().getMainMenu()); + req.setAttribute(Constants.REQ_ATTR_SUB_MENU, subMenu); req.getRequestDispatcher(SITE_JSP).forward(req, resp); } + private String sanitizeRequestPath(HttpServletRequest req) { + return Optional.ofNullable(req.getPathInfo()).orElse("/"); + } + private Optional findMapping(HttpMethod method, HttpServletRequest req) { - return Optional.ofNullable(mappings.get(method)) - .map(rm -> rm.get(Optional.ofNullable(req.getPathInfo()).orElse("/")) - ); + return Optional.ofNullable(mappings.get(method)).map(rm -> rm.get(sanitizeRequestPath(req))); } private void forwardAsSpecified(ResponseType type, HttpServletRequest req, HttpServletResponse resp) @@ -275,7 +288,6 @@ // set some internal request attributes req.setAttribute(Constants.REQ_ATTR_PATH, Functions.fullPath(req)); - req.setAttribute(Constants.REQ_ATTR_MODULE_CLASSNAME, this.getClass().getName()); Optional.ofNullable(moduleInfo).ifPresent((proxy) -> req.setAttribute(Constants.REQ_ATTR_MODULE_INFO, proxy)); // obtain a connection and create the data access objects