diff -r 4fa33bfa8fb9 -r 0f4f8f255c32 src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java --- a/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java Sun May 10 10:11:10 2020 +0200 +++ b/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java Sun May 10 10:11:37 2020 +0200 @@ -52,14 +52,9 @@ private static final String HTML_FULL_DISPATCHER = Functions.jspPath("html_full"); /** - * Store a reference to the annotation for quicker access. - */ - private LightPITModule moduleInfo = null; - - /** * The EL proxy is necessary, because the EL resolver cannot handle annotation properties. */ - private LightPITModule.ELProxy moduleInfoELProxy = null; + private LightPITModule.ELProxy moduleInfo = null; @FunctionalInterface @@ -88,15 +83,6 @@ } /** - * Returns the annotated module information. - * - * @return the module annotation - */ - public final LightPITModule getModuleInfo() { - return moduleInfo; - } - - /** * Gives implementing modules access to the {@link DatabaseFacade}. * * @return the database facade @@ -118,8 +104,8 @@ @Override public void init() throws ServletException { - moduleInfo = this.getClass().getAnnotation(LightPITModule.class); - moduleInfoELProxy = moduleInfo == null ? null : LightPITModule.ELProxy.convert(moduleInfo); + moduleInfo = Optional.ofNullable(this.getClass().getAnnotation(LightPITModule.class)) + .map(LightPITModule.ELProxy::new).orElse(null); if (moduleInfo != null) { scanForRequestMappings(); @@ -228,7 +214,7 @@ private void forwardToFullView(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { - req.setAttribute(Constants.REQ_ATTR_MENU, getModuleManager().getMainMenu(getDatabaseFacade())); + req.setAttribute(Constants.REQ_ATTR_MENU, getModuleManager().getMainMenu()); req.getRequestDispatcher(HTML_FULL_DISPATCHER).forward(req, resp); } @@ -255,9 +241,6 @@ private void doProcess(HttpMethod method, HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - // Synchronize module information with database - getModuleManager().syncWithDatabase(getDatabaseFacade()); - // choose the requested language as session language (if available) or fall back to english, otherwise HttpSession session = req.getSession(); if (session.getAttribute(Constants.SESSION_ATTR_LANGUAGE) == null) { @@ -275,7 +258,7 @@ // 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(moduleInfoELProxy).ifPresent((proxy) -> req.setAttribute(Constants.REQ_ATTR_MODULE_INFO, proxy)); + Optional.ofNullable(moduleInfo).ifPresent((proxy) -> req.setAttribute(Constants.REQ_ATTR_MODULE_INFO, proxy)); // call the handler, if available, or send an HTTP 404 error