diff -r 005d27918b57 -r f4608ad6c947 src/java/de/uapcore/lightpit/Functions.java --- a/src/java/de/uapcore/lightpit/Functions.java Sat Dec 23 17:28:19 2017 +0100 +++ b/src/java/de/uapcore/lightpit/Functions.java Tue Dec 26 17:36:47 2017 +0100 @@ -29,6 +29,7 @@ package de.uapcore.lightpit; import java.util.Optional; +import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,8 +41,24 @@ 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; + } + public static String jspPath(String filename) { - return Constants.JSP_PATH_PREFIX + 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) {