src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java

changeset 78
bb4c52bf3439
parent 75
33b6843fdf8a
child 79
f64255a88d66
     1.1 --- a/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Sat May 23 13:34:41 2020 +0200
     1.2 +++ b/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Sat May 23 13:52:04 2020 +0200
     1.3 @@ -58,10 +58,6 @@
     1.4  
     1.5      private static final String SITE_JSP = Functions.jspPath("site");
     1.6  
     1.7 -    /**
     1.8 -     * The EL proxy is necessary, because the EL resolver cannot handle annotation properties.
     1.9 -     */
    1.10 -    private LightPITModule.ELProxy moduleInfo = null;
    1.11  
    1.12      @FunctionalInterface
    1.13      protected interface SQLFindFunction<K, T> {
    1.14 @@ -102,6 +98,12 @@
    1.15          return (ModuleManager) getServletContext().getAttribute(ModuleManager.SC_ATTR_NAME);
    1.16      }
    1.17  
    1.18 +    /**
    1.19 +     * Returns the name of the resource bundle associated with this servlet.
    1.20 +     * @return the resource bundle base name
    1.21 +     */
    1.22 +    protected abstract String getResourceBundleName();
    1.23 +
    1.24  
    1.25      /**
    1.26       * Creates a set of data access objects for the specified connection.
    1.27 @@ -150,12 +152,7 @@
    1.28  
    1.29      @Override
    1.30      public void init() throws ServletException {
    1.31 -        moduleInfo = Optional.ofNullable(this.getClass().getAnnotation(LightPITModule.class))
    1.32 -                .map(LightPITModule.ELProxy::new).orElse(null);
    1.33 -
    1.34 -        if (moduleInfo != null) {
    1.35 -            scanForRequestMappings();
    1.36 -        }
    1.37 +        scanForRequestMappings();
    1.38  
    1.39          LOG.trace("{} initialized", getServletName());
    1.40      }
    1.41 @@ -387,7 +384,7 @@
    1.42          final String fullPath = Functions.fullPath(req);
    1.43          req.setAttribute(Constants.REQ_ATTR_BASE_HREF, Functions.baseHref(req));
    1.44          req.setAttribute(Constants.REQ_ATTR_PATH, fullPath);
    1.45 -        Optional.ofNullable(moduleInfo).ifPresent((proxy) -> req.setAttribute(Constants.REQ_ATTR_MODULE_INFO, proxy));
    1.46 +        req.setAttribute(Constants.REQ_ATTR_RESOURCE_BUNDLE, getResourceBundleName());
    1.47  
    1.48          // if this is an error path, bypass the normal flow
    1.49          if (fullPath.startsWith("/error/")) {

mercurial