bug 318152

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2054 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Hugues Malphettes 2010-06-28 09:57:04 +00:00
parent 2c6e74d106
commit e107b03350
1 changed files with 24 additions and 0 deletions

View File

@ -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<Object,Object> props = jetty_config.getProperties();
if (props == null)
{
props = new HashMap<Object, Object>();
}
props.put(PROPERTY_THIS_WEB_INF_URL, web_inf.getURL());
}
public void postConfigure(WebAppContext context) throws Exception
{