diff -r fd8c40ff78c3 -r 824d4042c857 src/main/java/de/uapcore/lightpit/Functions.java --- a/src/main/java/de/uapcore/lightpit/Functions.java Sat May 09 15:19:21 2020 +0200 +++ b/src/main/java/de/uapcore/lightpit/Functions.java Sat May 09 17:01:29 2020 +0200 @@ -1,8 +1,8 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * + * * Copyright 2018 Mike Becker. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -24,7 +24,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * */ package de.uapcore.lightpit; @@ -39,13 +39,13 @@ * Contains common static functions. */ public final class Functions { - + private static final Logger LOG = LoggerFactory.getLogger(Functions.class); public static Optional availableLanguages(ServletContext ctx) { return Optional.ofNullable(ctx.getInitParameter(Constants.CTX_ATTR_LANGUAGES)).map((x) -> x.split("\\s*,\\s*")); } - + public static String enforceExt(String filename, String ext) { return filename.endsWith(ext) ? filename : filename + ext; } @@ -53,23 +53,23 @@ public static String jspPath(String filename) { return enforceExt(Constants.JSP_PATH_PREFIX + filename, ".jsp"); } - + public static String jspfPath(String filename) { return enforceExt(Constants.JSPF_PATH_PREFIX + filename, ".jspf"); } - + public static String dynFragmentPath(String filename) { return enforceExt(Constants.DYN_FRAGMENT_PATH_PREFIX + filename, ".jsp"); } - + public static String fqn(String base, String name) { - return base+"."+name; + return base + "." + name; } public static String fqn(Class clazz, String name) { return fqn(clazz.getName(), name); } - + public static String fullPath(LightPITModule module, RequestMapping mapping) { StringBuilder sb = new StringBuilder(); sb.append(module.modulePath()); @@ -80,17 +80,17 @@ } return sb.toString(); } - + public static String fullPath(HttpServletRequest req) { return req.getServletPath() + Optional.ofNullable(req.getPathInfo()).orElse(""); } - + /** * Returns the module path of the given LightPIT Servlet module. - * + *

* If you specify a malformed LightPIT servlet, which does not have a module * annotation, the path to the /error/404.html page is returned. - * + * * @param clazz the servlet class * @return the module path */ @@ -106,9 +106,10 @@ return "/error/404.html"; } } - + /** * This class is not instantiatable. */ - private Functions() {} + private Functions() { + } }