Resource template_context_xml = template.getResource(OVERLAY_XML);
if (template_context_xml.exists())
{
__log.debug("{}: overlay.xml={}",origin,template_context_xml);
XmlConfiguration xmlc = newXmlConfiguration(template_context_xml.getURL(),idMap,template,instance);
context=(ContextHandler)xmlc.configure();
idMap=xmlc.getIdMap();
}
else if (webapp==null)
// If there is no webapp, this is a plain context
context=new ContextHandler();
else
// It is a webapp context
context=new WebAppContext();
// Set the resource base
final Resource instance_webapp = instance.getResource(WEBAPP);
if (instance_webapp.exists())
{
context.setBaseResource(new ResourceCollection(instance_webapp,shared.getBaseResource()));
// Create the resource cache
ResourceCache cache = new ResourceCache(shared.getResourceCache(),instance_webapp,context.getMimeTypes(),false,false);
context.setAttribute(ResourceCache.class.getCanonicalName(),cache);
}
else
{
context.setBaseResource(shared.getBaseResource());
context.setAttribute(ResourceCache.class.getCanonicalName(),shared.getResourceCache());
}
__log.debug("{}: baseResource={}",origin,context.getResourceBase());
// Set the shared session scavenger timer
context.setAttribute("org.eclipse.jetty.server.session.timer", _sessionScavenger);
// Apply any node or instance overlay.xml
for (Resource context_xml : getLayeredResources(OVERLAY_XML,node,instance))
{
__log.debug("{}: overlay.xml={}",origin,context_xml);
XmlConfiguration xmlc = newXmlConfiguration(context_xml.getURL(),idMap,template,instance);
xmlc.getIdMap().put("Cache",context.getAttribute(ResourceCache.class.getCanonicalName()));
xmlc.configure(context);
idMap=xmlc.getIdMap();
}
// Is it a webapp?
if (context instanceof WebAppContext)
{