jetty-9 removed context deployer and merged context and webapps directory
This commit is contained in:
parent
9d62229dec
commit
f5d3fec4f8
|
@ -21,7 +21,6 @@ package org.eclipse.jetty.embedded;
|
|||
import java.lang.management.ManagementFactory;
|
||||
|
||||
import org.eclipse.jetty.deploy.DeploymentManager;
|
||||
import org.eclipse.jetty.deploy.providers.ContextProvider;
|
||||
import org.eclipse.jetty.deploy.providers.WebAppProvider;
|
||||
import org.eclipse.jetty.jmx.MBeanContainer;
|
||||
import org.eclipse.jetty.security.HashLoginService;
|
||||
|
@ -102,18 +101,12 @@ public class LikeJettyXml
|
|||
deployer.setContexts(contexts);
|
||||
server.addBean(deployer);
|
||||
|
||||
ContextProvider context_provider = new ContextProvider();
|
||||
context_provider.setMonitoredDirName(jetty_home + "/contexts");
|
||||
context_provider.setScanInterval(2);
|
||||
deployer.addAppProvider(context_provider);
|
||||
|
||||
WebAppProvider webapp_provider = new WebAppProvider();
|
||||
webapp_provider.setMonitoredDirName(jetty_home + "/webapps");
|
||||
webapp_provider.setParentLoaderPriority(false);
|
||||
webapp_provider.setExtractWars(true);
|
||||
webapp_provider.setScanInterval(2);
|
||||
webapp_provider.setDefaultsDescriptor(jetty_home + "/etc/webdefault.xml");
|
||||
webapp_provider.setContextXmlDir(jetty_home + "/contexts");
|
||||
deployer.addAppProvider(webapp_provider);
|
||||
|
||||
HashLoginService login = new HashLoginService();
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.eclipse.jetty.embedded;
|
|||
import java.lang.management.ManagementFactory;
|
||||
|
||||
import org.eclipse.jetty.deploy.DeploymentManager;
|
||||
import org.eclipse.jetty.deploy.providers.ContextProvider;
|
||||
import org.eclipse.jetty.deploy.providers.WebAppProvider;
|
||||
import org.eclipse.jetty.io.ArrayByteBufferPool;
|
||||
import org.eclipse.jetty.io.ByteBufferPool;
|
||||
|
@ -155,18 +154,12 @@ public class SpdyServer
|
|||
deployer.setContexts(contexts);
|
||||
server.addBean(deployer);
|
||||
|
||||
ContextProvider context_provider = new ContextProvider();
|
||||
context_provider.setMonitoredDirName(jetty_home + "/contexts");
|
||||
context_provider.setScanInterval(2);
|
||||
deployer.addAppProvider(context_provider);
|
||||
|
||||
WebAppProvider webapp_provider = new WebAppProvider();
|
||||
webapp_provider.setMonitoredDirName(jetty_home + "/webapps");
|
||||
webapp_provider.setParentLoaderPriority(false);
|
||||
webapp_provider.setExtractWars(true);
|
||||
webapp_provider.setScanInterval(2);
|
||||
webapp_provider.setDefaultsDescriptor(jetty_home + "/etc/webdefault.xml");
|
||||
webapp_provider.setContextXmlDir(jetty_home + "/contexts");
|
||||
deployer.addAppProvider(webapp_provider);
|
||||
|
||||
HashLoginService login = new HashLoginService();
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
|
@ -73,12 +77,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,15 +248,29 @@ 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 List<Resource> getMonitoredResources()
|
||||
{
|
||||
return Collections.unmodifiableList(_monitored);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void setMonitoredDirResource(Resource resource)
|
||||
{
|
||||
setMonitoredResources(Collections.singletonList(resource));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -235,15 +278,6 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
|
|||
{
|
||||
_scanner.addListener(listener);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @deprecated Use {@link #setMonitoredDirName(String)}
|
||||
*/
|
||||
public void setMonitoredDir(String dir)
|
||||
{
|
||||
setMonitoredDirName(dir);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
|
@ -251,17 +285,26 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
|
|||
* Directory to scan for context descriptors or war files
|
||||
*/
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -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,39 +194,19 @@ 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();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public void setContextXmlDir(String contextsDir)
|
||||
{
|
||||
try
|
||||
{
|
||||
_filter._contexts=Resource.newResource(contextsDir).getFile();
|
||||
}
|
||||
catch (MalformedURLException e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return _configurationManager;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Set the configurationManager.
|
||||
* @param configurationManager the configurationManager to set
|
||||
*/
|
||||
public void setConfigurationManager(ConfigurationManager configurationManager)
|
||||
{
|
||||
_configurationManager = configurationManager;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
|
@ -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
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class GlobalWebappConfigBindingTest
|
|||
jetty.addConfiguration("jetty.xml");
|
||||
|
||||
// Setup initial context
|
||||
jetty.copyContext("foo.xml","foo.xml");
|
||||
jetty.copyWebapp("foo.xml","foo.xml");
|
||||
jetty.copyWebapp("foo-webapp-1.war","foo.war");
|
||||
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ public class ScanningAppProviderRuntimeUpdatesTest
|
|||
public void testAfterStartupContext() throws IOException
|
||||
{
|
||||
jetty.copyWebapp("foo-webapp-1.war","foo.war");
|
||||
jetty.copyContext("foo.xml","foo.xml");
|
||||
jetty.copyWebapp("foo.xml","foo.xml");
|
||||
|
||||
waitForDirectoryScan();
|
||||
waitForDirectoryScan();
|
||||
|
@ -127,14 +127,14 @@ public class ScanningAppProviderRuntimeUpdatesTest
|
|||
public void testAfterStartupThenRemoveContext() throws IOException
|
||||
{
|
||||
jetty.copyWebapp("foo-webapp-1.war","foo.war");
|
||||
jetty.copyContext("foo.xml","foo.xml");
|
||||
jetty.copyWebapp("foo.xml","foo.xml");
|
||||
|
||||
waitForDirectoryScan();
|
||||
waitForDirectoryScan();
|
||||
|
||||
jetty.assertWebAppContextsExists("/foo");
|
||||
|
||||
jetty.removeContext("foo.xml");
|
||||
jetty.removeWebapp("foo.xml");
|
||||
|
||||
waitForDirectoryScan();
|
||||
waitForDirectoryScan();
|
||||
|
@ -155,7 +155,7 @@ public class ScanningAppProviderRuntimeUpdatesTest
|
|||
|
||||
|
||||
jetty.copyWebapp("foo-webapp-1.war","foo.war");
|
||||
jetty.copyContext("foo.xml","foo.xml");
|
||||
jetty.copyWebapp("foo.xml","foo.xml");
|
||||
|
||||
waitForDirectoryScan();
|
||||
waitForDirectoryScan();
|
||||
|
@ -167,7 +167,7 @@ public class ScanningAppProviderRuntimeUpdatesTest
|
|||
|
||||
waitForDirectoryScan();
|
||||
//System.err.println("Updating war files");
|
||||
jetty.copyContext("foo.xml","foo.xml"); // essentially "touch" the context xml
|
||||
jetty.copyWebapp("foo.xml","foo.xml"); // essentially "touch" the context xml
|
||||
jetty.copyWebapp("foo-webapp-2.war","foo.war");
|
||||
|
||||
// This should result in the existing foo.war being replaced with the new foo.war
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ScanningAppProviderStartupTest
|
|||
jetty.addConfiguration("jetty-deploymgr-contexts.xml");
|
||||
|
||||
// Setup initial context
|
||||
jetty.copyContext("foo.xml","foo.xml");
|
||||
jetty.copyWebapp("foo.xml","foo.xml");
|
||||
jetty.copyWebapp("foo-webapp-1.war","foo.war");
|
||||
|
||||
// Should not throw an Exception
|
||||
|
|
|
@ -43,7 +43,6 @@ public class WebAppProviderTest
|
|||
jetty.addConfiguration("jetty-deploy-wars.xml");
|
||||
|
||||
// Setup initial context
|
||||
jetty.copyContext("foo.xml","foo.xml");
|
||||
jetty.copyWebapp("foo-webapp-1.war","foo.war");
|
||||
|
||||
// Should not throw an Exception
|
||||
|
|
|
@ -87,13 +87,6 @@ public class XmlConfiguredJetty
|
|||
IO.copyFile(MavenTestingUtils.getTestResourceFile("etc/realm.properties"),new File(etcDir,"realm.properties"));
|
||||
IO.copyFile(MavenTestingUtils.getTestResourceFile("etc/webdefault.xml"),new File(etcDir,"webdefault.xml"));
|
||||
|
||||
File contextsDir = new File(_jettyHome,"contexts");
|
||||
if (contextsDir.exists())
|
||||
{
|
||||
deleteContents(contextsDir);
|
||||
}
|
||||
contextsDir.mkdirs();
|
||||
|
||||
File webappsDir = new File(_jettyHome,"webapps");
|
||||
if (webappsDir.exists())
|
||||
{
|
||||
|
@ -182,7 +175,7 @@ public class XmlConfiguredJetty
|
|||
|
||||
public void assertResponseContains(String path, String needle) throws IOException
|
||||
{
|
||||
System.err.println("Issuing request to " + path);
|
||||
// System.err.println("Issuing request to " + path);
|
||||
String content = getResponse(path);
|
||||
Assert.assertTrue("Content should contain <" + needle + ">, instead got <" + content + ">",content.contains(needle));
|
||||
}
|
||||
|
@ -220,18 +213,6 @@ public class XmlConfiguredJetty
|
|||
}
|
||||
}
|
||||
|
||||
public void copyContext(String srcName, String destName) throws IOException
|
||||
{
|
||||
System.err.printf("Copying Context: %s -> %s%n",srcName,destName);
|
||||
File srcDir = MavenTestingUtils.getTestResourceDir("contexts");
|
||||
File destDir = new File(_jettyHome,"contexts");
|
||||
|
||||
File srcFile = new File(srcDir,srcName);
|
||||
File destFile = new File(destDir,destName);
|
||||
|
||||
copyFile("Context",srcFile,destFile);
|
||||
}
|
||||
|
||||
private void copyFile(String type, File srcFile, File destFile) throws IOException
|
||||
{
|
||||
PathAssert.assertFileExists(type + " File",srcFile);
|
||||
|
@ -255,7 +236,7 @@ public class XmlConfiguredJetty
|
|||
|
||||
private void deleteContents(File dir)
|
||||
{
|
||||
System.err.printf("Delete (dir) %s/%n",dir);
|
||||
// System.err.printf("Delete (dir) %s/%n",dir);
|
||||
if (!dir.exists())
|
||||
{
|
||||
return;
|
||||
|
@ -319,7 +300,6 @@ public class XmlConfiguredJetty
|
|||
{
|
||||
List<WebAppContext> contexts = new ArrayList<>();
|
||||
HandlerCollection handlers = (HandlerCollection)_server.getHandler();
|
||||
System.err.println(_server.dump());
|
||||
Handler children[] = handlers.getChildHandlers();
|
||||
|
||||
for (Handler handler : children)
|
||||
|
@ -379,13 +359,13 @@ public class XmlConfiguredJetty
|
|||
this._server.setStopTimeout(10);
|
||||
}
|
||||
|
||||
public void removeContext(String name)
|
||||
public void removeWebapp(String name)
|
||||
{
|
||||
File destDir = new File(_jettyHome,"contexts");
|
||||
File destDir = new File(_jettyHome,"webapps");
|
||||
File contextFile = new File(destDir,name);
|
||||
if (contextFile.exists())
|
||||
{
|
||||
Assert.assertTrue("Delete of Context file: " + contextFile.getAbsolutePath(),contextFile.delete());
|
||||
Assert.assertTrue("Delete of Webapp file: " + contextFile.getAbsolutePath(),contextFile.delete());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@
|
|||
<Set name="appProviders">
|
||||
<Array type="org.eclipse.jetty.deploy.AppProvider">
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.deploy.providers.ContextProvider">
|
||||
<Set name="monitoredDirName"><SystemProperty name="jetty.home" />/contexts</Set>
|
||||
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
|
||||
<Set name="monitoredDirName"><SystemProperty name="jetty.home" />/webapps</Set>
|
||||
<Set name="scanInterval">1</Set>
|
||||
<Set name="configurationManager">
|
||||
<New class="org.eclipse.jetty.deploy.FileConfigurationManager">
|
||||
|
@ -58,13 +58,6 @@
|
|||
</Set>
|
||||
</New>
|
||||
</Item>
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
|
||||
<Set name="monitoredDirName"><SystemProperty name="jetty.home" />/webapps</Set>
|
||||
<Set name="scanInterval">1</Set>
|
||||
<Set name="contextXmlDir"><SystemProperty name="jetty.home" />/contexts</Set>
|
||||
</New>
|
||||
</Item>
|
||||
</Array>
|
||||
</Set>
|
||||
</New>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
|
||||
<Set name="monitoredDirName"><SystemProperty name="jetty.home" />/webapps</Set>
|
||||
<Set name="scanInterval">1</Set>
|
||||
<Set name="tempDir"><Property name="jetty.home" default="target" />/workish</Set>
|
||||
<Set name="tempDir"><Property name="jetty.home" default="target" />/workish</Set>
|
||||
</New>
|
||||
</Item>
|
||||
</Array>
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
<Set name="appProviders">
|
||||
<Array type="org.eclipse.jetty.deploy.AppProvider">
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.deploy.providers.ContextProvider">
|
||||
<Set name="monitoredDirName"><SystemProperty name="jetty.home" />/contexts</Set>
|
||||
<Set name="scanInterval">1</Set>
|
||||
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
|
||||
<Set name="monitoredDirName"><SystemProperty name="jetty.home" />/webapps</Set>
|
||||
<Set name="scanInterval">1</Set>
|
||||
<Set name="configurationManager">
|
||||
<New class="org.eclipse.jetty.deploy.FileConfigurationManager">
|
||||
<Set name="file">
|
||||
|
@ -25,13 +25,6 @@
|
|||
</Set>
|
||||
</New>
|
||||
</Item>
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
|
||||
<Set name="monitoredDirName"><SystemProperty name="jetty.home" />/webapps</Set>
|
||||
<Set name="scanInterval">1</Set>
|
||||
<Set name="contextXmlDir"><SystemProperty name="jetty.home" />/contexts</Set>
|
||||
</New>
|
||||
</Item>
|
||||
</Array>
|
||||
</Set>
|
||||
</New>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
|
||||
org.eclipse.jetty.deploy.LEVEL=WARN
|
||||
|
||||
org.eclipse.jetty.util.Scanner=WARN
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
|
||||
This directory is scanned by the ContextDeployer instance
|
||||
configured by the standard $JETTY_HOME/etc/jetty.xml configuration.
|
||||
|
||||
It should contain XmlConfiguration files that describe individual
|
||||
contexts to be deployed to the server. This directory is scanned
|
||||
for additions, removals and updates for hot deployment.
|
||||
|
||||
Frequenty the context configuration files here will reference
|
||||
war files or directories from $JETTY_HOME/webapps. Care must be
|
||||
taken to avoid a WebAppDeployer deploying duplicates of such
|
||||
webapplications.
|
||||
|
||||
The directory ../contexts-available contains more example contexts
|
||||
that may be deployed by being copied here.
|
|
@ -0,0 +1,9 @@
|
|||
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
|
||||
org.eclipse.jetty.LEVEL=INFO
|
||||
org.eclipse.jetty.STACKS=true
|
||||
org.eclipse.jetty.SOURCE=false
|
||||
#org.eclipse.jetty.STACKS=false
|
||||
#org.eclipse.jetty.spdy.LEVEL=DEBUG
|
||||
#org.eclipse.jetty.server.LEVEL=DEBUG
|
||||
#org.eclipse.jetty.io.ssl.LEVEL=DEBUG
|
||||
#org.eclipse.jetty.spdy.server.LEVEL=DEBUG
|
|
@ -126,8 +126,6 @@ etc/jetty-https.xml
|
|||
# Webapplication Deployer
|
||||
#-----------------------------------------------------------
|
||||
etc/jetty-deploy.xml
|
||||
etc/jetty-webapps.xml
|
||||
etc/jetty-contexts.xml
|
||||
#===========================================================
|
||||
|
||||
#===========================================================
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
This directory is scanned by the WebAppDeployer provider for
|
||||
web applications to deploy. It may contain:
|
||||
|
||||
+ standard WAR files
|
||||
+ directories that are deployed as static content, except for
|
||||
directories ending in ".d", which are ignored.
|
||||
+ Context XML files that contain XmlConfiguration which
|
||||
describe individual contexts to be deployed to the server.
|
||||
|
||||
This directory is scanned for additions, removals and updates
|
||||
for hot deployment.
|
||||
|
|
@ -29,7 +29,6 @@ import java.util.Set;
|
|||
import org.eclipse.jetty.deploy.App;
|
||||
import org.eclipse.jetty.deploy.AppProvider;
|
||||
import org.eclipse.jetty.deploy.DeploymentManager;
|
||||
import org.eclipse.jetty.deploy.providers.ContextProvider;
|
||||
import org.eclipse.jetty.deploy.providers.ScanningAppProvider;
|
||||
import org.eclipse.jetty.osgi.boot.utils.internal.PackageAdminServiceTracker;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
|
@ -92,6 +91,7 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider
|
|||
{
|
||||
OSGiAppProvider _enclosedInstance;
|
||||
|
||||
@Override
|
||||
public boolean accept(File dir, String name)
|
||||
{
|
||||
File file = new File(dir, name);
|
||||
|
@ -180,6 +180,7 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider
|
|||
*
|
||||
* @see AppProvider
|
||||
*/
|
||||
@Override
|
||||
public ContextHandler createContextHandler(App app) throws Exception
|
||||
{
|
||||
// return pre-created Context
|
||||
|
|
|
@ -354,5 +354,34 @@
|
|||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
<artifactId>lifecycle-mapping</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<configuration>
|
||||
<lifecycleMappingMetadata>
|
||||
<pluginExecutions>
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId>org.apache.servicemix.tooling</groupId>
|
||||
<artifactId>depends-maven-plugin</artifactId>
|
||||
<versionRange>[1.2,)</versionRange>
|
||||
<goals>
|
||||
<goal>generate-depends-file</goal>
|
||||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<ignore></ignore>
|
||||
</action>
|
||||
</pluginExecution>
|
||||
</pluginExecutions>
|
||||
</lifecycleMappingMetadata>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
|
@ -1,24 +0,0 @@
|
|||
2010-11-17 17:49:57,785 [main] INFO [info.jtrac.config.JtracConfigurer] - found 'jtrac-init.properties' on classpath, processing...
|
||||
2010-11-17 17:49:57,785 [main] INFO [info.jtrac.config.JtracConfigurer] - 'jtrac.home' property initialized from 'jtrac-init.properties' as '/tmp/jtrac-red'
|
||||
2010-11-17 17:49:57,785 [main] INFO [info.jtrac.config.JtracConfigurer] - locales available configured are 'en'
|
||||
2010-11-17 17:49:57,785 [main] INFO [info.jtrac.config.JtracConfigurer] - directory already exists: '/tmp/jtrac-red'
|
||||
2010-11-17 17:49:57,785 [main] INFO [info.jtrac.config.JtracConfigurer] - directory already exists: '/tmp/jtrac-red/attachments'
|
||||
2010-11-17 17:49:57,785 [main] INFO [info.jtrac.config.JtracConfigurer] - directory already exists: '/tmp/jtrac-red/indexes'
|
||||
2010-11-17 17:49:57,785 [main] INFO [info.jtrac.config.JtracConfigurer] - 'jtrac.properties' file exists: '/tmp/jtrac-red/jtrac.properties'
|
||||
2010-11-17 17:49:57,786 [main] INFO [info.jtrac.config.JtracConfigurer] - found 'jtrac-version.properties' on classpath, processing...
|
||||
2010-11-17 17:49:57,786 [main] INFO [info.jtrac.config.JtracConfigurer] - jtrac.version = '2.1.0'
|
||||
2010-11-17 17:49:57,786 [main] INFO [info.jtrac.config.JtracConfigurer] - jtrac.timestamp = '200803022120'
|
||||
2010-11-17 17:49:57,786 [main] INFO [info.jtrac.config.JtracConfigurer] - Loading properties file from file [/tmp/jtrac-red/jtrac.properties]
|
||||
2010-11-17 17:49:57,804 [main] INFO [info.jtrac.config.DataSourceFactoryBean] - embedded HSQLDB mode detected, switching on spring single connection data source
|
||||
2010-11-17 17:49:57,950 [main] INFO [info.jtrac.hibernate.HibernateJtracDao] - database schema exists, normal startup
|
||||
2010-11-17 17:49:57,952 [main] INFO [info.jtrac.JtracImpl] - available locales configured {en=en - English}
|
||||
2010-11-17 17:49:57,954 [main] WARN [info.jtrac.mail.MailSender] - 'mail.server.host' config is null, mail sender not initialized
|
||||
2010-11-17 17:49:57,954 [main] WARN [info.jtrac.JtracImpl] - invalid default locale configured = 'null', using en
|
||||
2010-11-17 17:49:57,954 [main] INFO [info.jtrac.JtracImpl] - default locale set to 'en'
|
||||
2010-11-17 17:49:57,954 [main] WARN [info.jtrac.JtracImpl] - invalid attachment max size 'null', using 5
|
||||
2010-11-17 17:49:57,954 [main] INFO [info.jtrac.JtracImpl] - attachment max size set to 5 MB
|
||||
2010-11-17 17:49:57,954 [main] WARN [info.jtrac.JtracImpl] - invalid session timeout 'null', using 30
|
||||
2010-11-17 17:49:57,954 [main] INFO [info.jtrac.JtracImpl] - session timeout set to 30 minutes
|
||||
2010-11-17 17:49:57,975 [main] INFO [info.jtrac.wicket.JtracApplication] - casProxyTicketValidator not found in application context, CAS single-sign-on is not being used
|
||||
2010-11-17 17:53:44,141 [Scanner-0] INFO [info.jtrac.config.DataSourceFactoryBean] - attempting to shut down embedded HSQLDB database
|
||||
2010-11-17 17:53:44,253 [Scanner-0] INFO [info.jtrac.config.DataSourceFactoryBean] - embedded HSQLDB database shut down successfully
|
|
@ -1,61 +0,0 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-project</artifactId>
|
||||
<version>9.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jetty-overlay-deployer</artifactId>
|
||||
<name>Jetty :: Overlay Deployer</name>
|
||||
<description>Overlayed deployer</description>
|
||||
<properties>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>${basedir}/src/main/assembly/config.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-deploy</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-plus</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.orbit</groupId>
|
||||
<artifactId>javax.transaction</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
<artifactId>jetty-test-helper</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<assembly>
|
||||
<id>config</id>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<formats>
|
||||
<format>jar</format>
|
||||
</formats>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>src/main/config</directory>
|
||||
<outputDirectory></outputDirectory>
|
||||
<includes>
|
||||
<include>etc/**</include>
|
||||
<include>overlays/**</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
|
@ -1,24 +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 id="OverlayedAppProvider" class="org.eclipse.jetty.overlays.OverlayedAppProvider">
|
||||
<Set name="scanDir"><Property name="jetty.home" default="." />/overlays</Set>
|
||||
<Set name="nodeName"><Property name="node.name" default="nonameNode"/></Set>
|
||||
<Set name="scanInterval">1</Set>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
</Ref>
|
||||
</Configure>
|
|
@ -1,27 +0,0 @@
|
|||
|
||||
|
||||
Cloudtide instance
|
||||
===================
|
||||
|
||||
This directory contains overlays (as directories or jars) that
|
||||
are define instances of templates to be deployed.
|
||||
|
||||
An instance filename consists of a template name, the '=' character (or '--' string)
|
||||
and then an instance identifier. For example:
|
||||
|
||||
mytemplate=redInstance
|
||||
|
||||
This defines a instance called redInstance using the template called mytemplate.
|
||||
|
||||
An overlay is structed as a WAR, but also may contain:
|
||||
* WEB-INF/lib-overlay directory, which can contain jar files made available to
|
||||
the overlay.xml configuration (unlike any overlayed WEB-INF/lib jars).
|
||||
|
||||
* A WEB-INF/overlay.xml file, which is an XmlConfiguration format file used to
|
||||
inject the ContextHandler instance.
|
||||
|
||||
* A WEB-INF/web-overlay.xml fragment that is applied as an override descriptor
|
||||
|
||||
* Static content that overlays the static content of the webapp, node and template.
|
||||
|
||||
* WEB-INF/classes and WEB-INF/lib that overlays the code of the webapp, node and template.
|
|
@ -1,20 +0,0 @@
|
|||
|
||||
|
||||
Cloudtide nodes
|
||||
===============
|
||||
|
||||
This directory contains overlays (as directories or jars) that
|
||||
are applied to all instances for a given node.
|
||||
|
||||
An overlay is structed as a WAR, but also may contain:
|
||||
* WEB-INF/lib-overlay directory, which can contain jar files made available to
|
||||
the overlay.xml configuration (unlike any overlayed WEB-INF/lib jars).
|
||||
|
||||
* A WEB-INF/overlay.xml file, which is an XmlConfiguration format file used to
|
||||
inject the ContextHandler instance.
|
||||
|
||||
* A WEB-INF/web-overlay.xml fragment that is applied as an override descriptor
|
||||
|
||||
* Static content that overlays the static content of the webapp, node and template.
|
||||
|
||||
* WEB-INF/classes and WEB-INF/lib that overlays the code of the webapp, node and template.
|
|
@ -1,32 +0,0 @@
|
|||
|
||||
Cloudtide templates
|
||||
===================
|
||||
|
||||
This directory contains overlays (as directories or jars) that
|
||||
are applied to webapps to create templates. Templates are not directly
|
||||
deployed, but are used by overlays in the instances directory.
|
||||
|
||||
A Template filename consists of a template name, the '=' character and
|
||||
then the webapp name. For example:
|
||||
|
||||
mytemplate=mywebapp-1.2.3
|
||||
|
||||
This defines a template called mytemplate that overlays either the mywebapp-1.2.3.war
|
||||
file or the mywebapp-1.2.3 directory in cloudtide/webapps.
|
||||
|
||||
An overlay is structed as a WAR, and may contain:
|
||||
* WEB-INF/template.xml a XmlConfiguration formatted file that is applied to a shared
|
||||
instance of TemplateContext to provide the common classloader and resource cache to
|
||||
all instances of the template.
|
||||
|
||||
* WEB-INF/lib-overlay directory, which can contain jar files made available to
|
||||
the overlay.xml configuration (unlike any overlayed WEB-INF/lib jars).
|
||||
|
||||
* A WEB-INF/overlay.xml file, which is an XmlConfiguration format file used to
|
||||
inject the ContextHandler instance.
|
||||
|
||||
* A WEB-INF/web-overlay.xml fragment that is applied as an override descriptor
|
||||
|
||||
* Static content that overlays the static content of the webapp, node and template.
|
||||
|
||||
* WEB-INF/classes and WEB-INF/lib that overlays the code of the webapp, node and template.
|
|
@ -1,6 +0,0 @@
|
|||
|
||||
Cloudtide webapplication
|
||||
------------------------
|
||||
|
||||
This directory contains webapplication directories or war files that are used by the
|
||||
cloudtide templates
|
File diff suppressed because it is too large
Load Diff
|
@ -1,290 +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.overlays;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.PermissionCollection;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jetty.http.MimeTypes;
|
||||
import org.eclipse.jetty.server.ResourceCache;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.util.component.AggregateLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Destroyable;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.webapp.ClasspathPattern;
|
||||
import org.eclipse.jetty.webapp.WebAppClassLoader;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
import org.eclipse.jetty.xml.XmlConfiguration;
|
||||
|
||||
/**
|
||||
* A Cloudtide template context.
|
||||
* <p>
|
||||
* This class is configured by the template.xml files and is used to control the
|
||||
* shared resource cache and classloader.
|
||||
* <p>
|
||||
* This class is an AggregateLifeCycle, so dependent beans may be added to the template and will be started, stopped and destroyed with the template.
|
||||
* The template is started after the template.xml file have been applied. It is stopped and destroyed after the last instance using the template is undeployed.
|
||||
*/
|
||||
public class TemplateContext extends AggregateLifeCycle implements WebAppClassLoader.Context, Destroyable
|
||||
{
|
||||
private final ClassLoader _libLoader;
|
||||
|
||||
private final Resource _baseResource;
|
||||
private final ResourceCache _resourceCache;
|
||||
private final Server _server;
|
||||
private final MimeTypes _mimeTypes;
|
||||
private final WebAppClassLoader _webappLoader;
|
||||
|
||||
private ClasspathPattern _systemClasses;
|
||||
private ClasspathPattern _serverClasses;
|
||||
private PermissionCollection _permissions;
|
||||
|
||||
private boolean _parentLoaderPriority;
|
||||
|
||||
private String _extraClasspath;
|
||||
|
||||
private Map<String, Object> _idMap;
|
||||
|
||||
|
||||
public ClassLoader getLibLoader()
|
||||
{
|
||||
return _libLoader;
|
||||
}
|
||||
|
||||
public TemplateContext()
|
||||
{
|
||||
_server=null;
|
||||
_baseResource=null;
|
||||
_mimeTypes=new MimeTypes();
|
||||
_resourceCache=null;
|
||||
_webappLoader=null;
|
||||
_libLoader=null;
|
||||
}
|
||||
|
||||
public TemplateContext(String key, Server server,Resource baseResource, ClassLoader libLoader) throws IOException
|
||||
{
|
||||
_server=server;
|
||||
_baseResource=baseResource;
|
||||
_mimeTypes=new MimeTypes();
|
||||
_resourceCache=new ResourceCache(null,baseResource,_mimeTypes);
|
||||
|
||||
String[] patterns = (String[])_server.getAttribute(WebAppContext.SERVER_SRV_CLASSES);
|
||||
_serverClasses=new ClasspathPattern(patterns==null?WebAppContext.__dftServerClasses:patterns);
|
||||
patterns = (String[])_server.getAttribute(WebAppContext.SERVER_SYS_CLASSES);
|
||||
_systemClasses=new ClasspathPattern(patterns==null?WebAppContext.__dftSystemClasses:patterns);
|
||||
_libLoader=libLoader;
|
||||
|
||||
|
||||
// Is this a webapp or a normal context
|
||||
Resource classes=getBaseResource().addPath("WEB-INF/classes/");
|
||||
Resource lib=getBaseResource().addPath("WEB-INF/lib/");
|
||||
if (classes.exists() && classes.isDirectory() || lib.exists() && lib.isDirectory())
|
||||
{
|
||||
_webappLoader=new WebAppClassLoader(_libLoader,this);
|
||||
_webappLoader.setName(key);
|
||||
if (classes.exists())
|
||||
_webappLoader.addClassPath(classes);
|
||||
if (lib.exists())
|
||||
_webappLoader.addJars(lib);
|
||||
}
|
||||
else
|
||||
_webappLoader=null;
|
||||
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public Resource getBaseResource()
|
||||
{
|
||||
return _baseResource;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @return Comma or semicolon separated path of filenames or URLs
|
||||
* pointing to directories or jar files. Directories should end
|
||||
* with '/'.
|
||||
*/
|
||||
public String getExtraClasspath()
|
||||
{
|
||||
return _extraClasspath;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public MimeTypes getMimeTypes()
|
||||
{
|
||||
return _mimeTypes;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public PermissionCollection getPermissions()
|
||||
{
|
||||
return _permissions;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public ResourceCache getResourceCache()
|
||||
{
|
||||
return _resourceCache;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public Server getServer()
|
||||
{
|
||||
return _server;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
WebAppClassLoader getWebappLoader()
|
||||
{
|
||||
return _webappLoader;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public boolean isParentLoaderPriority()
|
||||
{
|
||||
return _parentLoaderPriority;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public boolean isServerClass(String clazz)
|
||||
{
|
||||
return _serverClasses.match(clazz);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public boolean isSystemClass(String clazz)
|
||||
{
|
||||
return _systemClasses.match(clazz);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public Resource newResource(String urlOrPath) throws IOException
|
||||
{
|
||||
return Resource.newResource(urlOrPath);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @param extraClasspath Comma or semicolon separated path of filenames or URLs
|
||||
* pointing to directories or jar files. Directories should end
|
||||
* with '/'.
|
||||
*/
|
||||
public void setExtraClasspath(String extraClasspath)
|
||||
{
|
||||
_extraClasspath=extraClasspath;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @param java2compliant The java2compliant to set.
|
||||
*/
|
||||
public void setParentLoaderPriority(boolean java2compliant)
|
||||
{
|
||||
_parentLoaderPriority = java2compliant;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @param permissions The permissions to set.
|
||||
*/
|
||||
public void setPermissions(PermissionCollection permissions)
|
||||
{
|
||||
_permissions = permissions;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Set the server classes patterns.
|
||||
* <p>
|
||||
* Server classes/packages are classes used to implement the server and are hidden
|
||||
* from the context. If the context needs to load these classes, it must have its
|
||||
* own copy of them in WEB-INF/lib or WEB-INF/classes.
|
||||
* A class pattern is a string of one of the forms:<dl>
|
||||
* <dt>org.package.Classname</dt><dd>Match a specific class</dd>
|
||||
* <dt>org.package.</dt><dd>Match a specific package hierarchy</dd>
|
||||
* <dt>-org.package.Classname</dt><dd>Exclude a specific class</dd>
|
||||
* <dt>-org.package.</dt><dd>Exclude a specific package hierarchy</dd>
|
||||
* </dl>
|
||||
* @param serverClasses The serverClasses to set.
|
||||
*/
|
||||
public void setServerClasses(String[] serverClasses)
|
||||
{
|
||||
_serverClasses = new ClasspathPattern(serverClasses);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Set the system classes patterns.
|
||||
* <p>
|
||||
* System classes/packages are classes provided by the JVM and that
|
||||
* cannot be replaced by classes of the same name from WEB-INF,
|
||||
* regardless of the value of {@link #setParentLoaderPriority(boolean)}.
|
||||
* A class pattern is a string of one of the forms:<dl>
|
||||
* <dt>org.package.Classname</dt><dd>Match a specific class</dd>
|
||||
* <dt>org.package.</dt><dd>Match a specific package hierarchy</dd>
|
||||
* <dt>-org.package.Classname</dt><dd>Exclude a specific class</dd>
|
||||
* <dt>-org.package.</dt><dd>Exclude a specific package hierarchy</dd>
|
||||
* </dl>
|
||||
* @param systemClasses The systemClasses to set.
|
||||
*/
|
||||
public void setSystemClasses(String[] systemClasses)
|
||||
{
|
||||
_systemClasses = new ClasspathPattern(systemClasses);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void addSystemClass(String classname)
|
||||
{
|
||||
_systemClasses.addPattern(classname);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void addServerClass(String classname)
|
||||
{
|
||||
_serverClasses.addPattern(classname);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void destroy()
|
||||
{
|
||||
if (_baseResource!=null)
|
||||
_baseResource.release();
|
||||
if (_resourceCache!=null)
|
||||
_resourceCache.flushCache();
|
||||
if(_idMap!=null)
|
||||
_idMap.clear();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void setIdMap(Map<String, Object> idMap)
|
||||
{
|
||||
_idMap=idMap;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public Map<String, Object> getIdMap()
|
||||
{
|
||||
return _idMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,100 +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.overlays;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.eclipse.jetty.deploy.DeploymentManager;
|
||||
import org.eclipse.jetty.jndi.NamingUtil;
|
||||
import org.eclipse.jetty.overlays.OverlayedAppProvider;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
|
||||
import org.eclipse.jetty.server.handler.DefaultHandler;
|
||||
import org.eclipse.jetty.server.handler.HandlerCollection;
|
||||
import org.eclipse.jetty.server.handler.RequestLogHandler;
|
||||
import org.eclipse.jetty.server.handler.StatisticsHandler;
|
||||
import org.eclipse.jetty.server.nio.SelectChannelConnector;
|
||||
|
||||
public class OverlayServer
|
||||
{
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
// NamingUtil.__log.setDebugEnabled(true);
|
||||
String jetty_home = System.getProperty("jetty.home","target/test-classes/home");
|
||||
System.setProperty("jetty.home",jetty_home);
|
||||
|
||||
Server server = new Server();
|
||||
server.setAttribute("org.eclipse.jetty.webapp.configuration",
|
||||
new String[]
|
||||
{
|
||||
org.eclipse.jetty.webapp.WebInfConfiguration.class.getCanonicalName(),
|
||||
org.eclipse.jetty.webapp.WebXmlConfiguration.class.getCanonicalName(),
|
||||
org.eclipse.jetty.webapp.MetaInfConfiguration.class.getCanonicalName(),
|
||||
org.eclipse.jetty.webapp.FragmentConfiguration.class.getCanonicalName(),
|
||||
org.eclipse.jetty.plus.webapp.EnvConfiguration.class.getCanonicalName(),
|
||||
org.eclipse.jetty.plus.webapp.PlusConfiguration.class.getCanonicalName(),
|
||||
org.eclipse.jetty.webapp.JettyWebXmlConfiguration.class.getCanonicalName(),
|
||||
org.eclipse.jetty.webapp.TagLibConfiguration.class.getCanonicalName()
|
||||
}
|
||||
);
|
||||
|
||||
// Setup Connectors
|
||||
SelectChannelConnector connector = new SelectChannelConnector();
|
||||
connector.setPort(8080);
|
||||
server.addConnector(connector);
|
||||
|
||||
HandlerCollection handlers = new HandlerCollection();
|
||||
ContextHandlerCollection contexts = new ContextHandlerCollection();
|
||||
RequestLogHandler requestLogHandler = new RequestLogHandler();
|
||||
handlers.setHandlers(new Handler[]
|
||||
{ contexts, new DefaultHandler(), requestLogHandler });
|
||||
|
||||
StatisticsHandler stats = new StatisticsHandler();
|
||||
stats.setHandler(handlers);
|
||||
|
||||
server.setHandler(stats);
|
||||
|
||||
// Setup deployers
|
||||
DeploymentManager deployer = new DeploymentManager();
|
||||
deployer.setContexts(contexts);
|
||||
server.addBean(deployer);
|
||||
|
||||
OverlayedAppProvider provider = new OverlayedAppProvider();
|
||||
|
||||
provider.setNodeName("nodeA");
|
||||
provider.setScanDir(new File(jetty_home + "/overlays"));
|
||||
provider.setScanInterval(2);
|
||||
|
||||
deployer.addAppProvider(provider);
|
||||
|
||||
server.setStopAtShutdown(true);
|
||||
server.setSendServerVersion(true);
|
||||
|
||||
// Uncomment to work with JNDI examples
|
||||
// new org.eclipse.jetty.plus.jndi.Transaction(new com.atomikos.icatch.jta.UserTransactionImp());
|
||||
|
||||
|
||||
|
||||
|
||||
server.start();
|
||||
server.join();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,589 +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.overlays;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.jetty.util.IO;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
||||
public class OverlayedAppProviderTest
|
||||
{
|
||||
File _tmp;
|
||||
File _scan;
|
||||
File _webapps;
|
||||
File _templates;
|
||||
File _nodes;
|
||||
File _instances;
|
||||
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
_tmp=File.createTempFile("OAPTest",null);
|
||||
if (_tmp.exists())
|
||||
IO.delete(_tmp);
|
||||
_tmp.mkdir();
|
||||
|
||||
_scan = new File(_tmp,"scan").getCanonicalFile();
|
||||
_webapps = new File(_scan,OverlayedAppProvider.WEBAPPS);
|
||||
_templates = new File(_scan,OverlayedAppProvider.TEMPLATES);
|
||||
_nodes = new File(_scan,OverlayedAppProvider.NODES);
|
||||
_instances = new File(_scan,OverlayedAppProvider.INSTANCES);
|
||||
_webapps.mkdirs();
|
||||
_templates.mkdir();
|
||||
_nodes.mkdir();
|
||||
_instances.mkdir();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() throws Exception
|
||||
{
|
||||
if (_tmp.exists())
|
||||
IO.delete(_tmp);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScanForWars() throws Exception
|
||||
{
|
||||
final ConcurrentLinkedQueue<Set<String>> scanned = new ConcurrentLinkedQueue<Set<String>>();
|
||||
OverlayedAppProvider provider = new OverlayedAppProvider()
|
||||
{
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @see org.eclipse.jetty.overlays.OverlayedAppProvider#updateLayers(java.util.Set)
|
||||
*/
|
||||
@Override
|
||||
protected void updateLayers(Set<String> filenames)
|
||||
{
|
||||
scanned.offer(filenames);
|
||||
}
|
||||
};
|
||||
provider.setScanInterval(0);
|
||||
|
||||
|
||||
provider.setScanDir(_scan);
|
||||
provider.start();
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
|
||||
assertTrue(scanned.isEmpty());
|
||||
|
||||
|
||||
// Check scanning for archives
|
||||
File war = new File(_webapps,"foo-1.2.3.war");
|
||||
touch(war);
|
||||
File template = new File(_templates,"foo=foo-1.2.3.war");
|
||||
touch(template);
|
||||
File node = new File(_nodes,"nodeA.war");
|
||||
touch(node);
|
||||
File instance = new File(_instances,"foo=instance.war");
|
||||
touch(instance);
|
||||
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
|
||||
Set<String> results = scanned.poll();
|
||||
assertTrue(results!=null);
|
||||
assertEquals(4,results.size());
|
||||
assertTrue(results.contains("webapps/foo-1.2.3.war"));
|
||||
assertTrue(results.contains("templates/foo=foo-1.2.3.war"));
|
||||
assertTrue(results.contains("nodes/nodeA.war"));
|
||||
assertTrue(results.contains("instances/foo=instance.war"));
|
||||
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertTrue(scanned.isEmpty());
|
||||
|
||||
IO.delete(war);
|
||||
IO.delete(template);
|
||||
IO.delete(node);
|
||||
IO.delete(instance);
|
||||
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
results = scanned.poll();
|
||||
assertTrue(results!=null);
|
||||
assertEquals(4,results.size());
|
||||
assertTrue(results.contains("webapps/foo-1.2.3.war"));
|
||||
assertTrue(results.contains("templates/foo=foo-1.2.3.war"));
|
||||
assertTrue(results.contains("nodes/nodeA.war"));
|
||||
assertTrue(results.contains("instances/foo=instance.war"));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScanForDirs() throws Exception
|
||||
{
|
||||
final ConcurrentLinkedQueue<Set<String>> scanned = new ConcurrentLinkedQueue<Set<String>>();
|
||||
OverlayedAppProvider provider = new OverlayedAppProvider()
|
||||
{
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @see org.eclipse.jetty.overlays.OverlayedAppProvider#updateLayers(java.util.Set)
|
||||
*/
|
||||
@Override
|
||||
protected void updateLayers(Set<String> filenames)
|
||||
{
|
||||
scanned.offer(filenames);
|
||||
}
|
||||
};
|
||||
provider.setScanInterval(0);
|
||||
|
||||
|
||||
provider.setScanDir(_scan);
|
||||
provider.start();
|
||||
provider.scan();
|
||||
|
||||
assertTrue(scanned.isEmpty());
|
||||
|
||||
|
||||
// Check scanning for directories
|
||||
File war = new File(_webapps,"foo-1.2.3");
|
||||
war.mkdir();
|
||||
File template = new File(_templates,"foo=foo-1.2.3");
|
||||
template.mkdir();
|
||||
File node = new File(_nodes,"nodeA");
|
||||
node.mkdir();
|
||||
File instance = new File(_instances,"foo=instance");
|
||||
instance.mkdir();
|
||||
for (File f : new File[] { war,template,node,instance } )
|
||||
{
|
||||
File webinf = new File(f,"WEB-INF");
|
||||
webinf.mkdir();
|
||||
touch(webinf,"web.xml");
|
||||
}
|
||||
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
|
||||
Set<String> results = scanned.poll();
|
||||
assertTrue(results!=null);
|
||||
assertEquals(4,results.size());
|
||||
assertTrue(results.contains("webapps/foo-1.2.3"));
|
||||
assertTrue(results.contains("templates/foo=foo-1.2.3"));
|
||||
assertTrue(results.contains("nodes/nodeA"));
|
||||
assertTrue(results.contains("instances/foo=instance"));
|
||||
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertTrue(scanned.isEmpty());
|
||||
|
||||
|
||||
// Touch everything
|
||||
touch(war,"WEB-INF/web.xml");
|
||||
touch(war,"WEB-INF/spring.XML");
|
||||
touch(war,"WEB-INF/other");
|
||||
touch(war,"WEB-INF/lib/bar.jar");
|
||||
touch(war,"WEB-INF/classes/bar.class");
|
||||
|
||||
for (File d : new File[]{template,node,instance})
|
||||
{
|
||||
touch(d,"WEB-INF/web-fragment.xml");
|
||||
touch(d,"WEB-INF/overlay.xml");
|
||||
touch(d,"WEB-INF/other");
|
||||
touch(d,"WEB-INF/lib/bar.jar");
|
||||
}
|
||||
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
results = scanned.poll();
|
||||
assertTrue(results!=null);
|
||||
assertEquals(4,results.size());
|
||||
assertTrue(results.contains("webapps/foo-1.2.3"));
|
||||
assertTrue(results.contains("templates/foo=foo-1.2.3"));
|
||||
assertTrue(results.contains("nodes/nodeA"));
|
||||
assertTrue(results.contains("instances/foo=instance"));
|
||||
|
||||
|
||||
// Touch xml
|
||||
Thread.sleep(1000); // needed so last modified is different
|
||||
for (File d : new File[]{war,template,node,instance})
|
||||
touch(d,"WEB-INF/web.xml");
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
results = scanned.poll();
|
||||
assertTrue(results!=null);
|
||||
assertEquals(4,results.size());
|
||||
assertTrue(results.contains("webapps/foo-1.2.3"));
|
||||
assertTrue(results.contains("templates/foo=foo-1.2.3"));
|
||||
assertTrue(results.contains("nodes/nodeA"));
|
||||
assertTrue(results.contains("instances/foo=instance"));
|
||||
|
||||
// Touch XML
|
||||
Thread.sleep(1000);
|
||||
for (File d : new File[]{war,template,node,instance})
|
||||
touch(d,"WEB-INF/spring.XML");
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
results = scanned.poll();
|
||||
assertTrue(results!=null);
|
||||
assertEquals(4,results.size());
|
||||
assertTrue(results.contains("webapps/foo-1.2.3"));
|
||||
assertTrue(results.contains("templates/foo=foo-1.2.3"));
|
||||
assertTrue(results.contains("nodes/nodeA"));
|
||||
assertTrue(results.contains("instances/foo=instance"));
|
||||
|
||||
|
||||
// Touch unrelated
|
||||
for (File d : new File[]{war,template,node,instance})
|
||||
touch(d,"index.html");
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
results = scanned.poll();
|
||||
assertEquals(null,results);
|
||||
|
||||
// Touch jar
|
||||
Thread.sleep(1000);
|
||||
for (File d : new File[]{war,template,node,instance})
|
||||
touch(d,"WEB-INF/lib/bar.jar");
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
results = scanned.poll();
|
||||
assertTrue(results!=null);
|
||||
assertEquals(4,results.size());
|
||||
assertTrue(results.contains("webapps/foo-1.2.3"));
|
||||
assertTrue(results.contains("templates/foo=foo-1.2.3"));
|
||||
assertTrue(results.contains("nodes/nodeA"));
|
||||
assertTrue(results.contains("instances/foo=instance"));
|
||||
|
||||
// touch other class
|
||||
Thread.sleep(1000);
|
||||
for (File d : new File[]{war,template,node,instance})
|
||||
touch(d,"index.html");
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
results = scanned.poll();
|
||||
assertTrue(scanned.isEmpty());
|
||||
|
||||
|
||||
// delete all
|
||||
IO.delete(war);
|
||||
IO.delete(template);
|
||||
IO.delete(node);
|
||||
IO.delete(instance);
|
||||
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
results = scanned.poll();
|
||||
assertTrue(results!=null);
|
||||
assertEquals(4,results.size());
|
||||
assertTrue(results.contains("webapps/foo-1.2.3"));
|
||||
assertTrue(results.contains("templates/foo=foo-1.2.3"));
|
||||
assertTrue(results.contains("nodes/nodeA"));
|
||||
assertTrue(results.contains("instances/foo=instance"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testTriageURI() throws Exception
|
||||
{
|
||||
final BlockingQueue<String> scanned = new LinkedBlockingQueue<String>();
|
||||
OverlayedAppProvider provider = new OverlayedAppProvider()
|
||||
{
|
||||
protected void removeInstance(String name)
|
||||
{
|
||||
scanned.add("removeInstance "+name);
|
||||
}
|
||||
protected Instance loadInstance(String name, File origin)
|
||||
{
|
||||
scanned.add("loadInstance "+name);
|
||||
scanned.add(origin.getAbsolutePath());
|
||||
return null;
|
||||
}
|
||||
protected void removeNode()
|
||||
{
|
||||
scanned.add("removeNode");
|
||||
}
|
||||
protected Node loadNode(File origin)
|
||||
{
|
||||
scanned.add("loadNode");
|
||||
scanned.add(origin.getAbsolutePath());
|
||||
return null;
|
||||
}
|
||||
protected void removeTemplate(String name)
|
||||
{
|
||||
scanned.add("removeTemplate "+name);
|
||||
}
|
||||
protected Template loadTemplate(String name, File origin)
|
||||
{
|
||||
scanned.add("loadTemplate "+name);
|
||||
scanned.add(origin.getAbsolutePath());
|
||||
return null;
|
||||
}
|
||||
protected void removeWebapp(String name)
|
||||
{
|
||||
scanned.add("removeWebapp "+name);
|
||||
}
|
||||
protected Webapp loadWebapp(String name, File origin)
|
||||
{
|
||||
scanned.add("loadWebapp "+name);
|
||||
scanned.add(origin.getAbsolutePath());
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void redeploy()
|
||||
{
|
||||
}
|
||||
|
||||
};
|
||||
provider.setScanInterval(0);
|
||||
provider.setNodeName("nodeA");
|
||||
|
||||
|
||||
provider.setScanDir(_scan);
|
||||
provider.start();
|
||||
provider.scan();
|
||||
|
||||
assertTrue(scanned.isEmpty());
|
||||
|
||||
// Add a war
|
||||
File war = new File(_webapps,"foo-1.2.3.war");
|
||||
touch(war);
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertEquals("loadWebapp foo-1.2.3",scanned.poll(1,TimeUnit.SECONDS));
|
||||
assertEquals(war.getAbsolutePath(),scanned.poll(1,TimeUnit.SECONDS));
|
||||
|
||||
|
||||
// Add a template
|
||||
File template = new File(_templates,"foo=foo-1.2.3.war");
|
||||
touch(template);
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertEquals("loadTemplate foo=foo-1.2.3",scanned.poll(1,TimeUnit.SECONDS));
|
||||
assertEquals(template.getAbsolutePath(),scanned.poll(1,TimeUnit.SECONDS));
|
||||
|
||||
// Add a node
|
||||
File nodeA = new File(_nodes,"nodeA.war");
|
||||
touch(nodeA);
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertEquals("loadNode",scanned.poll(1,TimeUnit.SECONDS));
|
||||
assertEquals(nodeA.getAbsolutePath(),scanned.poll(1,TimeUnit.SECONDS));
|
||||
|
||||
// Add another node
|
||||
File nodeB = new File(_nodes,"nodeB.war");
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertTrue(scanned.isEmpty());
|
||||
|
||||
// Add an instance
|
||||
File instance = new File(_instances,"foo=instance.war");
|
||||
touch(instance);
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertEquals("loadInstance foo=instance",scanned.poll(1,TimeUnit.SECONDS));
|
||||
assertEquals(instance.getAbsolutePath(),scanned.poll(1,TimeUnit.SECONDS));
|
||||
|
||||
|
||||
// Add a war dir
|
||||
File warDir = new File(_webapps,"foo-1.2.3");
|
||||
warDir.mkdir();
|
||||
File warDirWI = new File(warDir,"WEB-INF");
|
||||
warDirWI.mkdir();
|
||||
touch(warDirWI,"web.xml");
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertEquals("loadWebapp foo-1.2.3",scanned.poll(1,TimeUnit.SECONDS));
|
||||
assertEquals(warDir.getAbsolutePath(),scanned.poll(1,TimeUnit.SECONDS));
|
||||
|
||||
// Add a template dir
|
||||
File templateDir = new File(_templates,"foo=foo-1.2.3");
|
||||
templateDir.mkdir();
|
||||
File templateDirWI = new File(templateDir,"WEB-INF");
|
||||
templateDirWI.mkdir();
|
||||
touch(templateDirWI,"web.xml");
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertEquals("loadTemplate foo=foo-1.2.3",scanned.poll(1,TimeUnit.SECONDS));
|
||||
assertEquals(templateDir.getAbsolutePath(),scanned.poll(1,TimeUnit.SECONDS));
|
||||
|
||||
// Add a node dir
|
||||
File nodeADir = new File(_nodes,"nodeA");
|
||||
nodeADir.mkdir();
|
||||
File nodeADirWI = new File(nodeADir,"WEB-INF");
|
||||
nodeADirWI.mkdir();
|
||||
touch(nodeADirWI,"web.xml");
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertEquals("loadNode",scanned.poll(1,TimeUnit.SECONDS));
|
||||
assertEquals(nodeADir.getAbsolutePath(),scanned.poll(1,TimeUnit.SECONDS));
|
||||
|
||||
// Add another node dir
|
||||
File nodeBDir = new File(_nodes,"nodeB");
|
||||
nodeBDir.mkdir();
|
||||
File nodeBDirWI = new File(nodeBDir,"WEB-INF");
|
||||
nodeBDirWI.mkdir();
|
||||
touch(nodeBDirWI,"web.xml");
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertTrue(scanned.isEmpty());
|
||||
|
||||
// Add an instance dir
|
||||
File instanceDir = new File(_instances,"foo=instance");
|
||||
instanceDir.mkdir();
|
||||
File instanceDirWI = new File(instanceDir,"WEB-INF");
|
||||
instanceDirWI.mkdir();
|
||||
touch(instanceDirWI,"web.xml");
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertEquals("loadInstance foo=instance",scanned.poll(1,TimeUnit.SECONDS));
|
||||
assertEquals(instanceDir.getAbsolutePath(),scanned.poll(1,TimeUnit.SECONDS));
|
||||
|
||||
|
||||
// touch archives will be ignored.
|
||||
Thread.sleep(1000);
|
||||
touch(war);
|
||||
touch(template);
|
||||
touch(nodeA);
|
||||
touch(nodeB);
|
||||
touch(instance);
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertTrue(scanned.isEmpty());
|
||||
|
||||
// Touch directories
|
||||
for (File d : new File[]{warDir,templateDir,nodeADir,nodeBDir,instanceDir})
|
||||
touch(d,"WEB-INF/web.xml");
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertEquals(8,scanned.size());
|
||||
scanned.clear();
|
||||
|
||||
// Remove web dir
|
||||
IO.delete(warDir);
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertEquals("removeWebapp foo-1.2.3",scanned.poll(1,TimeUnit.SECONDS));
|
||||
assertEquals("loadWebapp foo-1.2.3",scanned.poll(1,TimeUnit.SECONDS));
|
||||
assertEquals(war.getAbsolutePath(),scanned.poll(1,TimeUnit.SECONDS));
|
||||
|
||||
// Remove template dir
|
||||
IO.delete(templateDir);
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertEquals("removeTemplate foo=foo-1.2.3",scanned.poll(1,TimeUnit.SECONDS));
|
||||
assertEquals("loadTemplate foo=foo-1.2.3",scanned.poll(1,TimeUnit.SECONDS));
|
||||
assertEquals(template.getAbsolutePath(),scanned.poll(1,TimeUnit.SECONDS));
|
||||
|
||||
// Remove nodeA dir
|
||||
IO.delete(nodeADir);
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertEquals("removeNode",scanned.poll(1,TimeUnit.SECONDS));
|
||||
assertEquals("loadNode",scanned.poll(1,TimeUnit.SECONDS));
|
||||
assertEquals(nodeA.getAbsolutePath(),scanned.poll(1,TimeUnit.SECONDS));
|
||||
|
||||
// Remove nodeB dir
|
||||
IO.delete(nodeBDir);
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertTrue(scanned.isEmpty());
|
||||
|
||||
|
||||
// Remove instance dir
|
||||
IO.delete(instanceDir);
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertEquals("removeInstance foo=instance",scanned.poll(1,TimeUnit.SECONDS));
|
||||
assertEquals("loadInstance foo=instance",scanned.poll(1,TimeUnit.SECONDS));
|
||||
assertEquals(instance.getAbsolutePath(),scanned.poll(1,TimeUnit.SECONDS));
|
||||
|
||||
// Remove web
|
||||
IO.delete(war);
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertEquals("removeWebapp foo-1.2.3",scanned.poll(1,TimeUnit.SECONDS));
|
||||
|
||||
// Remove template
|
||||
IO.delete(template);
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertEquals("removeTemplate foo=foo-1.2.3",scanned.poll(1,TimeUnit.SECONDS));
|
||||
|
||||
// Remove nodeA dir
|
||||
IO.delete(nodeA);
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertEquals("removeNode",scanned.poll(1,TimeUnit.SECONDS));
|
||||
|
||||
// Remove nodeB dir
|
||||
IO.delete(nodeB);
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertTrue(scanned.isEmpty());
|
||||
|
||||
// Remove instance dir
|
||||
IO.delete(instance);
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertEquals("removeInstance foo=instance",scanned.poll(1,TimeUnit.SECONDS));
|
||||
|
||||
provider.scan();
|
||||
provider.scan();
|
||||
assertTrue(scanned.isEmpty());
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void touch(File base,String path)
|
||||
{
|
||||
try
|
||||
{
|
||||
File target = new File(new URI(base.toURI().toString()+path));
|
||||
target.getParentFile().mkdirs();
|
||||
touch(target);
|
||||
}
|
||||
catch (URISyntaxException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void touch(File file)
|
||||
{
|
||||
try
|
||||
{
|
||||
IO.delete(file);
|
||||
FileOutputStream out = new FileOutputStream(file,false);
|
||||
out.write("<h1>Hello</h1>".getBytes());
|
||||
out.close();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
instance myfoo=blue WEB-INF classes
|
|
@ -1 +0,0 @@
|
|||
instance myfoo=blue WEB-INF classes
|
Binary file not shown.
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
|
||||
|
||||
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
|
||||
|
||||
<Set name="contextPath">/blue</Set>
|
||||
|
||||
<!--
|
||||
<Set name="virtualHosts">
|
||||
<Array type="String">
|
||||
<Item>blue.myVirtualDomain.com</Item>
|
||||
</Array>
|
||||
</Set>
|
||||
-->
|
||||
|
||||
</Configure>
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<web-app
|
||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
version="2.5">
|
||||
|
||||
<display-name>Blue Test WebApp</display-name>
|
||||
|
||||
<context-param>
|
||||
<param-name>overlay</param-name>
|
||||
<param-value>instances/myfoo=blue/web.xml</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>instance</param-name>
|
||||
<param-value>instances/myfoo=blue/web.xml</param-value>
|
||||
</context-param>
|
||||
|
||||
</web-app>
|
||||
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Created-By: 1.6.0_20 (Sun Microsystems Inc.)
|
||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB |
|
@ -1 +0,0 @@
|
|||
instance myfoo=blue WEB-INF classes
|
|
@ -1 +0,0 @@
|
|||
instance myfoo=blue WEB-INF classes
|
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB |
|
@ -1 +0,0 @@
|
|||
instance myfoo=green WEB-INF classes
|
|
@ -1 +0,0 @@
|
|||
instance myfoo=green WEB-INF classes
|
Binary file not shown.
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
|
||||
|
||||
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
|
||||
|
||||
<Set name="contextPath">/green</Set>
|
||||
|
||||
<!--
|
||||
<Set name="virtualHosts">
|
||||
<Array type="String">
|
||||
<Item>green.myVirtualDomain.com</Item>
|
||||
</Array>
|
||||
</Set>
|
||||
-->
|
||||
|
||||
</Configure>
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<web-app
|
||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
version="2.5">
|
||||
|
||||
<display-name>Green Test WebApp</display-name>
|
||||
|
||||
<context-param>
|
||||
<param-name>overlay</param-name>
|
||||
<param-value>instances/myfoo=green/web.xml</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>instance</param-name>
|
||||
<param-value>instances/myfoo=green/web.xml</param-value>
|
||||
</context-param>
|
||||
|
||||
</web-app>
|
||||
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Created-By: 1.6.0_20 (Sun Microsystems Inc.)
|
||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
|
@ -1 +0,0 @@
|
|||
instance myfoo=green WEB-INF classes
|
|
@ -1 +0,0 @@
|
|||
instance myfoo=green WEB-INF classes
|
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
|
@ -1 +0,0 @@
|
|||
instance myfoo=red WEB-INF classes
|
|
@ -1 +0,0 @@
|
|||
instance myfoo=red WEB-INF classes
|
Binary file not shown.
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
|
||||
|
||||
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
|
||||
|
||||
<Set name="contextPath">/red</Set>
|
||||
|
||||
<!--
|
||||
<Set name="virtualHosts">
|
||||
<Array type="String">
|
||||
<Item>red.myVirtualDomain.com</Item>
|
||||
</Array>
|
||||
</Set>
|
||||
-->
|
||||
|
||||
</Configure>
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<web-app
|
||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
version="2.5">
|
||||
|
||||
<display-name>Red Test WebApp</display-name>
|
||||
|
||||
<context-param>
|
||||
<param-name>overlay</param-name>
|
||||
<param-value>instances/myfoo=red/web.xml</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>instance</param-name>
|
||||
<param-value>instances/myfoo=red/web.xml</param-value>
|
||||
</context-param>
|
||||
|
||||
</web-app>
|
||||
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Created-By: 1.6.0_20 (Sun Microsystems Inc.)
|
||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 4.4 KiB |
|
@ -1 +0,0 @@
|
|||
instance myfoo=red WEB-INF classes
|
|
@ -1 +0,0 @@
|
|||
instance myfoo=red WEB-INF classes
|
Binary file not shown.
Before Width: | Height: | Size: 4.4 KiB |
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
|
||||
|
||||
<Configure class="org.eclipse.jetty.server.handler.ContextHandler">
|
||||
<!--
|
||||
<Set name="virtualHosts">
|
||||
<Array type="String">
|
||||
<Item>red.myVirtualDomain.com</Item>
|
||||
</Array>
|
||||
</Set>
|
||||
-->
|
||||
</Configure>
|
|
@ -1 +0,0 @@
|
|||
node WEB-INF lib
|
|
@ -1 +0,0 @@
|
|||
node WEB-INF lib
|
|
@ -1 +0,0 @@
|
|||
node WEB-INF lib
|
|
@ -1 +0,0 @@
|
|||
node WEB-INF lib
|
Binary file not shown.
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<web-app
|
||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
version="2.5">
|
||||
|
||||
<context-param>
|
||||
<param-name>overlay</param-name>
|
||||
<param-value>nodes/nodeA/web.xml</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>node</param-name>
|
||||
<param-value>nodes/nodeA/web.xml</param-value>
|
||||
</context-param>
|
||||
|
||||
</web-app>
|
||||
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Created-By: 1.6.0_20 (Sun Microsystems Inc.)
|
||||
|
Binary file not shown.
|
@ -1,3 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Created-By: 1.6.0_20 (Sun Microsystems Inc.)
|
||||
|
|
@ -1 +0,0 @@
|
|||
node WEB-INF lib
|
|
@ -1 +0,0 @@
|
|||
node WEB-INF lib
|
|
@ -1 +0,0 @@
|
|||
node WEB-INF lib
|
|
@ -1 +0,0 @@
|
|||
node WEB-INF lib
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<web-app
|
||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
version="2.5">
|
||||
|
||||
<context-param>
|
||||
<param-name>overlay</param-name>
|
||||
<param-value>nodes/nodeB/web.xml</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>node</param-name>
|
||||
<param-value>nodes/nodeB/web.xml</param-value>
|
||||
</context-param>
|
||||
|
||||
</web-app>
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
template WEB-INF classes
|
|
@ -1 +0,0 @@
|
|||
template WEB-INF classes
|
|
@ -1 +0,0 @@
|
|||
template WEB-INF classes
|
|
@ -1 +0,0 @@
|
|||
template WEB-INF classes
|
|
@ -1 +0,0 @@
|
|||
template WEB-INF classes
|
|
@ -1 +0,0 @@
|
|||
template WEB-INF classes
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
|
||||
|
||||
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
|
||||
<Get class="org.eclipse.jetty.util.log.Log" name="rootLogger">
|
||||
<Call name="info"><Arg>Executing jetty-web.xml for <Property name="overlay.instance"/></Arg></Call>
|
||||
</Get>
|
||||
</Configure>
|
Binary file not shown.
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
|
||||
|
||||
<Configure class="org.eclipse.jetty.overlays.TemplateContext">
|
||||
<Set name="parentLoaderPriority" type="boolean">false</Set>
|
||||
<Get name="resourceCache">
|
||||
<Set name="useFileMappedBuffer">true</Set>
|
||||
<Set name="maxCachedFileSize">10000000</Set>
|
||||
<Set name="maxCachedFiles">1000</Set>
|
||||
<Set name="maxCacheSize">64000000</Set>
|
||||
</Get>
|
||||
<Get name="mimeTypes">
|
||||
<Call name="addMimeMapping">
|
||||
<Arg>bogus</Arg>
|
||||
<Arg>application/bogon</Arg>
|
||||
</Call>
|
||||
</Get>
|
||||
</Configure>
|
|
@ -1,482 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- This file contains the default descriptor for web applications. -->
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
<!-- The intent of this descriptor is to include jetty specific or common -->
|
||||
<!-- configuration for all webapps. If a context has a webdefault.xml -->
|
||||
<!-- descriptor, it is applied before the contexts own web.xml file -->
|
||||
<!-- -->
|
||||
<!-- A context may be assigned a default descriptor by: -->
|
||||
<!-- + Calling WebApplicationContext.setDefaultsDescriptor -->
|
||||
<!-- + Passed an arg to addWebApplications -->
|
||||
<!-- -->
|
||||
<!-- This file is used both as the resource within the jetty.jar (which is -->
|
||||
<!-- used as the default if no explicit defaults descriptor is set) and it -->
|
||||
<!-- is copied to the etc directory of the Jetty distro and explicitly -->
|
||||
<!-- by the jetty.xml file. -->
|
||||
<!-- -->
|
||||
<!-- ===================================================================== -->
|
||||
<web-app
|
||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
metadata-complete="true"
|
||||
version="2.5"
|
||||
>
|
||||
|
||||
<description>
|
||||
Default web.xml file.
|
||||
This file is applied to a Web application before it's own WEB_INF/web.xml file
|
||||
</description>
|
||||
|
||||
|
||||
<!-- ==================================================================== -->
|
||||
<!-- Context params to control Session Cookies -->
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
<!--
|
||||
UNCOMMENT TO ACTIVATE <context-param> <param-name>org.eclipse.jetty.servlet.SessionDomain</param-name> <param-value>127.0.0.1</param-value> </context-param> <context-param>
|
||||
<param-name>org.eclipse.jetty.servlet.SessionPath</param-name> <param-value>/</param-value> </context-param> <context-param> <param-name>org.eclipse.jetty.servlet.MaxAge</param-name>
|
||||
<param-value>-1</param-value> </context-param>
|
||||
-->
|
||||
|
||||
<!-- ==================================================================== -->
|
||||
<!-- The default servlet. -->
|
||||
<!-- This servlet, normally mapped to /, provides the handling for static -->
|
||||
<!-- content, OPTIONS and TRACE methods for the context. -->
|
||||
<!-- The following initParameters are supported: -->
|
||||
<!--
|
||||
* acceptRanges If true, range requests and responses are
|
||||
* supported
|
||||
*
|
||||
* dirAllowed If true, directory listings are returned if no
|
||||
* welcome file is found. Else 403 Forbidden.
|
||||
*
|
||||
* welcomeServlets If true, attempt to dispatch to welcome files
|
||||
* that are servlets, but only after no matching static
|
||||
* resources could be found. If false, then a welcome
|
||||
* file must exist on disk. If "exact", then exact
|
||||
* servlet matches are supported without an existing file.
|
||||
* Default is true.
|
||||
*
|
||||
* This must be false if you want directory listings,
|
||||
* but have index.jsp in your welcome file list.
|
||||
*
|
||||
* redirectWelcome If true, welcome files are redirected rather than
|
||||
* forwarded to.
|
||||
*
|
||||
* gzip If set to true, then static content will be served as
|
||||
* gzip content encoded if a matching resource is
|
||||
* found ending with ".gz"
|
||||
*
|
||||
* resourceBase Set to replace the context resource base
|
||||
*
|
||||
* resourceCache If set, this is a context attribute name, which the servlet
|
||||
* will use to look for a shared ResourceCache instance.
|
||||
*
|
||||
* relativeResourceBase
|
||||
* Set with a pathname relative to the base of the
|
||||
* servlet context root. Useful for only serving static content out
|
||||
* of only specific subdirectories.
|
||||
*
|
||||
* aliases If True, aliases of resources are allowed (eg. symbolic
|
||||
* links and caps variations). May bypass security constraints.
|
||||
*
|
||||
* maxCacheSize The maximum total size of the cache or 0 for no cache.
|
||||
* maxCachedFileSize The maximum size of a file to cache
|
||||
* maxCachedFiles The maximum number of files to cache
|
||||
*
|
||||
* useFileMappedBuffer
|
||||
* If set to true, it will use mapped file buffer to serve static content
|
||||
* when using NIO connector. Setting this value to false means that
|
||||
* a direct buffer will be used instead of a mapped file buffer.
|
||||
* By default, this is set to true.
|
||||
*
|
||||
* cacheControl If set, all static content will have this value set as the cache-control
|
||||
* header.
|
||||
-->
|
||||
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
<servlet>
|
||||
<servlet-name>default</servlet-name>
|
||||
<servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
|
||||
<init-param>
|
||||
<param-name>aliases</param-name>
|
||||
<param-value>false</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>acceptRanges</param-name>
|
||||
<param-value>true</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>dirAllowed</param-name>
|
||||
<param-value>true</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>welcomeServlets</param-name>
|
||||
<param-value>false</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>redirectWelcome</param-name>
|
||||
<param-value>false</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>maxCacheSize</param-name>
|
||||
<param-value>256000000</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>maxCachedFileSize</param-name>
|
||||
<param-value>10000000</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>maxCachedFiles</param-name>
|
||||
<param-value>2048</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>gzip</param-name>
|
||||
<param-value>true</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>useFileMappedBuffer</param-name>
|
||||
<param-value>true</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>resourceCache</param-name>
|
||||
<param-value>org.eclipse.jetty.server.ResourceCache</param-value>
|
||||
</init-param>
|
||||
<!--
|
||||
<init-param>
|
||||
<param-name>cacheControl</param-name>
|
||||
<param-value>max-age=3600,public</param-value>
|
||||
</init-param>
|
||||
-->
|
||||
<load-on-startup>0</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>default</servlet-name>
|
||||
<url-pattern>/</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
<!-- ==================================================================== -->
|
||||
<!-- JSP Servlet -->
|
||||
<!-- This is the jasper JSP servlet from the jakarta project -->
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
<!-- The JSP page compiler and execution servlet, which is the mechanism -->
|
||||
<!-- used by Glassfish to support JSP pages. Traditionally, this servlet -->
|
||||
<!-- is mapped to URL patterh "*.jsp". This servlet supports the -->
|
||||
<!-- following initialization parameters (default values are in square -->
|
||||
<!-- brackets): -->
|
||||
<!-- -->
|
||||
<!-- checkInterval If development is false and reloading is true, -->
|
||||
<!-- background compiles are enabled. checkInterval -->
|
||||
<!-- is the time in seconds between checks to see -->
|
||||
<!-- if a JSP page needs to be recompiled. [300] -->
|
||||
<!-- -->
|
||||
<!-- compiler Which compiler Ant should use to compile JSP -->
|
||||
<!-- pages. See the Ant documenation for more -->
|
||||
<!-- information. [javac] -->
|
||||
<!-- -->
|
||||
<!-- classdebuginfo Should the class file be compiled with -->
|
||||
<!-- debugging information? [true] -->
|
||||
<!-- -->
|
||||
<!-- classpath What class path should I use while compiling -->
|
||||
<!-- generated servlets? [Created dynamically -->
|
||||
<!-- based on the current web application] -->
|
||||
<!-- Set to ? to make the container explicitly set -->
|
||||
<!-- this parameter. -->
|
||||
<!-- -->
|
||||
<!-- development Is Jasper used in development mode (will check -->
|
||||
<!-- for JSP modification on every access)? [true] -->
|
||||
<!-- -->
|
||||
<!-- enablePooling Determines whether tag handler pooling is -->
|
||||
<!-- enabled [true] -->
|
||||
<!-- -->
|
||||
<!-- fork Tell Ant to fork compiles of JSP pages so that -->
|
||||
<!-- a separate JVM is used for JSP page compiles -->
|
||||
<!-- from the one Tomcat is running in. [true] -->
|
||||
<!-- -->
|
||||
<!-- ieClassId The class-id value to be sent to Internet -->
|
||||
<!-- Explorer when using <jsp:plugin> tags. -->
|
||||
<!-- [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93] -->
|
||||
<!-- -->
|
||||
<!-- javaEncoding Java file encoding to use for generating java -->
|
||||
<!-- source files. [UTF-8] -->
|
||||
<!-- -->
|
||||
<!-- keepgenerated Should we keep the generated Java source code -->
|
||||
<!-- for each page instead of deleting it? [true] -->
|
||||
<!-- -->
|
||||
<!-- logVerbosityLevel The level of detailed messages to be produced -->
|
||||
<!-- by this servlet. Increasing levels cause the -->
|
||||
<!-- generation of more messages. Valid values are -->
|
||||
<!-- FATAL, ERROR, WARNING, INFORMATION, and DEBUG. -->
|
||||
<!-- [WARNING] -->
|
||||
<!-- -->
|
||||
<!-- mappedfile Should we generate static content with one -->
|
||||
<!-- print statement per input line, to ease -->
|
||||
<!-- debugging? [false] -->
|
||||
<!-- -->
|
||||
<!-- -->
|
||||
<!-- reloading Should Jasper check for modified JSPs? [true] -->
|
||||
<!-- -->
|
||||
<!-- suppressSmap Should the generation of SMAP info for JSR45 -->
|
||||
<!-- debugging be suppressed? [false] -->
|
||||
<!-- -->
|
||||
<!-- dumpSmap Should the SMAP info for JSR45 debugging be -->
|
||||
<!-- dumped to a file? [false] -->
|
||||
<!-- False if suppressSmap is true -->
|
||||
<!-- -->
|
||||
<!-- scratchdir What scratch directory should we use when -->
|
||||
<!-- compiling JSP pages? [default work directory -->
|
||||
<!-- for the current web application] -->
|
||||
<!-- -->
|
||||
<!-- tagpoolMaxSize The maximum tag handler pool size [5] -->
|
||||
<!-- -->
|
||||
<!-- xpoweredBy Determines whether X-Powered-By response -->
|
||||
<!-- header is added by generated servlet [false] -->
|
||||
<!-- -->
|
||||
<!-- If you wish to use Jikes to compile JSP pages: -->
|
||||
<!-- Set the init parameter "compiler" to "jikes". Define -->
|
||||
<!-- the property "-Dbuild.compiler.emacs=true" when starting Jetty -->
|
||||
<!-- to cause Jikes to emit error messages in a format compatible with -->
|
||||
<!-- Jasper. -->
|
||||
<!-- If you get an error reporting that jikes can't use UTF-8 encoding, -->
|
||||
<!-- try setting the init parameter "javaEncoding" to "ISO-8859-1". -->
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
<servlet
|
||||
id="jsp"
|
||||
>
|
||||
<servlet-name>jsp</servlet-name>
|
||||
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
|
||||
<init-param>
|
||||
<param-name>logVerbosityLevel</param-name>
|
||||
<param-value>DEBUG</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>fork</param-name>
|
||||
<param-value>false</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>xpoweredBy</param-name>
|
||||
<param-value>false</param-value>
|
||||
</init-param>
|
||||
<!--
|
||||
<init-param>
|
||||
<param-name>classpath</param-name>
|
||||
<param-value>?</param-value>
|
||||
</init-param>
|
||||
-->
|
||||
<load-on-startup>0</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>jsp</servlet-name>
|
||||
<url-pattern>*.jsp</url-pattern>
|
||||
<url-pattern>*.jspf</url-pattern>
|
||||
<url-pattern>*.jspx</url-pattern>
|
||||
<url-pattern>*.xsp</url-pattern>
|
||||
<url-pattern>*.JSP</url-pattern>
|
||||
<url-pattern>*.JSPF</url-pattern>
|
||||
<url-pattern>*.JSPX</url-pattern>
|
||||
<url-pattern>*.XSP</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
<!-- ==================================================================== -->
|
||||
<session-config>
|
||||
<session-timeout>30</session-timeout>
|
||||
</session-config>
|
||||
|
||||
<!-- ==================================================================== -->
|
||||
<!-- Default MIME mappings -->
|
||||
<!-- The default MIME mappings are provided by the mime.properties -->
|
||||
<!-- resource in the org.eclipse.jetty.server.jar file. Additional or modified -->
|
||||
<!-- mappings may be specified here -->
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
<!-- UNCOMMENT TO ACTIVATE
|
||||
<mime-mapping>
|
||||
<extension>mysuffix</extension>
|
||||
<mime-type>mymime/type</mime-type>
|
||||
</mime-mapping>
|
||||
-->
|
||||
|
||||
<!-- ==================================================================== -->
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.jsp</welcome-file>
|
||||
<welcome-file>index.html</welcome-file>
|
||||
<welcome-file>index.htm</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
<!-- ==================================================================== -->
|
||||
<locale-encoding-mapping-list>
|
||||
<locale-encoding-mapping>
|
||||
<locale>ar</locale>
|
||||
<encoding>ISO-8859-6</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>be</locale>
|
||||
<encoding>ISO-8859-5</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>bg</locale>
|
||||
<encoding>ISO-8859-5</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>ca</locale>
|
||||
<encoding>ISO-8859-1</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>cs</locale>
|
||||
<encoding>ISO-8859-2</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>da</locale>
|
||||
<encoding>ISO-8859-1</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>de</locale>
|
||||
<encoding>ISO-8859-1</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>el</locale>
|
||||
<encoding>ISO-8859-7</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>en</locale>
|
||||
<encoding>ISO-8859-1</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>es</locale>
|
||||
<encoding>ISO-8859-1</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>et</locale>
|
||||
<encoding>ISO-8859-1</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>fi</locale>
|
||||
<encoding>ISO-8859-1</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>fr</locale>
|
||||
<encoding>ISO-8859-1</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>hr</locale>
|
||||
<encoding>ISO-8859-2</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>hu</locale>
|
||||
<encoding>ISO-8859-2</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>is</locale>
|
||||
<encoding>ISO-8859-1</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>it</locale>
|
||||
<encoding>ISO-8859-1</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>iw</locale>
|
||||
<encoding>ISO-8859-8</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>ja</locale>
|
||||
<encoding>Shift_JIS</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>ko</locale>
|
||||
<encoding>EUC-KR</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>lt</locale>
|
||||
<encoding>ISO-8859-2</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>lv</locale>
|
||||
<encoding>ISO-8859-2</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>mk</locale>
|
||||
<encoding>ISO-8859-5</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>nl</locale>
|
||||
<encoding>ISO-8859-1</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>no</locale>
|
||||
<encoding>ISO-8859-1</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>pl</locale>
|
||||
<encoding>ISO-8859-2</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>pt</locale>
|
||||
<encoding>ISO-8859-1</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>ro</locale>
|
||||
<encoding>ISO-8859-2</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>ru</locale>
|
||||
<encoding>ISO-8859-5</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>sh</locale>
|
||||
<encoding>ISO-8859-5</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>sk</locale>
|
||||
<encoding>ISO-8859-2</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>sl</locale>
|
||||
<encoding>ISO-8859-2</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>sq</locale>
|
||||
<encoding>ISO-8859-2</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>sr</locale>
|
||||
<encoding>ISO-8859-5</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>sv</locale>
|
||||
<encoding>ISO-8859-1</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>tr</locale>
|
||||
<encoding>ISO-8859-9</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>uk</locale>
|
||||
<encoding>ISO-8859-5</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>zh</locale>
|
||||
<encoding>GB2312</encoding>
|
||||
</locale-encoding-mapping>
|
||||
<locale-encoding-mapping>
|
||||
<locale>zh_TW</locale>
|
||||
<encoding>Big5</encoding>
|
||||
</locale-encoding-mapping>
|
||||
</locale-encoding-mapping-list>
|
||||
|
||||
<security-constraint>
|
||||
<web-resource-collection>
|
||||
<web-resource-name>Disable TRACE</web-resource-name>
|
||||
<url-pattern>/</url-pattern>
|
||||
<http-method>TRACE</http-method>
|
||||
</web-resource-collection>
|
||||
<auth-constraint/>
|
||||
</security-constraint>
|
||||
|
||||
</web-app>
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<web-app
|
||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
version="2.5">
|
||||
|
||||
<display-name>Templated Test WebApp</display-name>
|
||||
|
||||
<context-param>
|
||||
<param-name>overlay</param-name>
|
||||
<param-value>templates/myfoo/web.xml</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>template</param-name>
|
||||
<param-value>templates/myfoo/web.xml</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>overlay.template</param-name>
|
||||
<param-value>${overlay.template}</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>overlay.template.name</param-name>
|
||||
<param-value>${overlay.template.name}</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>overlay.template.classifier</param-name>
|
||||
<param-value>${overlay.template.classifier}</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>overlay.instance.classifier</param-name>
|
||||
<param-value>${overlay.instance.classifier}</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>overlay.instance</param-name>
|
||||
<param-value>${overlay.instance}</param-value>
|
||||
</context-param>
|
||||
</web-app>
|
||||
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
|
||||
<h1>Template foo webapp</h1>
|
||||
<img src=logo.png></img>
|
||||
|
||||
Should see index.jsp instead of this!!!
|
||||
|
||||
<p>
|
||||
<a href="/red">Red</a>,
|
||||
<a href="/blue">Blue</a>,
|
||||
<a href="/green">Green</a>
|
|
@ -1,54 +0,0 @@
|
|||
|
||||
<%@page import="java.io.BufferedReader"%>
|
||||
<%@page import="java.io.InputStreamReader"%>
|
||||
<%@page import="java.util.Enumeration"%>
|
||||
<h1><%=application.getServletContextName()%></h1>
|
||||
<img src=logo.png></img>
|
||||
|
||||
<p>
|
||||
<a href="/red">Red</a>,
|
||||
<a href="/blue">Blue</a>,
|
||||
<a href="/green">Green</a>
|
||||
<p>
|
||||
|
||||
<h3>Overlays</h3>
|
||||
webapp=<%=application.getInitParameter("webapp")%><br/>
|
||||
template=<%=application.getInitParameter("template")%><br/>
|
||||
node=<%=application.getInitParameter("node")%><br/>
|
||||
instance=<%=application.getInitParameter("instance")%><br/>
|
||||
|
||||
<h3>Init Parameters</h3>
|
||||
<%
|
||||
Enumeration e=application.getInitParameterNames();
|
||||
while (e.hasMoreElements())
|
||||
{
|
||||
String name=e.nextElement().toString();
|
||||
String value=application.getInitParameter(name);
|
||||
out.println(name+": "+value+"<br/>");
|
||||
}
|
||||
%>
|
||||
<h3>Attributes</h3>
|
||||
<%
|
||||
e=application.getAttributeNames();
|
||||
while (e.hasMoreElements())
|
||||
{
|
||||
String name=e.nextElement().toString();
|
||||
String value=String.valueOf(application.getAttribute(name));
|
||||
out.println(name+": "+value+"<br/>");
|
||||
}
|
||||
%>
|
||||
<h3>Resources</h3>
|
||||
<%
|
||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
%>
|
||||
resourceA.txt=<%=new BufferedReader(new InputStreamReader(loader.getResource("resourceA.txt").openStream())).readLine()%><br/>
|
||||
resourceB.txt=<%=new BufferedReader(new InputStreamReader(loader.getResource("resourceB.txt").openStream())).readLine()%><br/>
|
||||
resourceC.txt=<%=new BufferedReader(new InputStreamReader(loader.getResource("resourceC.txt").openStream())).readLine()%><br/>
|
||||
resourceD.txt=<%=new BufferedReader(new InputStreamReader(loader.getResource("resourceD.txt").openStream())).readLine()%><br/>
|
||||
resourceE.txt=<%=new BufferedReader(new InputStreamReader(loader.getResource("resourceE.txt").openStream())).readLine()%><br/>
|
||||
resourceF.txt=<%=new BufferedReader(new InputStreamReader(loader.getResource("resourceF.txt").openStream())).readLine()%><br/>
|
||||
resourceG.txt=<%=new BufferedReader(new InputStreamReader(loader.getResource("resourceG.txt").openStream())).readLine()%><br/>
|
||||
resourceH.txt=<%=new BufferedReader(new InputStreamReader(loader.getResource("resourceH.txt").openStream())).readLine()%><br/>
|
||||
resourceI.txt=<%=new BufferedReader(new InputStreamReader(loader.getResource("resourceI.txt").openStream())).readLine()%><br/>
|
||||
resourceJ.txt=<%=new BufferedReader(new InputStreamReader(loader.getResource("resourceJ.txt").openStream())).readLine()%><br/>
|
||||
resourceK.txt=<%=new BufferedReader(new InputStreamReader(loader.getResource("resourceK.txt").openStream())).readLine()%><br/>
|
|
@ -1,3 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Created-By: 1.6.0_20 (Sun Microsystems Inc.)
|
||||
|
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue