Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2012-10-15 11:05:33 +0000
committerGreg Wilkins2012-10-15 11:05:33 +0000
commitf5d3fec4f817cb0f669294e10912c59a0f14c9ad (patch)
treec607e94f2b666293d8d7ef6da2d30ecc0ce8806b /jetty-deploy/src/main
parent9d62229dec84bfb5a2a652bb353abe6e82ec4ac8 (diff)
downloadorg.eclipse.jetty.project-f5d3fec4f817cb0f669294e10912c59a0f14c9ad.tar.gz
org.eclipse.jetty.project-f5d3fec4f817cb0f669294e10912c59a0f14c9ad.tar.xz
org.eclipse.jetty.project-f5d3fec4f817cb0f669294e10912c59a0f14c9ad.zip
jetty-9 removed context deployer and merged context and webapps directory
Diffstat (limited to 'jetty-deploy/src/main')
-rw-r--r--jetty-deploy/src/main/config/etc/jetty-contexts.xml23
-rw-r--r--jetty-deploy/src/main/config/etc/jetty-deploy.xml77
-rw-r--r--jetty-deploy/src/main/config/etc/jetty-webapps.xml26
-rw-r--r--jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ContextProvider.java94
-rw-r--r--jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java87
-rw-r--r--jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java141
6 files changed, 182 insertions, 266 deletions
diff --git a/jetty-deploy/src/main/config/etc/jetty-contexts.xml b/jetty-deploy/src/main/config/etc/jetty-contexts.xml
deleted file mode 100644
index caa7270dc3..0000000000
--- a/jetty-deploy/src/main/config/etc/jetty-contexts.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
-
-<!-- =============================================================== -->
-<!-- Add a ContextProvider to the deployment manager -->
-<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
-<!-- This scans the webapps directory for war files and directories -->
-<!-- to deploy. -->
-<!-- This configuration must be used with jetty-deploy.xml, which -->
-<!-- creates the deployment manager instance -->
-<!-- =============================================================== -->
-<Configure id="Server" class="org.eclipse.jetty.server.Server">
- <Ref id="DeploymentManager">
- <Call name="addAppProvider">
- <Arg>
- <New class="org.eclipse.jetty.deploy.providers.ContextProvider">
- <Set name="monitoredDirName"><Property name="jetty.home" default="." />/contexts</Set>
- <Set name="scanInterval">1</Set>
- </New>
- </Arg>
- </Call>
- </Ref>
-</Configure>
diff --git a/jetty-deploy/src/main/config/etc/jetty-deploy.xml b/jetty-deploy/src/main/config/etc/jetty-deploy.xml
index 1b3fd66dcd..5316b500dd 100644
--- a/jetty-deploy/src/main/config/etc/jetty-deploy.xml
+++ b/jetty-deploy/src/main/config/etc/jetty-deploy.xml
@@ -6,43 +6,48 @@
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- The deplyment manager handles the lifecycle of deploying web -->
<!-- applications. Apps are provided by instances of the -->
-<!-- AppProvider interface. Typically these are provided by -->
-<!-- one or more of: -->
-<!-- jetty-webapps.xml - monitors webapps for wars and dirs -->
-<!-- jetty-contexts.xml - monitors contexts for context xml -->
-<!-- jetty-templates.xml - monitors contexts and templates -->
+<!-- AppProvider interface. -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
- <Call name="addBean">
- <Arg>
- <New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
- <Set name="contexts">
- <Ref id="Contexts" />
- </Set>
- <Call name="setContextAttribute">
- <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
- <Arg>.*/servlet-api-[^/]*\.jar$</Arg>
- </Call>
-
-
- <!-- Add a customize step to the deployment lifecycle -->
- <!-- uncomment and replace DebugBinding with your extended AppLifeCycle.Binding class
- <Call name="insertLifeCycleNode">
- <Arg>deployed</Arg>
- <Arg>starting</Arg>
- <Arg>customise</Arg>
- </Call>
- <Call name="addLifeCycleBinding">
- <Arg>
- <New class="org.eclipse.jetty.deploy.bindings.DebugBinding">
- <Arg>customise</Arg>
- </New>
- </Arg>
- </Call>
- -->
-
- </New>
- </Arg>
- </Call>
+ <Call name="addBean">
+ <Arg>
+ <New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
+ <Set name="contexts">
+ <Ref id="Contexts" />
+ </Set>
+ <Call name="setContextAttribute">
+ <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
+ <Arg>.*/servlet-api-[^/]*\.jar$</Arg>
+ </Call>
+
+ <!-- Add a customize step to the deployment lifecycle -->
+ <!-- uncomment and replace DebugBinding with your extended AppLifeCycle.Binding class
+ <Call name="insertLifeCycleNode">
+ <Arg>deployed</Arg>
+ <Arg>starting</Arg>
+ <Arg>customise</Arg>
+ </Call>
+ <Call name="addLifeCycleBinding">
+ <Arg>
+ <New class="org.eclipse.jetty.deploy.bindings.DebugBinding">
+ <Arg>customise</Arg>
+ </New>
+ </Arg>
+ </Call> -->
+
+ <Call id="webappprovider" name="addAppProvider">
+ <Arg>
+ <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
+ <Set name="monitoredDirName"><Property name="jetty.home" default="." />/webapps</Set>
+ <Set name="defaultsDescriptor"><Property name="jetty.home" default="." />/etc/webdefault.xml</Set>
+ <Set name="scanInterval">1</Set>
+ <Set name="extractWars">true</Set>
+ </New>
+ </Arg>
+ </Call>
+
+ </New>
+ </Arg>
+ </Call>
</Configure>
diff --git a/jetty-deploy/src/main/config/etc/jetty-webapps.xml b/jetty-deploy/src/main/config/etc/jetty-webapps.xml
deleted file mode 100644
index 1071ae52d4..0000000000
--- a/jetty-deploy/src/main/config/etc/jetty-webapps.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
-
-<!-- =============================================================== -->
-<!-- Add a WebAppProvider to the deployment manager -->
-<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
-<!-- This scans the webapps directory for war files and directories -->
-<!-- to deploy. -->
-<!-- This configuration must be used with jetty-deploy.xml, which -->
-<!-- creates the deployment manager instance -->
-<!-- =============================================================== -->
-<Configure id="Server" class="org.eclipse.jetty.server.Server">
- <Ref id="DeploymentManager">
- <Call id="webappprovider" name="addAppProvider">
- <Arg>
- <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
- <Set name="monitoredDirName"><Property name="jetty.home" default="." />/webapps</Set>
- <Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set>
- <Set name="scanInterval">1</Set>
- <Set name="contextXmlDir"><Property name="jetty.home" default="." />/contexts</Set>
- <Set name="extractWars">true</Set>
- </New>
- </Arg>
- </Call>
- </Ref>
-</Configure>
diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ContextProvider.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ContextProvider.java
deleted file mode 100644
index 2c6b36d0c5..0000000000
--- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ContextProvider.java
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
-// ------------------------------------------------------------------------
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// and Apache License v2.0 which accompanies this distribution.
-//
-// The Eclipse Public License is available at
-// http://www.eclipse.org/legal/epl-v10.html
-//
-// The Apache License v2.0 is available at
-// http://www.opensource.org/licenses/apache2.0.php
-//
-// You may elect to redistribute this code under either of these licenses.
-// ========================================================================
-//
-
-package org.eclipse.jetty.deploy.providers;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-import org.eclipse.jetty.deploy.App;
-import org.eclipse.jetty.deploy.ConfigurationManager;
-import org.eclipse.jetty.deploy.util.FileID;
-import org.eclipse.jetty.server.handler.ContextHandler;
-import org.eclipse.jetty.util.annotation.ManagedObject;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.xml.XmlConfiguration;
-
-/** Context directory App Provider.
- * <p>This specialization of {@link ScanningAppProvider} is the
- * replacement for the old (and deprecated) <code>org.eclipse.jetty.deploy.ContextDeployer</code> and it will scan a directory
- * only for context.xml files.
- */
-@ManagedObject("Provider for starting webapps originating from context.xml files")
-public class ContextProvider extends ScanningAppProvider
-{
- private ConfigurationManager _configurationManager;
-
- public ContextProvider()
- {
- super( new FilenameFilter()
- {
- public boolean accept(File dir, String name)
- {
- if (!dir.exists())
- return false;
- String lowername = name.toLowerCase();
- if (lowername.startsWith("."))
- return false;
-
- return (lowername.endsWith(".xml") && !new File(dir,name).isDirectory());
- }
- });
- }
-
-
- /* ------------------------------------------------------------ */
- public ConfigurationManager getConfigurationManager()
- {
- return _configurationManager;
- }
-
- /* ------------------------------------------------------------ */
- /** Set the configurationManager.
- * @param configurationManager the configurationManager to set
- */
- public void setConfigurationManager(ConfigurationManager configurationManager)
- {
- _configurationManager = configurationManager;
- }
-
- /* ------------------------------------------------------------ */
- public ContextHandler createContextHandler(App app) throws Exception
- {
- Resource resource = Resource.newResource(app.getOriginId());
- File file = resource.getFile();
-
- if (resource.exists() && FileID.isXmlFile(file))
- {
- XmlConfiguration xmlc = new XmlConfiguration(resource.getURL());
-
- xmlc.getIdMap().put("Server",getDeploymentManager().getServer());
- if (getConfigurationManager() != null)
- xmlc.getProperties().putAll(getConfigurationManager().getProperties());
- return (ContextHandler)xmlc.configure();
- }
-
- throw new IllegalStateException("App resouce does not exist "+resource);
- }
-
-}
diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java
index 5ebecbfb4e..8d8ef3e528 100644
--- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java
+++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java
@@ -20,9 +20,13 @@ package org.eclipse.jetty.deploy.providers;
import java.io.File;
import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
import org.eclipse.jetty.deploy.App;
import org.eclipse.jetty.deploy.AppProvider;
@@ -45,8 +49,8 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
private Map<String, App> _appMap = new HashMap<String, App>();
private DeploymentManager _deploymentManager;
- protected final FilenameFilter _filenameFilter;
- private Resource _monitoredDir;
+ protected FilenameFilter _filenameFilter;
+ private final List<Resource> _monitored= new CopyOnWriteArrayList<>();
private boolean _recursive = false;
private int _scanInterval = 10;
private Scanner _scanner;
@@ -74,12 +78,25 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
};
/* ------------------------------------------------------------ */
+ protected ScanningAppProvider()
+ {
+ }
+
+ /* ------------------------------------------------------------ */
protected ScanningAppProvider(FilenameFilter filter)
{
_filenameFilter = filter;
}
/* ------------------------------------------------------------ */
+ protected void setFilenameFilter(FilenameFilter filter)
+ {
+ if (isRunning())
+ throw new IllegalStateException();
+ _filenameFilter = filter;
+ }
+
+ /* ------------------------------------------------------------ */
/**
* @return The index of currently deployed applications.
*/
@@ -110,15 +127,16 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
{
if (LOG.isDebugEnabled())
LOG.debug(this.getClass().getSimpleName() + ".doStart()");
- if (_monitoredDir == null)
- {
+ if (_monitored.size()==0)
throw new IllegalStateException("No configuration dir specified");
- }
- File scandir = _monitoredDir.getFile();
- LOG.info("Deployment monitor " + scandir + " at interval " + _scanInterval);
+ LOG.info("Deployment monitor " + _monitored + " at interval " + _scanInterval);
+ List<File> files = new ArrayList<>();
+ for (Resource resource:_monitored)
+ files.add(resource.getFile());
+
_scanner = new Scanner();
- _scanner.setScanDirs(Collections.singletonList(scandir));
+ _scanner.setScanDirs(files);
_scanner.setScanInterval(_scanInterval);
_scanner.setRecursive(_recursive);
_scanner.setFilenameFilter(_filenameFilter);
@@ -138,6 +156,12 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
_scanner = null;
}
}
+
+ /* ------------------------------------------------------------ */
+ protected boolean exists(String path)
+ {
+ return _scanner.exists(path);
+ }
/* ------------------------------------------------------------ */
protected void fileAdded(String filename) throws Exception
@@ -195,13 +219,18 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
/* ------------------------------------------------------------ */
public Resource getMonitoredDirResource()
{
- return _monitoredDir;
+ if (_monitored.size()==0)
+ return null;
+ if (_monitored.size()>1)
+ throw new IllegalStateException();
+ return _monitored.get(0);
}
/* ------------------------------------------------------------ */
public String getMonitoredDirName()
{
- return _monitoredDir.toString();
+ Resource resource=getMonitoredDirResource();
+ return resource==null?null:resource.toString();
}
/* ------------------------------------------------------------ */
@@ -219,30 +248,35 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
}
/* ------------------------------------------------------------ */
+ @Override
public void setDeploymentManager(DeploymentManager deploymentManager)
{
_deploymentManager = deploymentManager;
}
/* ------------------------------------------------------------ */
- public void setMonitoredDirResource(Resource contextsDir)
+ public void setMonitoredResources(List<Resource> resources)
{
- _monitoredDir = contextsDir;
+ _monitored.clear();
+ _monitored.addAll(resources);
}
-
+
/* ------------------------------------------------------------ */
- public void addScannerListener(Scanner.Listener listener)
+ public List<Resource> getMonitoredResources()
{
- _scanner.addListener(listener);
+ return Collections.unmodifiableList(_monitored);
+ }
+
+ /* ------------------------------------------------------------ */
+ public void setMonitoredDirResource(Resource resource)
+ {
+ setMonitoredResources(Collections.singletonList(resource));
}
/* ------------------------------------------------------------ */
- /**
- * @deprecated Use {@link #setMonitoredDirName(String)}
- */
- public void setMonitoredDir(String dir)
+ public void addScannerListener(Scanner.Listener listener)
{
- setMonitoredDirName(dir);
+ _scanner.addListener(listener);
}
/* ------------------------------------------------------------ */
@@ -252,16 +286,25 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
*/
public void setMonitoredDirName(String dir)
{
+ setMonitoredDirectories(Collections.singletonList(dir));
+ }
+
+ /* ------------------------------------------------------------ */
+ public void setMonitoredDirectories(Collection<String> directories)
+ {
try
{
- setMonitoredDirResource(Resource.newResource(dir));
+ List<Resource> resources = new ArrayList<>();
+ for (String dir:directories)
+ resources.add(Resource.newResource(dir));
+ setMonitoredResources(resources);
}
catch (Exception e)
{
throw new IllegalArgumentException(e);
}
}
-
+
/* ------------------------------------------------------------ */
protected void setRecursive(boolean recursive)
{
diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java
index 00550aec99..61aa16509d 100644
--- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java
+++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java
@@ -24,6 +24,7 @@ import java.io.IOException;
import java.net.MalformedURLException;
import org.eclipse.jetty.deploy.App;
+import org.eclipse.jetty.deploy.ConfigurationManager;
import org.eclipse.jetty.deploy.util.FileID;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.URIUtil;
@@ -31,31 +32,45 @@ import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.jetty.xml.XmlConfiguration;
/* ------------------------------------------------------------ */
-/** Context directory App Provider.
- * <p>This specialization of {@link ScanningAppProvider} is the
- * replacement for old (and deprecated) <code>org.eclipse.jetty.deploy.WebAppDeployer</code> and it will scan a directory
- * only for war files or directories files.</p>
+/** The webapps directory scanning provider.
* <p>
- * Webapps with names root or starting with root- are deployed at /.
- * If the name is in the format root-hostname, then the webapp is deployed
- * at / in the virtual host hostname.
+ * This provider scans one or more directories (typically "webapps") for contexts to
+ * deploy, which may be:<ul>
+ * <li>A standard WAR file (must end in ".war")</li>
+ * <li>A directory containing an expanded WAR file</li>
+ * <li>A directory containing static content</li>
+ * <li>An XML descriptor in {@link XmlConfiguration} format that configures a {@link ContextHandler} instance</li>
+ * </ul>
+ * <p>
+ * To avoid double deployments and allow flexibility of the content of the scanned directories, the provider
+ * implements some heuristics to ignore some files found in the scans: <ul>
+ * <li>Hidden files (starting with ".") are ignored</li>
+ * <li>Directories with names ending in ".d" are ignored</li>
+ * <li>If a directory and a WAR file exist ( eg foo/ and foo.war) then the directory is assumed to be
+ * the unpacked WAR and only the WAR is deployed (which may reused the unpacked directory)</li>
+ * <li>If a directory and a matching XML file exist ( eg foo/ and foo.xml) then the directory is assumed to be
+ * an unpacked WAR and only the XML is deployed (which may used the directory in it's configuration)</li>
+ * <li>If a WAR file and a matching XML exist (eg foo.war and foo.xml) then the WAR is assumed to
+ * be configured by the XML and only the XML is deployed.
+ * </ul>
+ *
*/
@ManagedObject("Provider for start-up deployement of webapps based on presence in directory")
public class WebAppProvider extends ScanningAppProvider
{
private boolean _extractWars = false;
private boolean _parentLoaderPriority = false;
+ private ConfigurationManager _configurationManager;
private String _defaultsDescriptor;
- private Filter _filter;
private File _tempDirectory;
private String[] _configurationClasses;
- public static class Filter implements FilenameFilter
+ public class Filter implements FilenameFilter
{
- private File _contexts;
-
+ @Override
public boolean accept(File dir, String name)
{
if (!dir.exists())
@@ -65,53 +80,59 @@ public class WebAppProvider extends ScanningAppProvider
String lowername = name.toLowerCase();
File file = new File(dir,name);
- // is it not a directory and not a war ?
- if (!file.isDirectory() && !lowername.endsWith(".war"))
- {
- return false;
- }
- //ignore hidden files
+ // ignore hidden files
if (lowername.startsWith("."))
return false;
-
+
+ // Ignore some directories
if (file.isDirectory())
{
- // is it a directory for an existing war file?
- if (new File(dir,name+".war").exists() ||
- new File(dir,name+".WAR").exists())
-
+ // is it a nominated config directory
+ if (lowername.endsWith(".d"))
+ return false;
+
+ // is it an unpacked directory for an existing war file?
+ if (exists(name+".war")||exists(name+".WAR"))
return false;
+ // is it a directory for an existing xml file?
+ if (exists(name+".xml")||exists(name+".XML"))
+ return false;
+
//is it a sccs dir?
if ("cvs".equals(lowername) || "cvsroot".equals(lowername))
return false;
+
+ // OK to deploy it then
+ return true;
}
- // is there a contexts config file
- if (_contexts!=null)
+ // else is it a war file
+ if (lowername.endsWith(".war"))
{
- String context=name;
- if (!file.isDirectory())
- {
- context=context.substring(0,context.length()-4);
- }
- if (new File(_contexts,context+".xml").exists() ||
- new File(_contexts,context+".XML").exists() )
- {
+ String base=name.substring(0,name.length()-4);
+ // ignore if it is a war for an existing xml file?
+ if (exists(base+".xml")||exists(base+".XML"))
return false;
- }
+
+ // OK to deploy it then
+ return true;
}
+
+ // else is it a context XML file
+ if (lowername.endsWith(".xml"))
+ return true;
- return true;
+ return false;
}
}
/* ------------------------------------------------------------ */
public WebAppProvider()
{
- super(new Filter());
- _filter=(Filter)_filenameFilter;
+ super();
+ setFilenameFilter(new Filter());
setScanInterval(0);
}
@@ -173,40 +194,20 @@ public class WebAppProvider extends ScanningAppProvider
}
/* ------------------------------------------------------------ */
- @ManagedAttribute("directory to scan for context.xml files")
- public String getContextXmlDir()
+ public ConfigurationManager getConfigurationManager()
{
- return _filter._contexts==null?null:_filter._contexts.toString();
+ return _configurationManager;
}
-
+
/* ------------------------------------------------------------ */
- /**
- * Set the directory in which to look for context XML files.
- * <p>
- * If a webapp call "foo/" or "foo.war" is discovered in the monitored
- * directory, then the ContextXmlDir is examined to see if a foo.xml
- * file exists. If it does, then this deployer will not deploy the webapp
- * and the ContextProvider should be used to act on the foo.xml file.
- * @see ContextProvider
- * @param contextsDir
+ /** Set the configurationManager.
+ * @param configurationManager the configurationManager to set
*/
- public void setContextXmlDir(String contextsDir)
+ public void setConfigurationManager(ConfigurationManager configurationManager)
{
- try
- {
- _filter._contexts=Resource.newResource(contextsDir).getFile();
- }
- catch (MalformedURLException e)
- {
- throw new RuntimeException(e);
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
+ _configurationManager = configurationManager;
}
-
/* ------------------------------------------------------------ */
/**
* @param configurations The configuration class names.
@@ -250,6 +251,7 @@ public class WebAppProvider extends ScanningAppProvider
}
/* ------------------------------------------------------------ */
+ @Override
public ContextHandler createContextHandler(final App app) throws Exception
{
Resource resource = Resource.newResource(app.getOriginId());
@@ -258,8 +260,17 @@ public class WebAppProvider extends ScanningAppProvider
throw new IllegalStateException("App resouce does not exist "+resource);
String context = file.getName();
-
- if (file.isDirectory())
+
+ if (resource.exists() && FileID.isXmlFile(file))
+ {
+ XmlConfiguration xmlc = new XmlConfiguration(resource.getURL());
+
+ xmlc.getIdMap().put("Server",getDeploymentManager().getServer());
+ if (getConfigurationManager() != null)
+ xmlc.getProperties().putAll(getConfigurationManager().getProperties());
+ return (ContextHandler)xmlc.configure();
+ }
+ else if (file.isDirectory())
{
// must be a directory
}

Back to the top