fixes sub-menu entries not mapping correctly due to buggy handling of trailing slash

Sun, 17 May 2020 15:24:58 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 17 May 2020 15:24:58 +0200
changeset 57
1262b5433644
parent 56
11b1e7153496
child 58
8d3047f78190

fixes sub-menu entries not mapping correctly due to buggy handling of trailing slash

src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/ModuleManager.java file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jspf/menu-entry.jspf file | annotate | diff | comparison | revisions
--- a/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Sat May 16 17:22:45 2020 +0200
+++ b/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Sun May 17 15:24:58 2020 +0200
@@ -166,7 +166,8 @@
                                 || DataAccessObjects.class.isAssignableFrom(param);
                     }
                     if (paramsInjectible) {
-                        final String requestPath = "/" + mapping.get().requestPath();
+                        final String requestPath = "/" + mapping.get().requestPath()
+                                + (mapping.get().menuKey().isBlank() ? "" : "/");
 
                         if (mappings
                                 .computeIfAbsent(mapping.get().method(), k -> new HashMap<>())
--- a/src/main/java/de/uapcore/lightpit/ModuleManager.java	Sat May 16 17:22:45 2020 +0200
+++ b/src/main/java/de/uapcore/lightpit/ModuleManager.java	Sun May 17 15:24:58 2020 +0200
@@ -155,7 +155,7 @@
                         new ResourceKey(
                                 mod.bundleBaseName(),
                                 mod.menuKey()),
-                        mod.modulePath(),
+                        mod.modulePath()+"/",
                         mod.defaultPriority()))
                 .sorted()
                 .forEachOrdered(mainMenu::add);
--- a/src/main/webapp/WEB-INF/jspf/menu-entry.jspf	Sat May 16 17:22:45 2020 +0200
+++ b/src/main/webapp/WEB-INF/jspf/menu-entry.jspf	Sun May 17 15:24:58 2020 +0200
@@ -30,7 +30,7 @@
             data-active
         </c:if>
 >
-    <a href="${menu.pathName}/">
+    <a href="${menu.pathName}">
         <fmt:bundle basename="${menu.resourceKey.bundle}">
             <fmt:message key="${menu.resourceKey.key}"/>
         </fmt:bundle>

mercurial