From e107b03350a1204d3c42dd2d13f5a487fd439606 Mon Sep 17 00:00:00 2001 From: Hugues Malphettes Date: Mon, 28 Jun 2010 09:57:04 +0000 Subject: [PATCH] bug 318152 git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2054 7e9141cc-0065-0410-87d8-b60c137991c4 --- .../webapp/JettyWebXmlConfiguration.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JettyWebXmlConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JettyWebXmlConfiguration.java index 24f245e5e00..26af0ea4973 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JettyWebXmlConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JettyWebXmlConfiguration.java @@ -13,6 +13,9 @@ package org.eclipse.jetty.webapp; +import java.util.HashMap; +import java.util.Map; + import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.xml.XmlConfiguration; @@ -29,6 +32,11 @@ import org.eclipse.jetty.xml.XmlConfiguration; */ public class JettyWebXmlConfiguration implements Configuration { + /** The value of this property points to the WEB-INF directory of + * the web-app currently installed. + * it is passed as a property to the jetty-web.xml file */ + public static final String PROPERTY_THIS_WEB_INF_URL = "this.web-inf.url"; + public void preConfigure(WebAppContext context) throws Exception { // TODO Auto-generated method stub @@ -74,6 +82,7 @@ public class JettyWebXmlConfiguration implements Configuration if(Log.isDebugEnabled()) Log.debug("Configure: "+jetty); XmlConfiguration jetty_config=new XmlConfiguration(jetty.getURL()); + setupXmlConfiguration(jetty_config, web_inf); jetty_config.configure(context); } finally @@ -85,6 +94,21 @@ public class JettyWebXmlConfiguration implements Configuration } } + /** + * Configures some well-known properties before the XmlConfiguration reads + * the configuration. + * @param jetty_config The configuration object. + */ + private void setupXmlConfiguration(XmlConfiguration jetty_config, Resource web_inf) + { + Map props = jetty_config.getProperties(); + if (props == null) + { + props = new HashMap(); + } + props.put(PROPERTY_THIS_WEB_INF_URL, web_inf.getURL()); + } + public void postConfigure(WebAppContext context) throws Exception {