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

changeset 182
53f0e2685ad5
parent 180
009700915269
equal deleted inserted replaced
181:502a10e24b85 182:53f0e2685ad5
51 * the necessary functionality for LightPIT pages. 51 * the necessary functionality for LightPIT pages.
52 */ 52 */
53 public abstract class AbstractServlet extends HttpServlet { 53 public abstract class AbstractServlet extends HttpServlet {
54 54
55 private static final Logger LOG = LoggerFactory.getLogger(AbstractServlet.class); 55 private static final Logger LOG = LoggerFactory.getLogger(AbstractServlet.class);
56
57 private static final String SITE_JSP = jspPath("site");
58 56
59 /** 57 /**
60 * Invocation mapping gathered from the {@link RequestMapping} annotations. 58 * Invocation mapping gathered from the {@link RequestMapping} annotations.
61 * <p> 59 * <p>
62 * Paths in this map must always start with a leading slash, although 60 * Paths in this map must always start with a leading slash, although
359 ).findAny() 357 ).findAny()
360 ); 358 );
361 } 359 }
362 360
363 protected void renderSite(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 361 protected void renderSite(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
364 req.getRequestDispatcher(SITE_JSP).forward(req, resp); 362 req.getRequestDispatcher(jspPath("site")).forward(req, resp);
365 } 363 }
366 364
367 protected Optional<String[]> availableLanguages() { 365 protected Optional<String[]> availableLanguages() {
368 return Optional.ofNullable(getServletContext().getInitParameter(Constants.CTX_ATTR_LANGUAGES)).map((x) -> x.split("\\s*,\\s*")); 366 return Optional.ofNullable(getServletContext().getInitParameter(Constants.CTX_ATTR_LANGUAGES)).map((x) -> x.split("\\s*,\\s*"));
369 } 367 }

mercurial