From: Kai Moritz Date: Wed, 26 Feb 2014 00:13:22 +0000 (+0100) Subject: Die Basis für die contextrelativen URL's wird jetzt Applicationweit bestimmt X-Git-Tag: thymeroot-2.0.0~113 X-Git-Url: https://juplo.de/gitweb/?p=website;a=commitdiff_plain;h=5365a4f94603204ae695181aac091e951902ed82 Die Basis für die contextrelativen URL's wird jetzt Applicationweit bestimmt Zuvor wurde das Attribut "base" in jedem Template mithilfe des Tags aus der Spring-Taglib bestimmt. Jetzt wird das Attribut beim Start der Webanwendung einmalig bestimmt und im Application-Scope abgelegt. Das hat den Vorteil, dass das Attribut in abgeleiteten Webanwendungen, die die Templates wiederverwenden gezielt anders gesetzt werden kann. --- diff --git a/src/main/java/de/juplo/branding/web/ApplicationConfig.java b/src/main/java/de/juplo/branding/web/ApplicationConfig.java new file mode 100644 index 00000000..598f1b08 --- /dev/null +++ b/src/main/java/de/juplo/branding/web/ApplicationConfig.java @@ -0,0 +1,22 @@ +package de.juplo.branding.web; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import javax.servlet.ServletContext; +import org.springframework.stereotype.Component; + + +@Component +public class ApplicationConfig +{ + public static final String ATTRIBUTE_BASE = "base"; + + @Resource + private ServletContext context; + + @PostConstruct + public void configureApplication() + { + context.setAttribute(ATTRIBUTE_BASE, context.getContextPath() + '/'); + } +} \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/404.jsp b/src/main/webapp/WEB-INF/404.jsp index 92187072..d826d417 100644 --- a/src/main/webapp/WEB-INF/404.jsp +++ b/src/main/webapp/WEB-INF/404.jsp @@ -3,8 +3,6 @@ <%@page session="false" %> <%@page isErrorPage="true" %> <%@taglib uri="http://tiles.apache.org/tags-tiles" prefix="t" %> -<%@taglib uri="http://www.springframework.org/tags" prefix="s"%> - diff --git a/src/main/webapp/WEB-INF/error.jsp b/src/main/webapp/WEB-INF/error.jsp index 5644494b..b6359a36 100644 --- a/src/main/webapp/WEB-INF/error.jsp +++ b/src/main/webapp/WEB-INF/error.jsp @@ -3,8 +3,6 @@ <%@page session="false" %> <%@page isErrorPage="true" %> <%@taglib uri="http://tiles.apache.org/tags-tiles" prefix="t" %> -<%@taglib uri="http://www.springframework.org/tags" prefix="s"%> - diff --git a/src/main/webapp/WEB-INF/spring/mvc.xml b/src/main/webapp/WEB-INF/spring/mvc.xml index cc5a0376..5fb88cf1 100644 --- a/src/main/webapp/WEB-INF/spring/mvc.xml +++ b/src/main/webapp/WEB-INF/spring/mvc.xml @@ -2,17 +2,23 @@ + + + diff --git a/src/main/webapp/WEB-INF/templates/about.jsp b/src/main/webapp/WEB-INF/templates/about.jsp index 2360f2f4..c4e44586 100644 --- a/src/main/webapp/WEB-INF/templates/about.jsp +++ b/src/main/webapp/WEB-INF/templates/about.jsp @@ -1,8 +1,6 @@ <%@page contentType="text/html;charset=UTF-8"%> <%@page pageEncoding="UTF-8"%> <%@page session="false" %> -<%@taglib uri="http://www.springframework.org/tags" prefix="s"%> -