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: src-main-frontend--juplo--home-kai~29 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=5365a4f94603204ae695181aac091e951902ed82;p=website 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 0000000..598f1b0 --- /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 9218707..d826d41 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 5644494..b6359a3 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 cc5a037..5fb88cf 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 2360f2f..c4e4458 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"%> -