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

changeset 34
824d4042c857
parent 33
fd8c40ff78c3
child 45
cc7f082c5ef3
     1.1 --- a/src/main/java/de/uapcore/lightpit/Functions.java	Sat May 09 15:19:21 2020 +0200
     1.2 +++ b/src/main/java/de/uapcore/lightpit/Functions.java	Sat May 09 17:01:29 2020 +0200
     1.3 @@ -1,8 +1,8 @@
     1.4  /*
     1.5   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     1.6 - * 
     1.7 + *
     1.8   * Copyright 2018 Mike Becker. All rights reserved.
     1.9 - * 
    1.10 + *
    1.11   * Redistribution and use in source and binary forms, with or without
    1.12   * modification, are permitted provided that the following conditions are met:
    1.13   *
    1.14 @@ -24,7 +24,7 @@
    1.15   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    1.16   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    1.17   * POSSIBILITY OF SUCH DAMAGE.
    1.18 - * 
    1.19 + *
    1.20   */
    1.21  package de.uapcore.lightpit;
    1.22  
    1.23 @@ -39,13 +39,13 @@
    1.24   * Contains common static functions.
    1.25   */
    1.26  public final class Functions {
    1.27 -    
    1.28 +
    1.29      private static final Logger LOG = LoggerFactory.getLogger(Functions.class);
    1.30  
    1.31      public static Optional<String[]> availableLanguages(ServletContext ctx) {
    1.32          return Optional.ofNullable(ctx.getInitParameter(Constants.CTX_ATTR_LANGUAGES)).map((x) -> x.split("\\s*,\\s*"));
    1.33      }
    1.34 -    
    1.35 +
    1.36      public static String enforceExt(String filename, String ext) {
    1.37          return filename.endsWith(ext) ? filename : filename + ext;
    1.38      }
    1.39 @@ -53,23 +53,23 @@
    1.40      public static String jspPath(String filename) {
    1.41          return enforceExt(Constants.JSP_PATH_PREFIX + filename, ".jsp");
    1.42      }
    1.43 -    
    1.44 +
    1.45      public static String jspfPath(String filename) {
    1.46          return enforceExt(Constants.JSPF_PATH_PREFIX + filename, ".jspf");
    1.47      }
    1.48 -    
    1.49 +
    1.50      public static String dynFragmentPath(String filename) {
    1.51          return enforceExt(Constants.DYN_FRAGMENT_PATH_PREFIX + filename, ".jsp");
    1.52      }
    1.53 -    
    1.54 +
    1.55      public static String fqn(String base, String name) {
    1.56 -        return base+"."+name;
    1.57 +        return base + "." + name;
    1.58      }
    1.59  
    1.60      public static String fqn(Class<?> clazz, String name) {
    1.61          return fqn(clazz.getName(), name);
    1.62      }
    1.63 -    
    1.64 +
    1.65      public static String fullPath(LightPITModule module, RequestMapping mapping) {
    1.66          StringBuilder sb = new StringBuilder();
    1.67          sb.append(module.modulePath());
    1.68 @@ -80,17 +80,17 @@
    1.69          }
    1.70          return sb.toString();
    1.71      }
    1.72 -    
    1.73 +
    1.74      public static String fullPath(HttpServletRequest req) {
    1.75          return req.getServletPath() + Optional.ofNullable(req.getPathInfo()).orElse("");
    1.76      }
    1.77 -    
    1.78 +
    1.79      /**
    1.80       * Returns the module path of the given LightPIT Servlet module.
    1.81 -     * 
    1.82 +     * <p>
    1.83       * If you specify a malformed LightPIT servlet, which does not have a module
    1.84       * annotation, the path to the <code>/error/404.html</code> page is returned.
    1.85 -     * 
    1.86 +     *
    1.87       * @param clazz the servlet class
    1.88       * @return the module path
    1.89       */
    1.90 @@ -106,9 +106,10 @@
    1.91              return "/error/404.html";
    1.92          }
    1.93      }
    1.94 -    
    1.95 +
    1.96      /**
    1.97       * This class is not instantiatable.
    1.98       */
    1.99 -    private Functions() {}
   1.100 +    private Functions() {
   1.101 +    }
   1.102  }

mercurial