mirror of
https://github.com/jetty/jetty.project.git
synced 2025-02-26 09:34:56 +00:00
Backport from 7 to 8 of changes to reconciliation of webapp config mechanism. See bugzilla 320073
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2152 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
18dea730ed
commit
32a89ffaf7
@ -1,6 +1,8 @@
|
||||
|
||||
jetty-7.2-SNAPSHOT
|
||||
+ 319334 Concurrent, sharable ResourceCache
|
||||
+ 319370 WebAppClassLoader.Context
|
||||
+ 320073 Reconsile configuration mechanism
|
||||
+ 320112 Websocket in aggregate jars
|
||||
+ JETTY-1245 Do not use direct buffers with NIO SSL
|
||||
+ JETTY-1249 Apply max idle time to all connectors
|
||||
|
@ -34,7 +34,6 @@ public abstract class AbstractConfiguration implements Configuration
|
||||
public static final String CONTAINER_JAR_RESOURCES = WebInfConfiguration.CONTAINER_JAR_RESOURCES;
|
||||
public static final String WEB_INF_JAR_RESOURCES = WebInfConfiguration.WEB_INF_JAR_RESOURCES;
|
||||
public static final String WEB_INF_ORDERED_JAR_RESOURCES = WebInfConfiguration.WEB_INF_ORDERED_JAR_RESOURCES;
|
||||
public static final String METADATA_COMPLETE = MetaData.METADATA_COMPLETE;
|
||||
public static final String WEBXML_CLASSNAMES = MetaData.WEBXML_CLASSNAMES;
|
||||
public static final String DISCOVERED_ANNOTATIONS = "org.eclipse.jetty.discoveredAnnotations";
|
||||
|
||||
@ -74,11 +73,8 @@ public abstract class AbstractConfiguration implements Configuration
|
||||
return false;
|
||||
}
|
||||
});
|
||||
MetaData metaData = (MetaData)context.getAttribute(MetaData.METADATA);
|
||||
if (metaData == null)
|
||||
throw new IllegalStateException ("No metadata");
|
||||
|
||||
metaData.addDiscoveredAnnotations((List<DiscoveredAnnotation>)context.getAttribute(DISCOVERED_ANNOTATIONS));
|
||||
context.getMetaData().addDiscoveredAnnotations((List<DiscoveredAnnotation>)context.getAttribute(DISCOVERED_ANNOTATIONS));
|
||||
context.removeAttribute(DISCOVERED_ANNOTATIONS);
|
||||
}
|
||||
|
||||
@ -86,11 +82,7 @@ public abstract class AbstractConfiguration implements Configuration
|
||||
public void parseWebInfLib (final WebAppContext context, final AnnotationParser parser)
|
||||
throws Exception
|
||||
{
|
||||
MetaData metaData = (MetaData)context.getAttribute(MetaData.METADATA);
|
||||
if (metaData == null)
|
||||
throw new IllegalStateException ("No metadata");
|
||||
|
||||
List<FragmentDescriptor> frags = metaData.getFragments();
|
||||
List<FragmentDescriptor> frags = context.getMetaData().getFragments();
|
||||
|
||||
//email from Rajiv Mordani jsrs 315 7 April 2010
|
||||
//jars that do not have a web-fragment.xml are still considered fragments
|
||||
@ -135,7 +127,7 @@ public abstract class AbstractConfiguration implements Configuration
|
||||
}
|
||||
});
|
||||
|
||||
metaData.addDiscoveredAnnotations(r, discoveredAnnotations);
|
||||
context.getMetaData().addDiscoveredAnnotations(r, discoveredAnnotations);
|
||||
}
|
||||
}
|
||||
context.removeAttribute(DISCOVERED_ANNOTATIONS);
|
||||
@ -150,9 +142,6 @@ public abstract class AbstractConfiguration implements Configuration
|
||||
Resource classesDir = context.getWebInf().addPath("classes/");
|
||||
if (classesDir.exists())
|
||||
{
|
||||
MetaData metaData = (MetaData)context.getAttribute(MetaData.METADATA);
|
||||
if (metaData == null)
|
||||
throw new IllegalStateException ("No metadata");
|
||||
|
||||
List<DiscoveredAnnotation> discoveredAnnotations = new ArrayList<DiscoveredAnnotation>();
|
||||
context.setAttribute(DISCOVERED_ANNOTATIONS, discoveredAnnotations);
|
||||
@ -177,7 +166,7 @@ public abstract class AbstractConfiguration implements Configuration
|
||||
});
|
||||
|
||||
//TODO - where to set the annotations discovered from WEB-INF/classes?
|
||||
metaData.addDiscoveredAnnotations (discoveredAnnotations);
|
||||
context.getMetaData().addDiscoveredAnnotations (discoveredAnnotations);
|
||||
context.removeAttribute(DISCOVERED_ANNOTATIONS);
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class PostConstructAnnotationHandler extends AbstractIntrospectableAnnota
|
||||
|
||||
//ServletSpec 3.0 p80 If web.xml declares even one post-construct then all post-constructs
|
||||
//in fragments must be ignored. Otherwise, they are additive.
|
||||
MetaData metaData = ((MetaData)_context.getAttribute(MetaData.METADATA));
|
||||
MetaData metaData = _context.getMetaData();
|
||||
MetaData.Origin origin = metaData.getOrigin("post-construct");
|
||||
if (origin != null &&
|
||||
(origin == MetaData.Origin.WebXml ||
|
||||
|
@ -58,7 +58,7 @@ public class PreDestroyAnnotationHandler extends AbstractIntrospectableAnnotatio
|
||||
|
||||
//ServletSpec 3.0 p80 If web.xml declares even one predestroy then all predestroys
|
||||
//in fragments must be ignored. Otherwise, they are additive.
|
||||
MetaData metaData = ((MetaData)_context.getAttribute(MetaData.METADATA));
|
||||
MetaData metaData = _context.getMetaData();
|
||||
MetaData.Origin origin = metaData.getOrigin("pre-destroy");
|
||||
if (origin != null &&
|
||||
(origin == MetaData.Origin.WebXml ||
|
||||
|
@ -122,7 +122,7 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH
|
||||
//Servlet Spec 3.0 p. 76
|
||||
//If a descriptor has specified at least 1 injection target for this
|
||||
//resource, then it overrides this annotation
|
||||
MetaData metaData = ((MetaData)_context.getAttribute(MetaData.METADATA));
|
||||
MetaData metaData = _context.getMetaData();
|
||||
if (metaData.getOriginDescriptor("resource-ref."+name+".injection") != null)
|
||||
{
|
||||
//at least 1 injection was specified for this resource by a descriptor, so
|
||||
@ -265,7 +265,7 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH
|
||||
//Servlet Spec 3.0 p. 76
|
||||
//If a descriptor has specified at least 1 injection target for this
|
||||
//resource, then it overrides this annotation
|
||||
MetaData metaData = ((MetaData)_context.getAttribute(MetaData.METADATA));
|
||||
MetaData metaData = _context.getMetaData();
|
||||
if (metaData.getOriginDescriptor("resource-ref."+name+".injection") != null)
|
||||
{
|
||||
//at least 1 injection was specified for this resource by a descriptor, so
|
||||
|
@ -54,7 +54,7 @@ public class RunAsAnnotationHandler extends AbstractIntrospectableAnnotationHand
|
||||
ServletHolder holder = getServletHolderForClass(clazz);
|
||||
if (holder != null)
|
||||
{
|
||||
MetaData metaData = ((MetaData)_context.getAttribute(MetaData.METADATA));
|
||||
MetaData metaData = _context.getMetaData();
|
||||
Descriptor d = metaData.getOriginDescriptor(holder.getName()+".servlet.run-as");
|
||||
//if a descriptor has already set the value for run-as, do not
|
||||
//let the annotation override it
|
||||
|
@ -31,10 +31,6 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
||||
*/
|
||||
public class TestAnnotationConfiguration extends TestCase
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
public void testGetFragmentFromJar ()
|
||||
throws Exception
|
||||
{
|
||||
@ -76,8 +72,8 @@ public class TestAnnotationConfiguration extends TestCase
|
||||
WebAppContext wac = new WebAppContext();
|
||||
|
||||
List<FragmentDescriptor> frags = new ArrayList<FragmentDescriptor>();
|
||||
frags.add(new FragmentDescriptor(Resource.newResource("jar:"+url+"file.jar!/fooa.props"), null));
|
||||
frags.add(new FragmentDescriptor(Resource.newResource("jar:"+url+"file2.jar!/foob.props"), null));
|
||||
frags.add(new FragmentDescriptor(Resource.newResource("jar:"+url+"file.jar!/fooa.props")));
|
||||
frags.add(new FragmentDescriptor(Resource.newResource("jar:"+url+"file2.jar!/foob.props")));
|
||||
|
||||
assertNotNull(config.getFragmentFromJar(jar1, frags));
|
||||
}
|
||||
|
@ -36,7 +36,6 @@ public class TestServletAnnotations
|
||||
throws Exception
|
||||
{
|
||||
WebAppContext wac = new WebAppContext();
|
||||
wac.setAttribute(MetaData.METADATA, new MetaData(wac));
|
||||
ConstraintSecurityHandler sh = new ConstraintSecurityHandler();
|
||||
wac.setSecurityHandler(sh);
|
||||
sh.setRoles(new HashSet<String>(Arrays.asList(new String[]{"humpty", "dumpty"})));
|
||||
|
@ -34,7 +34,6 @@ public class TestResourceAnnotations
|
||||
wac.setServer(server);
|
||||
InjectionCollection injections = new InjectionCollection();
|
||||
wac.setAttribute(InjectionCollection.INJECTION_COLLECTION, injections);
|
||||
wac.setAttribute(MetaData.METADATA, new MetaData(wac));
|
||||
InitialContext ic = new InitialContext();
|
||||
Context comp = (Context)ic.lookup("java:comp");
|
||||
Context env = comp.createSubcontext("env");
|
||||
|
@ -16,6 +16,7 @@
|
||||
package org.eclipse.jetty.deploy.providers;
|
||||
|
||||
import org.eclipse.jetty.deploy.test.XmlConfiguredJetty;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
@ -30,6 +31,7 @@ public class MonitoredDirAppProviderStartupTest
|
||||
@BeforeClass
|
||||
public static void setupEnvironment() throws Exception
|
||||
{
|
||||
Log.getLog().setDebugEnabled(true);
|
||||
jetty = new XmlConfiguredJetty();
|
||||
jetty.addConfiguration("jetty.xml");
|
||||
jetty.addConfiguration("jetty-deploymgr-contexts.xml");
|
||||
|
@ -26,7 +26,6 @@ import org.eclipse.jetty.plus.jndi.Transaction;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.webapp.FragmentDescriptor;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
import org.eclipse.jetty.webapp.MetaData;
|
||||
|
||||
|
||||
/**
|
||||
@ -59,29 +58,7 @@ public class Configuration implements org.eclipse.jetty.webapp.Configuration
|
||||
{
|
||||
bindUserTransaction(context);
|
||||
|
||||
MetaData metaData = (MetaData)context.getAttribute(MetaData.METADATA);
|
||||
if (metaData == null)
|
||||
throw new IllegalStateException ("No metadata");
|
||||
|
||||
metaData.addDescriptorProcessor(new PlusDescriptorProcessor());
|
||||
|
||||
/*
|
||||
* THE PROCESSING IS NOW DONE IN metadata.resolve ()
|
||||
|
||||
PlusDescriptorProcessor plusProcessor = new PlusDescriptorProcessor(metaData);
|
||||
plusProcessor.process(metaData.getWebDefault());
|
||||
plusProcessor.process(metaData.getWebXml());
|
||||
|
||||
|
||||
//Process plus-elements of each descriptor
|
||||
for (FragmentDescriptor frag: metaData.getOrderedFragments())
|
||||
{
|
||||
plusProcessor.process(frag);
|
||||
}
|
||||
|
||||
//process the override-web.xml descriptor
|
||||
plusProcessor.process(metaData.getOverrideWeb());
|
||||
*/
|
||||
context.getMetaData().addDescriptorProcessor(new PlusDescriptorProcessor());
|
||||
}
|
||||
|
||||
public void postConfigure(WebAppContext context) throws Exception
|
||||
|
@ -48,9 +48,6 @@ import org.eclipse.jetty.xml.XmlParser;
|
||||
|
||||
public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
{
|
||||
protected WebAppContext _context;
|
||||
protected MetaData _metaData;
|
||||
|
||||
public PlusDescriptorProcessor ()
|
||||
{
|
||||
try
|
||||
@ -69,22 +66,18 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.webapp.IterativeDescriptorProcessor#start(org.eclipse.jetty.webapp.Descriptor)
|
||||
* @see org.eclipse.jetty.webapp.IterativeDescriptorProcessor#start(WebAppContext, org.eclipse.jetty.webapp.Descriptor)
|
||||
*/
|
||||
public void start(Descriptor descriptor)
|
||||
public void start(WebAppContext context, Descriptor descriptor)
|
||||
{
|
||||
_metaData = descriptor.getMetaData();
|
||||
_context = _metaData.getContext();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.webapp.IterativeDescriptorProcessor#end(org.eclipse.jetty.webapp.Descriptor)
|
||||
* @see org.eclipse.jetty.webapp.IterativeDescriptorProcessor#end(org.eclipse.jetty.webapp.Descriptor, WebAppContext)
|
||||
*/
|
||||
public void end(Descriptor descriptor)
|
||||
public void end(WebAppContext context,Descriptor descriptor)
|
||||
{
|
||||
_metaData = null;
|
||||
_context = null;
|
||||
}
|
||||
|
||||
|
||||
@ -96,7 +89,7 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
* @param node
|
||||
* @throws Exception
|
||||
*/
|
||||
public void visitEnvEntry (Descriptor descriptor, XmlParser.Node node)
|
||||
public void visitEnvEntry (WebAppContext context, Descriptor descriptor, XmlParser.Node node)
|
||||
throws Exception
|
||||
{
|
||||
String name=node.getString("env-entry-name",false,true);
|
||||
@ -111,19 +104,19 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
return;
|
||||
}
|
||||
|
||||
Origin o = _metaData.getOrigin("env-entry."+name);
|
||||
Origin o = context.getMetaData().getOrigin("env-entry."+name);
|
||||
switch (o)
|
||||
{
|
||||
case NotSet:
|
||||
{
|
||||
//no descriptor has configured an env-entry of this name previously
|
||||
_metaData.setOrigin("env-entry."+name, descriptor);
|
||||
context.getMetaData().setOrigin("env-entry."+name, descriptor);
|
||||
//the javaee_5.xsd says that the env-entry-type is optional
|
||||
//if there is an <injection> element, because you can get
|
||||
//type from the element, but what to do if there is more
|
||||
//than one <injection> element, do you just pick the type
|
||||
//of the first one?
|
||||
addInjections (descriptor, node, name, TypeUtil.fromName(type));
|
||||
addInjections (context, descriptor, node, name, TypeUtil.fromName(type));
|
||||
Object value = TypeUtil.valueOf(type,valueStr);
|
||||
bindEnvEntry(name, value);
|
||||
break;
|
||||
@ -139,8 +132,8 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
{
|
||||
//We're processing web-defaults, web.xml or web-override. Any of them can
|
||||
//set or change the env-entry.
|
||||
_metaData.setOrigin("env-entry."+name, descriptor);
|
||||
addInjections (descriptor, node, name, TypeUtil.fromName(type));
|
||||
context.getMetaData().setOrigin("env-entry."+name, descriptor);
|
||||
addInjections (context, descriptor, node, name, TypeUtil.fromName(type));
|
||||
Object value = TypeUtil.valueOf(type,valueStr);
|
||||
bindEnvEntry(name, value);
|
||||
}
|
||||
@ -149,9 +142,9 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
//A web.xml declared the env-entry. Check to see if any injections have been
|
||||
//declared for it. If it was declared in web.xml then don't merge any injections.
|
||||
//If it was declared in a web-fragment, then we can keep merging fragments.
|
||||
Descriptor d = _metaData.getOriginDescriptor("env-entry."+name+".injection");
|
||||
Descriptor d = context.getMetaData().getOriginDescriptor("env-entry."+name+".injection");
|
||||
if (d==null || d instanceof FragmentDescriptor)
|
||||
addInjections(descriptor, node, name, TypeUtil.fromName(type));
|
||||
addInjections(context, descriptor, node, name, TypeUtil.fromName(type));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -193,7 +186,7 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
* @param node
|
||||
* @throws Exception
|
||||
*/
|
||||
public void visitResourceRef (Descriptor descriptor, XmlParser.Node node)
|
||||
public void visitResourceRef (WebAppContext context, Descriptor descriptor, XmlParser.Node node)
|
||||
throws Exception
|
||||
{
|
||||
String jndiName = node.getString("res-ref-name",false,true);
|
||||
@ -201,20 +194,20 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
String auth = node.getString("res-auth", false, true);
|
||||
String shared = node.getString("res-sharing-scope", false, true);
|
||||
|
||||
Origin o = _metaData.getOrigin("resource-ref."+jndiName);
|
||||
Origin o = context.getMetaData().getOrigin("resource-ref."+jndiName);
|
||||
switch (o)
|
||||
{
|
||||
case NotSet:
|
||||
{
|
||||
//No descriptor or annotation previously declared a resource-ref of this name.
|
||||
_metaData.setOrigin("resource-ref."+jndiName, descriptor);
|
||||
context.getMetaData().setOrigin("resource-ref."+jndiName, descriptor);
|
||||
|
||||
//check for <injection> elements
|
||||
Class typeClass = TypeUtil.fromName(type);
|
||||
Class<?> typeClass = TypeUtil.fromName(type);
|
||||
if (typeClass==null)
|
||||
typeClass = _context.loadClass(type);
|
||||
addInjections(descriptor, node, jndiName, typeClass);
|
||||
bindResourceRef(jndiName, typeClass);
|
||||
typeClass = context.loadClass(type);
|
||||
addInjections(context, descriptor, node, jndiName, typeClass);
|
||||
bindResourceRef(context,jndiName, typeClass);
|
||||
break;
|
||||
}
|
||||
case WebXml:
|
||||
@ -226,17 +219,17 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
{
|
||||
//We're processing web-defaults, web.xml or web-override. Any of them can
|
||||
//set or change the resource-ref.
|
||||
_metaData.setOrigin("resource-ref."+jndiName, descriptor);
|
||||
context.getMetaData().setOrigin("resource-ref."+jndiName, descriptor);
|
||||
|
||||
//check for <injection> elements
|
||||
Class typeClass = TypeUtil.fromName(type);
|
||||
Class<?> typeClass = TypeUtil.fromName(type);
|
||||
if (typeClass==null)
|
||||
typeClass = _context.loadClass(type);
|
||||
typeClass = context.loadClass(type);
|
||||
|
||||
addInjections(descriptor, node, jndiName, typeClass);
|
||||
addInjections(context, descriptor, node, jndiName, typeClass);
|
||||
|
||||
//bind the entry into jndi
|
||||
bindResourceRef(jndiName, typeClass);
|
||||
bindResourceRef(context,jndiName, typeClass);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -244,13 +237,13 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
//web-fragment. Check to see if any injections were declared for it by web.xml.
|
||||
//If any injection was declared in web.xml then don't merge any injections.
|
||||
//If it was declared in a web-fragment, then we can keep merging fragments.
|
||||
Descriptor d = _metaData.getOriginDescriptor("resource-ref."+jndiName+".injection");
|
||||
Descriptor d = context.getMetaData().getOriginDescriptor("resource-ref."+jndiName+".injection");
|
||||
if (d==null || d instanceof FragmentDescriptor)
|
||||
{
|
||||
Class typeClass = TypeUtil.fromName(type);
|
||||
Class<?> typeClass = TypeUtil.fromName(type);
|
||||
if (typeClass==null)
|
||||
typeClass = _context.loadClass(type);
|
||||
addInjections(descriptor, node, jndiName, TypeUtil.fromName(type));
|
||||
typeClass = context.loadClass(type);
|
||||
addInjections(context, descriptor, node, jndiName, TypeUtil.fromName(type));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -275,13 +268,13 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
* @param node
|
||||
* @throws Exception
|
||||
*/
|
||||
public void visitResourceEnvRef (Descriptor descriptor, XmlParser.Node node)
|
||||
public void visitResourceEnvRef (WebAppContext context, Descriptor descriptor, XmlParser.Node node)
|
||||
throws Exception
|
||||
{
|
||||
String jndiName = node.getString("resource-env-ref-name",false,true);
|
||||
String type = node.getString("resource-env-ref-type", false, true);
|
||||
|
||||
Origin o = _metaData.getOrigin("resource-env-ref."+jndiName);
|
||||
Origin o = context.getMetaData().getOrigin("resource-env-ref."+jndiName);
|
||||
switch (o)
|
||||
{
|
||||
case NotSet:
|
||||
@ -289,11 +282,11 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
//First declaration of resource-env-ref with this jndiName
|
||||
//JavaEE Spec sec 5.7.1.3 says the resource-env-ref-type
|
||||
//is mandatory, but the schema says it is optional!
|
||||
Class typeClass = TypeUtil.fromName(type);
|
||||
Class<?> typeClass = TypeUtil.fromName(type);
|
||||
if (typeClass==null)
|
||||
typeClass = _context.loadClass(type);
|
||||
addInjections (descriptor, node, jndiName, typeClass);
|
||||
bindResourceEnvRef(jndiName, typeClass);
|
||||
typeClass = context.loadClass(type);
|
||||
addInjections (context, descriptor, node, jndiName, typeClass);
|
||||
bindResourceEnvRef(context,jndiName, typeClass);
|
||||
break;
|
||||
}
|
||||
case WebXml:
|
||||
@ -306,24 +299,24 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
{
|
||||
//We're processing web-defaults, web.xml or web-override. Any of them can
|
||||
//set or change the resource-env-ref.
|
||||
_metaData.setOrigin("resource-env-ref."+jndiName, descriptor);
|
||||
Class typeClass = TypeUtil.fromName(type);
|
||||
context.getMetaData().setOrigin("resource-env-ref."+jndiName, descriptor);
|
||||
Class<?> typeClass = TypeUtil.fromName(type);
|
||||
if (typeClass==null)
|
||||
typeClass = _context.loadClass(type);
|
||||
addInjections (descriptor, node, jndiName, typeClass);
|
||||
bindResourceEnvRef(jndiName, typeClass);
|
||||
typeClass = context.loadClass(type);
|
||||
addInjections (context, descriptor, node, jndiName, typeClass);
|
||||
bindResourceEnvRef(context,jndiName, typeClass);
|
||||
}
|
||||
else
|
||||
{
|
||||
//We're processing a web-fragment. It can only contribute injections if the
|
||||
//there haven't been any injections declared yet, or they weren't declared in a WebXml file.
|
||||
Descriptor d = _metaData.getOriginDescriptor("resource-env-ref."+jndiName+".injection");
|
||||
Descriptor d = context.getMetaData().getOriginDescriptor("resource-env-ref."+jndiName+".injection");
|
||||
if (d == null || d instanceof FragmentDescriptor)
|
||||
{
|
||||
Class typeClass = TypeUtil.fromName(type);
|
||||
Class<?> typeClass = TypeUtil.fromName(type);
|
||||
if (typeClass==null)
|
||||
typeClass = _context.loadClass(type);
|
||||
addInjections (descriptor, node, jndiName, typeClass);
|
||||
typeClass = context.loadClass(type);
|
||||
addInjections (context, descriptor, node, jndiName, typeClass);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -345,25 +338,25 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
* @param node
|
||||
* @throws Exception
|
||||
*/
|
||||
public void visitMessageDestinationRef (Descriptor descriptor, XmlParser.Node node)
|
||||
public void visitMessageDestinationRef (WebAppContext context, Descriptor descriptor, XmlParser.Node node)
|
||||
throws Exception
|
||||
{
|
||||
String jndiName = node.getString("message-destination-ref-name",false,true);
|
||||
String type = node.getString("message-destination-type",false,true);
|
||||
String usage = node.getString("message-destination-usage",false,true);
|
||||
|
||||
Origin o = _metaData.getOrigin("message-destination-ref."+jndiName);
|
||||
Origin o = context.getMetaData().getOrigin("message-destination-ref."+jndiName);
|
||||
switch (o)
|
||||
{
|
||||
case NotSet:
|
||||
{
|
||||
//A message-destination-ref of this name has not been previously declared
|
||||
Class typeClass = TypeUtil.fromName(type);
|
||||
Class<?> typeClass = TypeUtil.fromName(type);
|
||||
if (typeClass==null)
|
||||
typeClass = _context.loadClass(type);
|
||||
addInjections(descriptor, node, jndiName, typeClass);
|
||||
bindMessageDestinationRef(jndiName, typeClass);
|
||||
_metaData.setOrigin("message-destination-ref."+jndiName, descriptor);
|
||||
typeClass = context.loadClass(type);
|
||||
addInjections(context, descriptor, node, jndiName, typeClass);
|
||||
bindMessageDestinationRef(context,jndiName, typeClass);
|
||||
context.getMetaData().setOrigin("message-destination-ref."+jndiName, descriptor);
|
||||
break;
|
||||
}
|
||||
case WebXml:
|
||||
@ -374,24 +367,24 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
//Only allow other web-default, web.xml, web-override to change it.
|
||||
if (!(descriptor instanceof FragmentDescriptor))
|
||||
{
|
||||
Class typeClass = TypeUtil.fromName(type);
|
||||
Class<?> typeClass = TypeUtil.fromName(type);
|
||||
if (typeClass==null)
|
||||
typeClass = _context.loadClass(type);
|
||||
addInjections(descriptor, node, jndiName, typeClass);
|
||||
bindMessageDestinationRef(jndiName, typeClass);
|
||||
_metaData.setOrigin("message-destination-ref."+jndiName, descriptor);
|
||||
typeClass = context.loadClass(type);
|
||||
addInjections(context, descriptor, node, jndiName, typeClass);
|
||||
bindMessageDestinationRef(context,jndiName, typeClass);
|
||||
context.getMetaData().setOrigin("message-destination-ref."+jndiName, descriptor);
|
||||
}
|
||||
else
|
||||
{
|
||||
//A web-fragment has declared a message-destination-ref with the same name as a web xml.
|
||||
//It can only contribute injections, and only if the web xml didn't declare any.
|
||||
Descriptor d = _metaData.getOriginDescriptor("message-destination-ref."+jndiName+".injection");
|
||||
Descriptor d = context.getMetaData().getOriginDescriptor("message-destination-ref."+jndiName+".injection");
|
||||
if (d == null || d instanceof FragmentDescriptor)
|
||||
{
|
||||
Class typeClass = TypeUtil.fromName(type);
|
||||
Class<?> typeClass = TypeUtil.fromName(type);
|
||||
if (typeClass==null)
|
||||
typeClass = _context.loadClass(type);
|
||||
addInjections(descriptor, node, jndiName, typeClass);
|
||||
typeClass = context.loadClass(type);
|
||||
addInjections(context, descriptor, node, jndiName, typeClass);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -416,7 +409,7 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
* resources have been setup but before the class is put into use
|
||||
* @param node
|
||||
*/
|
||||
public void visitPostConstruct(Descriptor descriptor, XmlParser.Node node)
|
||||
public void visitPostConstruct(WebAppContext context, Descriptor descriptor, XmlParser.Node node)
|
||||
{
|
||||
String className = node.getString("lifecycle-callback-class", false, true);
|
||||
String methodName = node.getString("lifecycle-callback-method", false, true);
|
||||
@ -431,20 +424,20 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
Log.warn("No lifecycle-callback-method specified for class "+className);
|
||||
return;
|
||||
}
|
||||
LifeCycleCallbackCollection callbacks = (LifeCycleCallbackCollection)_context.getAttribute(LifeCycleCallbackCollection.LIFECYCLE_CALLBACK_COLLECTION);
|
||||
LifeCycleCallbackCollection callbacks = (LifeCycleCallbackCollection)context.getAttribute(LifeCycleCallbackCollection.LIFECYCLE_CALLBACK_COLLECTION);
|
||||
//ServletSpec 3.0 p80 If web.xml declares a post-construct then all post-constructs
|
||||
//in fragments must be ignored. Otherwise, they are additive.
|
||||
Origin o = _metaData.getOrigin("post-construct");
|
||||
Origin o = context.getMetaData().getOrigin("post-construct");
|
||||
switch (o)
|
||||
{
|
||||
case NotSet:
|
||||
{
|
||||
//No post-constructs have been declared previously.
|
||||
_metaData.setOrigin("post-construct", descriptor);
|
||||
context.getMetaData().setOrigin("post-construct", descriptor);
|
||||
|
||||
try
|
||||
{
|
||||
Class clazz = _context.loadClass(className);
|
||||
Class<?> clazz = context.loadClass(className);
|
||||
LifeCycleCallback callback = new PostConstructCallback();
|
||||
callback.setTarget(clazz, methodName);
|
||||
callbacks.add(callback);
|
||||
@ -465,7 +458,7 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
{
|
||||
try
|
||||
{
|
||||
Class clazz = _context.loadClass(className);
|
||||
Class<?> clazz = context.loadClass(className);
|
||||
LifeCycleCallback callback = new PostConstructCallback();
|
||||
callback.setTarget(clazz, methodName);
|
||||
callbacks.add(callback);
|
||||
@ -482,7 +475,7 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
//A web-fragment first declared a post-construct. Allow all other web-fragments to merge in their post-constructs
|
||||
try
|
||||
{
|
||||
Class clazz = _context.loadClass(className);
|
||||
Class<?> clazz = context.loadClass(className);
|
||||
LifeCycleCallback callback = new PostConstructCallback();
|
||||
callback.setTarget(clazz, methodName);
|
||||
callbacks.add(callback);
|
||||
@ -504,7 +497,7 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
* the instance is being destroyed
|
||||
* @param node
|
||||
*/
|
||||
public void visitPreDestroy(Descriptor descriptor, XmlParser.Node node)
|
||||
public void visitPreDestroy(WebAppContext context, Descriptor descriptor, XmlParser.Node node)
|
||||
{
|
||||
String className = node.getString("lifecycle-callback-class", false, true);
|
||||
String methodName = node.getString("lifecycle-callback-method", false, true);
|
||||
@ -518,19 +511,19 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
Log.warn("No lifecycle-callback-method specified for pre-destroy class "+className);
|
||||
return;
|
||||
}
|
||||
LifeCycleCallbackCollection callbacks = (LifeCycleCallbackCollection)_context.getAttribute(LifeCycleCallbackCollection.LIFECYCLE_CALLBACK_COLLECTION);
|
||||
LifeCycleCallbackCollection callbacks = (LifeCycleCallbackCollection)context.getAttribute(LifeCycleCallbackCollection.LIFECYCLE_CALLBACK_COLLECTION);
|
||||
|
||||
Origin o = _metaData.getOrigin("pre-destroy");
|
||||
Origin o = context.getMetaData().getOrigin("pre-destroy");
|
||||
switch(o)
|
||||
{
|
||||
case NotSet:
|
||||
{
|
||||
//No pre-destroys have been declared previously. Record this descriptor
|
||||
//as the first declarer.
|
||||
_metaData.setOrigin("pre-destroy", descriptor);
|
||||
context.getMetaData().setOrigin("pre-destroy", descriptor);
|
||||
try
|
||||
{
|
||||
Class clazz = _context.loadClass(className);
|
||||
Class<?> clazz = context.loadClass(className);
|
||||
LifeCycleCallback callback = new PreDestroyCallback();
|
||||
callback.setTarget(clazz, methodName);
|
||||
callbacks.add(callback);
|
||||
@ -551,7 +544,7 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
{
|
||||
try
|
||||
{
|
||||
Class clazz = _context.loadClass(className);
|
||||
Class<?> clazz = context.loadClass(className);
|
||||
LifeCycleCallback callback = new PreDestroyCallback();
|
||||
callback.setTarget(clazz, methodName);
|
||||
callbacks.add(callback);
|
||||
@ -568,7 +561,7 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
//No pre-destroys in web xml, so allow all fragments to merge their pre-destroys.
|
||||
try
|
||||
{
|
||||
Class clazz = _context.loadClass(className);
|
||||
Class<?> clazz = context.loadClass(className);
|
||||
LifeCycleCallback callback = new PreDestroyCallback();
|
||||
callback.setTarget(clazz, methodName);
|
||||
callbacks.add(callback);
|
||||
@ -592,7 +585,7 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
* @param valueClass
|
||||
* @return
|
||||
*/
|
||||
public void addInjections (Descriptor descriptor, XmlParser.Node node, String jndiName, Class valueClass)
|
||||
public void addInjections (WebAppContext context, Descriptor descriptor, XmlParser.Node node, String jndiName, Class<?> valueClass)
|
||||
{
|
||||
Iterator itor = node.iterator("injection-target");
|
||||
|
||||
@ -612,20 +605,20 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
continue;
|
||||
}
|
||||
|
||||
InjectionCollection injections = (InjectionCollection)_context.getAttribute(InjectionCollection.INJECTION_COLLECTION);
|
||||
InjectionCollection injections = (InjectionCollection)context.getAttribute(InjectionCollection.INJECTION_COLLECTION);
|
||||
// comments in the javaee_5.xsd file specify that the targetName is looked
|
||||
// for first as a java bean property, then if that fails, as a field
|
||||
try
|
||||
{
|
||||
Class clazz = _context.loadClass(targetClassName);
|
||||
Class<?> clazz = context.loadClass(targetClassName);
|
||||
Injection injection = new Injection();
|
||||
injection.setJndiName(jndiName);
|
||||
injection.setTarget(clazz, targetName, valueClass);
|
||||
injections.add(injection);
|
||||
|
||||
//Record which was the first descriptor to declare an injection for this name
|
||||
if (_metaData.getOriginDescriptor(node.getTag()+"."+jndiName+".injection") == null)
|
||||
_metaData.setOrigin(node.getTag()+"."+jndiName+".injection", descriptor);
|
||||
if (context.getMetaData().getOriginDescriptor(node.getTag()+"."+jndiName+".injection") == null)
|
||||
context.getMetaData().setOrigin(node.getTag()+"."+jndiName+".injection", descriptor);
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
@ -683,10 +676,10 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
* @param name
|
||||
* @throws Exception
|
||||
*/
|
||||
public void bindResourceRef(String name, Class typeClass)
|
||||
public void bindResourceRef(WebAppContext context, String name, Class<?> typeClass)
|
||||
throws Exception
|
||||
{
|
||||
bindEntry(name, typeClass);
|
||||
bindEntry(context, name, typeClass);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -694,17 +687,17 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
* @param name
|
||||
* @throws Exception
|
||||
*/
|
||||
public void bindResourceEnvRef(String name, Class typeClass)
|
||||
public void bindResourceEnvRef(WebAppContext context, String name, Class<?> typeClass)
|
||||
throws Exception
|
||||
{
|
||||
bindEntry(name, typeClass);
|
||||
bindEntry(context, name, typeClass);
|
||||
}
|
||||
|
||||
|
||||
public void bindMessageDestinationRef(String name, Class typeClass)
|
||||
public void bindMessageDestinationRef(WebAppContext context, String name, Class<?> typeClass)
|
||||
throws Exception
|
||||
{
|
||||
bindEntry(name, typeClass);
|
||||
bindEntry(context, name, typeClass);
|
||||
}
|
||||
|
||||
|
||||
@ -723,7 +716,7 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
* @param typeClass
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void bindEntry (String name, Class typeClass)
|
||||
protected void bindEntry (WebAppContext context, String name, Class<?> typeClass)
|
||||
throws Exception
|
||||
{
|
||||
String nameInEnvironment = name;
|
||||
@ -731,7 +724,7 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
|
||||
//check if the name in web.xml has been mapped to something else
|
||||
//check a context-specific naming environment first
|
||||
Object scope = _context;
|
||||
Object scope = context;
|
||||
NamingEntry ne = NamingEntryUtil.lookupNamingEntry(scope, name);
|
||||
|
||||
if (ne!=null && (ne instanceof Link))
|
||||
@ -742,14 +735,14 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
}
|
||||
|
||||
//try finding that mapped name in the webapp's environment first
|
||||
scope = _context;
|
||||
scope = context;
|
||||
bound = NamingEntryUtil.bindToENC(scope, name, nameInEnvironment);
|
||||
|
||||
if (bound)
|
||||
return;
|
||||
|
||||
//try the server's environment
|
||||
scope = _context.getServer();
|
||||
scope = context.getServer();
|
||||
bound = NamingEntryUtil.bindToENC(scope, name, nameInEnvironment);
|
||||
if (bound)
|
||||
return;
|
||||
@ -764,7 +757,7 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
||||
//eg javax.sql.DataSource/default
|
||||
nameInEnvironment = typeClass.getName()+"/default";
|
||||
//First try the server scope
|
||||
NamingEntry defaultNE = NamingEntryUtil.lookupNamingEntry(_context.getServer(), nameInEnvironment);
|
||||
NamingEntry defaultNE = NamingEntryUtil.lookupNamingEntry(context.getServer(), nameInEnvironment);
|
||||
if (defaultNE==null)
|
||||
defaultNE = NamingEntryUtil.lookupNamingEntry(null, nameInEnvironment);
|
||||
|
||||
|
@ -83,6 +83,7 @@ public class TestConfiguration
|
||||
|
||||
|
||||
Thread.currentThread().setContextClassLoader(wac.getClassLoader());
|
||||
MetaData metadata = new MetaData(wac);
|
||||
envConfig.preConfigure(wac);
|
||||
envConfig.configure(wac);
|
||||
envConfig.bindEnvEntries(wac);
|
||||
|
@ -43,8 +43,8 @@ public class ErrorPageErrorHandler extends ErrorHandler
|
||||
public final static String ERROR_PAGE="org.eclipse.jetty.server.error_page";
|
||||
|
||||
protected ServletContext _servletContext;
|
||||
protected Map _errorPages; // code or exception to URL
|
||||
protected List _errorPageList; // list of ErrorCode by range
|
||||
private final Map<String,String> _errorPages= new HashMap<String,String>(); // code or exception to URL
|
||||
private final List<ErrorCodeRange> _errorPageList=new ArrayList<ErrorCodeRange>(); // list of ErrorCode by range
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public ErrorPageErrorHandler()
|
||||
@ -54,6 +54,7 @@ public class ErrorPageErrorHandler extends ErrorHandler
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.handler.ErrorHandler#handle(String, Request, HttpServletRequest, HttpServletResponse)
|
||||
*/
|
||||
@Override
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
String method = request.getMethod();
|
||||
@ -65,7 +66,7 @@ public class ErrorPageErrorHandler extends ErrorHandler
|
||||
if (_errorPages!=null)
|
||||
{
|
||||
String error_page= null;
|
||||
Class exClass= (Class)request.getAttribute(Dispatcher.ERROR_EXCEPTION_TYPE);
|
||||
Class<?> exClass= (Class<?>)request.getAttribute(Dispatcher.ERROR_EXCEPTION_TYPE);
|
||||
|
||||
if (ServletException.class.equals(exClass))
|
||||
{
|
||||
@ -147,7 +148,7 @@ public class ErrorPageErrorHandler extends ErrorHandler
|
||||
/**
|
||||
* @return Returns the errorPages.
|
||||
*/
|
||||
public Map getErrorPages()
|
||||
public Map<String,String> getErrorPages()
|
||||
{
|
||||
return _errorPages;
|
||||
}
|
||||
@ -156,9 +157,11 @@ public class ErrorPageErrorHandler extends ErrorHandler
|
||||
/**
|
||||
* @param errorPages The errorPages to set. A map of Exception class name or error code as a string to URI string
|
||||
*/
|
||||
public void setErrorPages(Map errorPages)
|
||||
public void setErrorPages(Map<String,String> errorPages)
|
||||
{
|
||||
_errorPages = errorPages;
|
||||
_errorPages.clear();
|
||||
if (errorPages!=null)
|
||||
_errorPages.putAll(errorPages);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -168,13 +171,23 @@ public class ErrorPageErrorHandler extends ErrorHandler
|
||||
* @param exception The exception
|
||||
* @param uri The URI of the error page.
|
||||
*/
|
||||
public void addErrorPage(Class exception,String uri)
|
||||
public void addErrorPage(Class<? extends Throwable> exception,String uri)
|
||||
{
|
||||
if (_errorPages==null)
|
||||
_errorPages=new HashMap();
|
||||
_errorPages.put(exception.getName(),uri);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Add Error Page mapping for an exception class
|
||||
* This method is called as a result of an exception-type element in a web.xml file
|
||||
* or may be called directly
|
||||
* @param exception The exception
|
||||
* @param uri The URI of the error page.
|
||||
*/
|
||||
public void addErrorPage(String exceptionClassName,String uri)
|
||||
{
|
||||
_errorPages.put(exceptionClassName,uri);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Add Error Page mapping for a status code.
|
||||
* This method is called as a result of an error-code element in a web.xml file
|
||||
@ -184,8 +197,6 @@ public class ErrorPageErrorHandler extends ErrorHandler
|
||||
*/
|
||||
public void addErrorPage(int code,String uri)
|
||||
{
|
||||
if (_errorPages==null)
|
||||
_errorPages=new HashMap();
|
||||
_errorPages.put(Integer.toString(code),uri);
|
||||
}
|
||||
|
||||
@ -199,14 +210,11 @@ public class ErrorPageErrorHandler extends ErrorHandler
|
||||
*/
|
||||
public void addErrorPage(int from, int to, String uri)
|
||||
{
|
||||
if (_errorPageList == null)
|
||||
{
|
||||
_errorPageList = new ArrayList();
|
||||
}
|
||||
_errorPageList.add(new ErrorCodeRange(from, to, uri));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
protected void doStart() throws Exception
|
||||
{
|
||||
super.doStart();
|
||||
@ -214,6 +222,7 @@ public class ErrorPageErrorHandler extends ErrorHandler
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
protected void doStop() throws Exception
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
@ -254,6 +263,7 @@ public class ErrorPageErrorHandler extends ErrorHandler
|
||||
return _uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "from: " + _from + ",to: " + _to + ",uri: " + _uri;
|
||||
|
@ -14,14 +14,12 @@
|
||||
package org.eclipse.jetty.servlet;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.EventListener;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
@ -74,8 +72,6 @@ public class ServletContextHandler extends ContextHandler
|
||||
protected Decorator _decorator;
|
||||
protected Object _restrictedContextListeners;
|
||||
|
||||
protected final Set<Object> _created = Collections.newSetFromMap(new ConcurrentHashMap<Object,Boolean>());
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public ServletContextHandler()
|
||||
{
|
||||
@ -142,7 +138,6 @@ public class ServletContextHandler extends ContextHandler
|
||||
@Override
|
||||
protected void doStart() throws Exception
|
||||
{
|
||||
_created.clear();
|
||||
super.doStart();
|
||||
}
|
||||
|
||||
@ -154,20 +149,6 @@ public class ServletContextHandler extends ContextHandler
|
||||
protected void doStop() throws Exception
|
||||
{
|
||||
super.doStop();
|
||||
_created.clear();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Check if instance was created by a call to {@link ServletContext#createFilter(Class)},
|
||||
* {@link ServletContext#createServlet(Class)} or {@link ServletContext#createListener(Class)}
|
||||
* @param instance Instance of {@link Servlet}, {@link Filter} or {@link EventListener}
|
||||
* @return True if the instance was created by a call to {@link ServletContext#createFilter(Class)},
|
||||
* {@link ServletContext#createServlet(Class)} or {@link ServletContext#createListener(Class)}
|
||||
*/
|
||||
public boolean isCreatedInstance(Object instance)
|
||||
{
|
||||
return _created.contains(instance);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -595,7 +576,6 @@ public class ServletContextHandler extends ContextHandler
|
||||
T f = c.newInstance();
|
||||
if (_decorator!=null)
|
||||
f=_decorator.decorateFilterInstance(f);
|
||||
_created.add(f);
|
||||
return f;
|
||||
}
|
||||
catch (InstantiationException e)
|
||||
@ -616,7 +596,6 @@ public class ServletContextHandler extends ContextHandler
|
||||
T s = c.newInstance();
|
||||
if (_decorator!=null)
|
||||
s=_decorator.decorateServletInstance(s);
|
||||
_created.add(s);
|
||||
return s;
|
||||
}
|
||||
catch (InstantiationException e)
|
||||
@ -734,7 +713,6 @@ public class ServletContextHandler extends ContextHandler
|
||||
|
||||
if (_decorator!=null)
|
||||
l=_decorator.decorateListenerInstance(l);
|
||||
_created.add(l);
|
||||
return l;
|
||||
}
|
||||
catch(ServletException e)
|
||||
|
@ -31,7 +31,6 @@ public interface Configuration
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
/** Configure WebApp.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void configure (WebAppContext context) throws Exception;
|
||||
|
@ -18,12 +18,11 @@ import org.eclipse.jetty.util.resource.Resource;
|
||||
/**
|
||||
* DefaultsDescriptor
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class DefaultsDescriptor extends Descriptor
|
||||
{
|
||||
public DefaultsDescriptor(Resource xml, MetaData processor)
|
||||
public DefaultsDescriptor(Resource xml)
|
||||
{
|
||||
super(xml, processor);
|
||||
super(xml);
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,6 @@ public class Descriptor
|
||||
protected ArrayList<String> _classNames = new ArrayList<String>();
|
||||
protected boolean _distributable;
|
||||
protected boolean _validating;
|
||||
protected MetaData _metaData;
|
||||
protected boolean _isOrdered = false;
|
||||
protected List<String> _ordering = new ArrayList<String>();
|
||||
|
||||
@ -75,7 +74,7 @@ public class Descriptor
|
||||
|
||||
try
|
||||
{
|
||||
Class jsp_page = Loader.loadClass(WebXmlConfiguration.class, "javax.servlet.jsp.JspPage");
|
||||
Class<?> jsp_page = Loader.loadClass(WebXmlConfiguration.class, "javax.servlet.jsp.JspPage");
|
||||
jsp20xsd = jsp_page.getResource("/javax/servlet/resources/jsp_2_0.xsd");
|
||||
jsp21xsd = jsp_page.getResource("/javax/servlet/resources/jsp_2_1.xsd");
|
||||
}
|
||||
@ -131,10 +130,9 @@ public class Descriptor
|
||||
|
||||
|
||||
|
||||
public Descriptor (Resource xml, MetaData md)
|
||||
public Descriptor (Resource xml)
|
||||
{
|
||||
_xml = xml;
|
||||
_metaData = md;
|
||||
}
|
||||
|
||||
public void parse ()
|
||||
@ -180,11 +178,6 @@ public class Descriptor
|
||||
return _xml;
|
||||
}
|
||||
|
||||
public MetaData getMetaData()
|
||||
{
|
||||
return _metaData;
|
||||
}
|
||||
|
||||
public void processVersion ()
|
||||
{
|
||||
String version = _root.getAttribute("version", "DTD");
|
||||
|
@ -20,5 +20,5 @@ package org.eclipse.jetty.webapp;
|
||||
*/
|
||||
public interface DescriptorProcessor
|
||||
{
|
||||
public void process (Descriptor descriptor) throws Exception;
|
||||
public void process (WebAppContext context, Descriptor descriptor) throws Exception;
|
||||
}
|
||||
|
@ -34,12 +34,8 @@ public class FragmentConfiguration implements Configuration
|
||||
if (!context.isConfigurationDiscovered())
|
||||
return;
|
||||
|
||||
MetaData metaData = (MetaData)context.getAttribute(MetaData.METADATA);
|
||||
if (metaData == null)
|
||||
throw new IllegalStateException("No metadata");
|
||||
|
||||
//find all web-fragment.xmls
|
||||
findWebFragments(context, metaData);
|
||||
findWebFragments(context, context.getMetaData());
|
||||
|
||||
}
|
||||
|
||||
@ -48,12 +44,8 @@ public class FragmentConfiguration implements Configuration
|
||||
if (!context.isConfigurationDiscovered())
|
||||
return;
|
||||
|
||||
MetaData metaData = (MetaData)context.getAttribute(MetaData.METADATA);
|
||||
if (metaData == null)
|
||||
throw new IllegalStateException("No metadata");
|
||||
|
||||
//order the fragments
|
||||
metaData.orderFragments();
|
||||
context.getMetaData().orderFragments();
|
||||
}
|
||||
|
||||
public void deconfigure(WebAppContext context) throws Exception
|
||||
|
@ -41,10 +41,10 @@ public class FragmentDescriptor extends Descriptor
|
||||
protected String _name;
|
||||
|
||||
|
||||
public FragmentDescriptor (Resource xml, MetaData processor)
|
||||
public FragmentDescriptor (Resource xml)
|
||||
throws Exception
|
||||
{
|
||||
super (xml, processor);
|
||||
super (xml);
|
||||
}
|
||||
|
||||
public String getName ()
|
||||
@ -52,6 +52,7 @@ public class FragmentDescriptor extends Descriptor
|
||||
return _name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parse ()
|
||||
throws Exception
|
||||
{
|
||||
@ -71,6 +72,7 @@ public class FragmentDescriptor extends Descriptor
|
||||
_name = tmp;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void processOrdering ()
|
||||
{
|
||||
//Process a fragment jar's web-fragment.xml<ordering> elements
|
||||
|
@ -29,10 +29,10 @@ import org.eclipse.jetty.xml.XmlParser;
|
||||
*/
|
||||
public abstract class IterativeDescriptorProcessor implements DescriptorProcessor
|
||||
{
|
||||
public static final Class[] __signature = new Class[]{Descriptor.class, XmlParser.Node.class};
|
||||
public static final Class<?>[] __signature = new Class[]{WebAppContext.class, Descriptor.class, XmlParser.Node.class};
|
||||
protected Map<String, Method> _visitors = new HashMap<String, Method>();
|
||||
public abstract void start(Descriptor descriptor);
|
||||
public abstract void end(Descriptor descriptor);
|
||||
public abstract void start(WebAppContext context, Descriptor descriptor);
|
||||
public abstract void end(WebAppContext context, Descriptor descriptor);
|
||||
|
||||
/**
|
||||
* Register a method to be called back when visiting the node with the given name.
|
||||
@ -50,13 +50,13 @@ public abstract class IterativeDescriptorProcessor implements DescriptorProcesso
|
||||
/**
|
||||
* @see org.eclipse.jetty.webapp.DescriptorProcessor#process(org.eclipse.jetty.webapp.Descriptor)
|
||||
*/
|
||||
public void process(Descriptor descriptor)
|
||||
public void process(WebAppContext context, Descriptor descriptor)
|
||||
throws Exception
|
||||
{
|
||||
if (descriptor == null)
|
||||
return;
|
||||
|
||||
start(descriptor);
|
||||
start(context,descriptor);
|
||||
|
||||
XmlParser.Node root = descriptor.getRoot();
|
||||
Iterator iter = root.iterator();
|
||||
@ -66,19 +66,19 @@ public abstract class IterativeDescriptorProcessor implements DescriptorProcesso
|
||||
Object o = iter.next();
|
||||
if (!(o instanceof XmlParser.Node)) continue;
|
||||
node = (XmlParser.Node) o;
|
||||
visit(descriptor, node);
|
||||
visit(context, descriptor, node);
|
||||
}
|
||||
|
||||
end(descriptor);
|
||||
end(context,descriptor);
|
||||
}
|
||||
|
||||
|
||||
protected void visit (final Descriptor descriptor, final XmlParser.Node node)
|
||||
protected void visit (WebAppContext context, Descriptor descriptor, XmlParser.Node node)
|
||||
throws Exception
|
||||
{
|
||||
String name = node.getTag();
|
||||
Method m = _visitors.get(name);
|
||||
if (m != null)
|
||||
m.invoke(this, new Object[]{descriptor, node});
|
||||
m.invoke(this, new Object[]{context, descriptor, node});
|
||||
}
|
||||
}
|
||||
|
@ -36,8 +36,6 @@ import org.eclipse.jetty.util.resource.Resource;
|
||||
*/
|
||||
public class MetaData
|
||||
{
|
||||
public static final String METADATA = "org.eclipse.jetty.metaData";
|
||||
public static final String METADATA_COMPLETE = "org.eclipse.jetty.metadataComplete";
|
||||
public static final String WEBXML_MAJOR_VERSION = "org.eclipse.jetty.webXmlMajorVersion";
|
||||
public static final String WEBXML_MINOR_VERSION = "org.eclipse.jetty.webXmlMinorVersion";
|
||||
public static final String WEBXML_CLASSNAMES = "org.eclipse.jetty.webXmlClassNames";
|
||||
@ -50,6 +48,7 @@ public class MetaData
|
||||
protected Descriptor _webDefaultsRoot;
|
||||
protected Descriptor _webXmlRoot;
|
||||
protected Descriptor _webOverrideRoot;
|
||||
protected boolean _metaDataComplete;
|
||||
protected List<DiscoveredAnnotation> _annotations = new ArrayList<DiscoveredAnnotation>();
|
||||
protected List<DescriptorProcessor> _descriptorProcessors = new ArrayList<DescriptorProcessor>();
|
||||
protected List<FragmentDescriptor> _webFragmentRoots = new ArrayList<FragmentDescriptor>();
|
||||
@ -137,6 +136,7 @@ public class MetaData
|
||||
* Order the list of jars in WEB-INF/lib according to the ordering declarations in the descriptors
|
||||
* @see org.eclipse.jetty.webapp.MetaData.Ordering#order(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public List<Resource> order(List<Resource> jars)
|
||||
{
|
||||
List<Resource> orderedList = new ArrayList<Resource>();
|
||||
@ -144,7 +144,7 @@ public class MetaData
|
||||
|
||||
//1. put everything into the list of named others, and take the named ones out of there,
|
||||
//assuming we will want to use the <other> clause
|
||||
Map<String,FragmentDescriptor> others = new HashMap(getNamedFragments());
|
||||
Map<String,FragmentDescriptor> others = new HashMap<String,FragmentDescriptor>(getNamedFragments());
|
||||
|
||||
//2. for each name, take out of the list of others, add to tail of list
|
||||
int index = -1;
|
||||
@ -174,6 +174,7 @@ public class MetaData
|
||||
return orderedList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAbsolute()
|
||||
{
|
||||
return true;
|
||||
@ -193,6 +194,7 @@ public class MetaData
|
||||
_order.add(OTHER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOther ()
|
||||
{
|
||||
return _hasOther;
|
||||
@ -216,6 +218,7 @@ public class MetaData
|
||||
* in the various web-fragment.xml files.
|
||||
* @see org.eclipse.jetty.webapp.MetaData.Ordering#order(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public List<Resource> order(List<Resource> jars)
|
||||
{
|
||||
//for each jar, put it into the ordering according to the fragment ordering
|
||||
@ -285,11 +288,13 @@ public class MetaData
|
||||
return orderedList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAbsolute ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOther ()
|
||||
{
|
||||
return !_beforeOthers.isEmpty() || !_afterOthers.isEmpty();
|
||||
@ -314,7 +319,7 @@ public class MetaData
|
||||
{
|
||||
//Take a copy of the list so we can iterate over it and at the same time do random insertions
|
||||
boolean changes = false;
|
||||
List<Resource> iterable = new ArrayList(list);
|
||||
List<Resource> iterable = new ArrayList<Resource>(list);
|
||||
Iterator<Resource> itor = iterable.iterator();
|
||||
|
||||
while (itor.hasNext())
|
||||
@ -554,9 +559,7 @@ public class MetaData
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public MetaData (WebAppContext context) throws ClassNotFoundException
|
||||
public MetaData (WebAppContext context)
|
||||
{
|
||||
_context = context;
|
||||
|
||||
@ -572,7 +575,7 @@ public class MetaData
|
||||
public void setDefaults (Resource webDefaults)
|
||||
throws Exception
|
||||
{
|
||||
_webDefaultsRoot = new DefaultsDescriptor(webDefaults, this);
|
||||
_webDefaultsRoot = new DefaultsDescriptor(webDefaults);
|
||||
_webDefaultsRoot.parse();
|
||||
if (_webDefaultsRoot.isOrdered())
|
||||
{
|
||||
@ -593,12 +596,9 @@ public class MetaData
|
||||
public void setWebXml (Resource webXml)
|
||||
throws Exception
|
||||
{
|
||||
_webXmlRoot = new Descriptor(webXml, this);
|
||||
_webXmlRoot = new Descriptor(webXml);
|
||||
_webXmlRoot.parse();
|
||||
if (_webXmlRoot.getMetaDataComplete() == Descriptor.MetaDataComplete.True)
|
||||
_context.setAttribute(METADATA_COMPLETE, Boolean.TRUE);
|
||||
else
|
||||
_context.setAttribute(METADATA_COMPLETE, Boolean.FALSE);
|
||||
_metaDataComplete=_webXmlRoot.getMetaDataComplete() == Descriptor.MetaDataComplete.True;
|
||||
|
||||
_context.setAttribute(WEBXML_CLASSNAMES, _webXmlRoot.getClassNames());
|
||||
|
||||
@ -621,13 +621,21 @@ public class MetaData
|
||||
public void setOverride (Resource override)
|
||||
throws Exception
|
||||
{
|
||||
_webOverrideRoot = new OverrideDescriptor(override, this);
|
||||
_webOverrideRoot = new OverrideDescriptor(override);
|
||||
_webOverrideRoot.setValidating(false);
|
||||
_webOverrideRoot.parse();
|
||||
if (_webOverrideRoot.getMetaDataComplete() == Descriptor.MetaDataComplete.True)
|
||||
_context.setAttribute(METADATA_COMPLETE, Boolean.TRUE);
|
||||
else if (_webOverrideRoot.getMetaDataComplete() == Descriptor.MetaDataComplete.False)
|
||||
_context.setAttribute(METADATA_COMPLETE, Boolean.FALSE);
|
||||
|
||||
switch(_webOverrideRoot.getMetaDataComplete())
|
||||
{
|
||||
case True:
|
||||
_metaDataComplete=true;
|
||||
break;
|
||||
case False:
|
||||
_metaDataComplete=true;
|
||||
break;
|
||||
case NotSet:
|
||||
break;
|
||||
}
|
||||
|
||||
if (_webOverrideRoot.isOrdered())
|
||||
{
|
||||
@ -656,12 +664,11 @@ public class MetaData
|
||||
public void addFragment (Resource jarResource, Resource xmlResource)
|
||||
throws Exception
|
||||
{
|
||||
Boolean metaComplete = (Boolean)_context.getAttribute(METADATA_COMPLETE);
|
||||
if (metaComplete != null && metaComplete.booleanValue())
|
||||
if (_metaDataComplete)
|
||||
return; //do not process anything else if web.xml/web-override.xml set metadata-complete
|
||||
|
||||
//Metadata-complete is not set, or there is no web.xml
|
||||
FragmentDescriptor descriptor = new FragmentDescriptor(xmlResource, this);
|
||||
FragmentDescriptor descriptor = new FragmentDescriptor(xmlResource);
|
||||
_webFragmentResourceMap.put(jarResource, descriptor);
|
||||
_webFragmentRoots.add(descriptor);
|
||||
|
||||
@ -732,7 +739,7 @@ public class MetaData
|
||||
* Resolve all servlet/filter/listener metadata from all sources: descriptors and annotations.
|
||||
*
|
||||
*/
|
||||
public void resolve ()
|
||||
public void resolve (WebAppContext context)
|
||||
throws Exception
|
||||
{
|
||||
//TODO - apply all descriptors and annotations in order:
|
||||
@ -747,9 +754,9 @@ public class MetaData
|
||||
|
||||
for (DescriptorProcessor p:_descriptorProcessors)
|
||||
{
|
||||
p.process(getWebDefault());
|
||||
p.process(getWebXml());
|
||||
p.process(getOverrideWeb());
|
||||
p.process(context,getWebDefault());
|
||||
p.process(context,getWebXml());
|
||||
p.process(context,getOverrideWeb());
|
||||
}
|
||||
|
||||
for (DiscoveredAnnotation a:_annotations)
|
||||
@ -764,7 +771,7 @@ public class MetaData
|
||||
{
|
||||
for (DescriptorProcessor p:_descriptorProcessors)
|
||||
{
|
||||
p.process(fd);
|
||||
p.process(context,fd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -817,7 +824,8 @@ public class MetaData
|
||||
|
||||
public List<Resource> getOrderedResources ()
|
||||
{
|
||||
return _orderedResources;
|
||||
return _orderedResources == null? new ArrayList<Resource>(): _orderedResources;
|
||||
//return _orderedResources;
|
||||
}
|
||||
|
||||
public List<FragmentDescriptor> getOrderedFragments ()
|
||||
@ -908,4 +916,9 @@ public class MetaData
|
||||
OriginInfo x = new OriginInfo (name, Origin.Annotation);
|
||||
_origins.put(name, x);
|
||||
}
|
||||
|
||||
public boolean isMetaDataComplete()
|
||||
{
|
||||
return _metaDataComplete;
|
||||
}
|
||||
}
|
||||
|
@ -22,8 +22,8 @@ import org.eclipse.jetty.util.resource.Resource;
|
||||
*/
|
||||
public class OverrideDescriptor extends Descriptor
|
||||
{
|
||||
public OverrideDescriptor(Resource xml, MetaData processor)
|
||||
public OverrideDescriptor(Resource xml)
|
||||
{
|
||||
super(xml, processor);
|
||||
super(xml);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -135,6 +135,8 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
||||
private boolean _configurationClassesSet=false;
|
||||
private boolean _configurationsSet=false;
|
||||
|
||||
private final MetaData _metadata;
|
||||
|
||||
public static WebAppContext getCurrentWebAppContext()
|
||||
{
|
||||
ContextHandler.Context context=ContextHandler.getCurrentContext();
|
||||
@ -153,6 +155,8 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
||||
super(SESSIONS|SECURITY);
|
||||
_scontext=new Context();
|
||||
setErrorHandler(new ErrorPageErrorHandler());
|
||||
//Make a new MetaData to hold descriptor and annotation metadata
|
||||
_metadata = new MetaData(this);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -167,6 +171,8 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
||||
setContextPath(contextPath);
|
||||
setWar(webApp);
|
||||
setErrorHandler(new ErrorPageErrorHandler());
|
||||
//Make a new MetaData to hold descriptor and annotation metadata
|
||||
_metadata = new MetaData(this);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -181,6 +187,8 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
||||
_scontext=new Context();
|
||||
setWar(webApp);
|
||||
setErrorHandler(new ErrorPageErrorHandler());
|
||||
//Make a new MetaData to hold descriptor and annotation metadata
|
||||
_metadata = new MetaData(this);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -191,6 +199,8 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
||||
super(null,sessionHandler,securityHandler,servletHandler,errorHandler);
|
||||
_scontext=new Context();
|
||||
setErrorHandler(errorHandler!=null?errorHandler:new ErrorPageErrorHandler());
|
||||
//Make a new MetaData to hold descriptor and annotation metadata
|
||||
_metadata = new MetaData(this);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -370,11 +380,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Prepare for configuration
|
||||
//Make a new MetaData to hold descriptor and annotation metadata
|
||||
MetaData metadata = new MetaData(this);
|
||||
setAttribute(MetaData.METADATA, metadata);
|
||||
|
||||
for (int i=0;i<_configurations.length;i++)
|
||||
_configurations[i].preConfigure(this);
|
||||
@ -996,7 +1002,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
||||
_configurations[i].configure(this);
|
||||
|
||||
//resolve the metadata
|
||||
((MetaData)getAttribute(MetaData.METADATA)).resolve();
|
||||
_metadata.resolve(this);
|
||||
|
||||
super.startContext();
|
||||
}
|
||||
@ -1026,4 +1032,10 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public MetaData getMetaData()
|
||||
{
|
||||
return _metadata;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,12 +40,6 @@ public class WebXmlConfiguration implements Configuration
|
||||
*/
|
||||
public void preConfigure (WebAppContext context) throws Exception
|
||||
{
|
||||
|
||||
MetaData metaData = (MetaData)context.getAttribute(MetaData.METADATA);
|
||||
if (metaData == null)
|
||||
throw new IllegalStateException("No metadata");
|
||||
|
||||
|
||||
//parse webdefault.xml
|
||||
String defaultsDescriptor = context.getDefaultsDescriptor();
|
||||
if (defaultsDescriptor != null && defaultsDescriptor.length() > 0)
|
||||
@ -53,7 +47,7 @@ public class WebXmlConfiguration implements Configuration
|
||||
Resource dftResource = Resource.newSystemResource(defaultsDescriptor);
|
||||
if (dftResource == null)
|
||||
dftResource = context.newResource(defaultsDescriptor);
|
||||
metaData.setDefaults (dftResource);
|
||||
context.getMetaData().setDefaults (dftResource);
|
||||
|
||||
}
|
||||
|
||||
@ -61,7 +55,7 @@ public class WebXmlConfiguration implements Configuration
|
||||
Resource webxml = findWebXml(context);
|
||||
if (webxml != null)
|
||||
{
|
||||
metaData.setWebXml(webxml);
|
||||
context.getMetaData().setWebXml(webxml);
|
||||
}
|
||||
|
||||
//parse but don't process override-web.xml
|
||||
@ -71,7 +65,7 @@ public class WebXmlConfiguration implements Configuration
|
||||
Resource orideResource = Resource.newSystemResource(overrideDescriptor);
|
||||
if (orideResource == null)
|
||||
orideResource = context.newResource(overrideDescriptor);
|
||||
metaData.setOverride(orideResource);
|
||||
context.getMetaData().setOverride(orideResource);
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,28 +83,24 @@ public class WebXmlConfiguration implements Configuration
|
||||
return;
|
||||
}
|
||||
|
||||
MetaData metaData = (MetaData)context.getAttribute(MetaData.METADATA);
|
||||
if (metaData == null)
|
||||
throw new IllegalStateException("No metadata");
|
||||
|
||||
metaData.addDescriptorProcessor(new StandardDescriptorProcessor());
|
||||
context.getMetaData().addDescriptorProcessor(new StandardDescriptorProcessor());
|
||||
|
||||
/*
|
||||
StandardDescriptorProcessor descriptorProcessor = (StandardDescriptorProcessor)context.getAttribute(StandardDescriptorProcessor.STANDARD_PROCESSOR);
|
||||
if (descriptorProcessor == null)
|
||||
{
|
||||
descriptorProcessor = new StandardDescriptorProcessor(metaData);
|
||||
descriptorProcessor = new StandardDescriptorProcessor(context.getMetaData());
|
||||
context.setAttribute(StandardDescriptorProcessor.STANDARD_PROCESSOR, descriptorProcessor);
|
||||
}
|
||||
|
||||
//process web-default.xml
|
||||
descriptorProcessor.process(metaData.getWebDefault());
|
||||
descriptorProcessor.process(context.getMetaData().getWebDefault());
|
||||
|
||||
//process web.xml
|
||||
descriptorProcessor.process(metaData.getWebXml());
|
||||
descriptorProcessor.process(context.getMetaData().getWebXml());
|
||||
|
||||
//process override-web.xml
|
||||
descriptorProcessor.process(metaData.getOverrideWeb());
|
||||
descriptorProcessor.process(context.getMetaData().getOverrideWeb());
|
||||
*/
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@ import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.webapp.MetaData.AbsoluteOrdering;
|
||||
import org.eclipse.jetty.webapp.MetaData.RelativeOrdering;
|
||||
|
||||
/**
|
||||
* OrderingTest
|
||||
@ -47,51 +46,52 @@ public class OrderingTest extends TestCase
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.resource.Resource#addPath(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Resource addPath(String path) throws IOException, MalformedURLException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.resource.Resource#delete()
|
||||
*/
|
||||
@Override
|
||||
public boolean delete() throws SecurityException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.resource.Resource#exists()
|
||||
*/
|
||||
@Override
|
||||
public boolean exists()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.resource.Resource#getFile()
|
||||
*/
|
||||
@Override
|
||||
public File getFile() throws IOException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.resource.Resource#getInputStream()
|
||||
*/
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.resource.Resource#getName()
|
||||
*/
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
@ -100,81 +100,80 @@ public class OrderingTest extends TestCase
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.resource.Resource#getOutputStream()
|
||||
*/
|
||||
@Override
|
||||
public OutputStream getOutputStream() throws IOException, SecurityException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.resource.Resource#getURL()
|
||||
*/
|
||||
@Override
|
||||
public URL getURL()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.resource.Resource#isContainedIn(org.eclipse.jetty.util.resource.Resource)
|
||||
*/
|
||||
@Override
|
||||
public boolean isContainedIn(Resource r) throws MalformedURLException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.resource.Resource#isDirectory()
|
||||
*/
|
||||
@Override
|
||||
public boolean isDirectory()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.resource.Resource#lastModified()
|
||||
*/
|
||||
@Override
|
||||
public long lastModified()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.resource.Resource#length()
|
||||
*/
|
||||
@Override
|
||||
public long length()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.resource.Resource#list()
|
||||
*/
|
||||
@Override
|
||||
public String[] list()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.resource.Resource#release()
|
||||
*/
|
||||
@Override
|
||||
public void release()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.resource.Resource#renameTo(org.eclipse.jetty.util.resource.Resource)
|
||||
*/
|
||||
@Override
|
||||
public boolean renameTo(Resource dest) throws SecurityException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -194,7 +193,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar1 = new TestResource("A");
|
||||
resources.add(jar1);
|
||||
TestResource r1 = new TestResource("A/web-fragment.xml");
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1, metaData);
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1);
|
||||
f1._name = "A";
|
||||
metaData._webFragmentNameMap.put(f1._name, f1);
|
||||
metaData._webFragmentResourceMap.put(jar1, f1);
|
||||
@ -206,7 +205,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar2 = new TestResource("B");
|
||||
resources.add(jar2);
|
||||
TestResource r2 = new TestResource("B/web-fragment.xml");
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2, metaData);
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2);
|
||||
f2._name="B";
|
||||
metaData._webFragmentNameMap.put(f2._name, f2);
|
||||
metaData._webFragmentResourceMap.put(jar2, f2);
|
||||
@ -217,7 +216,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar3 = new TestResource("C");
|
||||
resources.add(jar3);
|
||||
TestResource r3 = new TestResource("C/web-fragment.xml");
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3, metaData);
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3);
|
||||
f3._name="C";
|
||||
metaData._webFragmentNameMap.put(f3._name, f3);
|
||||
metaData._webFragmentResourceMap.put(jar3, f3);
|
||||
@ -228,7 +227,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar4 = new TestResource("D");
|
||||
resources.add(jar4);
|
||||
TestResource r4 = new TestResource("D/web-fragment.xml");
|
||||
FragmentDescriptor f4 = new FragmentDescriptor(r4, metaData);
|
||||
FragmentDescriptor f4 = new FragmentDescriptor(r4);
|
||||
f4._name="D";
|
||||
metaData._webFragmentNameMap.put(f4._name, f4);
|
||||
metaData._webFragmentResourceMap.put(jar4, f4);
|
||||
@ -239,7 +238,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar5 = new TestResource("E");
|
||||
resources.add(jar5);
|
||||
TestResource r5 = new TestResource("E/web-fragment.xml");
|
||||
FragmentDescriptor f5 = new FragmentDescriptor(r5, metaData);
|
||||
FragmentDescriptor f5 = new FragmentDescriptor(r5);
|
||||
f5._name="E";
|
||||
metaData._webFragmentNameMap.put(f5._name, f5);
|
||||
metaData._webFragmentResourceMap.put(jar5, f5);
|
||||
@ -250,7 +249,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar6 = new TestResource("F");
|
||||
resources.add(jar6);
|
||||
TestResource r6 = new TestResource("F/web-fragment.xml");
|
||||
FragmentDescriptor f6 = new FragmentDescriptor(r6, metaData);
|
||||
FragmentDescriptor f6 = new FragmentDescriptor(r6);
|
||||
f6._name="F";
|
||||
metaData._webFragmentNameMap.put(f6._name, f6);
|
||||
metaData._webFragmentResourceMap.put(jar6,f6);
|
||||
@ -288,7 +287,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar1 = new TestResource("plain");
|
||||
resources.add(jar1);
|
||||
TestResource r1 = new TestResource("plain/web-fragment.xml");
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1, metaData);
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1);
|
||||
f1._name = FragmentDescriptor.NAMELESS+"1";
|
||||
metaData._webFragmentNameMap.put(f1._name, f1);
|
||||
metaData._webFragmentResourceMap.put(jar1,f1);
|
||||
@ -300,7 +299,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar2 = new TestResource("B");
|
||||
resources.add(jar2);
|
||||
TestResource r2 = new TestResource("B/web-fragment.xml");
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2, metaData);
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2);
|
||||
f2._name="B";
|
||||
metaData._webFragmentNameMap.put(f2._name, f2);
|
||||
metaData._webFragmentResourceMap.put(jar2,f2);
|
||||
@ -311,7 +310,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar3 = new TestResource("C");
|
||||
resources.add(jar3);
|
||||
TestResource r3 = new TestResource("C/web-fragment.xml");
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3, metaData);
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3);
|
||||
f3._name="C";
|
||||
metaData._webFragmentNameMap.put(f3._name, f3);
|
||||
metaData._webFragmentResourceMap.put(jar3,f3);
|
||||
@ -322,7 +321,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar4 = new TestResource("D");
|
||||
resources.add(jar4);
|
||||
TestResource r4 = new TestResource("D/web-fragment.xml");
|
||||
FragmentDescriptor f4 = new FragmentDescriptor(r4, metaData);
|
||||
FragmentDescriptor f4 = new FragmentDescriptor(r4);
|
||||
f4._name="D";
|
||||
metaData._webFragmentNameMap.put(f4._name, f4);
|
||||
metaData._webFragmentResourceMap.put(jar4,f4);
|
||||
@ -333,7 +332,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar5 = new TestResource("E");
|
||||
resources.add(jar5);
|
||||
TestResource r5 = new TestResource("E/web-fragment.xml");
|
||||
FragmentDescriptor f5 = new FragmentDescriptor(r5, metaData);
|
||||
FragmentDescriptor f5 = new FragmentDescriptor(r5);
|
||||
f5._name="E";
|
||||
metaData._webFragmentNameMap.put(f5._name, f5);
|
||||
metaData._webFragmentResourceMap.put(jar5,f5);
|
||||
@ -344,7 +343,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar6 = new TestResource("F");
|
||||
resources.add(jar6);
|
||||
TestResource r6 = new TestResource("F/web-fragment.xml");
|
||||
FragmentDescriptor f6 = new FragmentDescriptor(r6, metaData);
|
||||
FragmentDescriptor f6 = new FragmentDescriptor(r6);
|
||||
f6._name="F";
|
||||
metaData._webFragmentNameMap.put(f6._name, f6);
|
||||
metaData._webFragmentResourceMap.put(jar6,f6);
|
||||
@ -389,7 +388,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar1 = new TestResource("A");
|
||||
resources.add(jar1);
|
||||
TestResource r1 = new TestResource("A/web-fragment.xml");
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1, metaData);
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1);
|
||||
f1._name = "A";
|
||||
metaData._webFragmentNameMap.put(f1._name, f1);
|
||||
metaData._webFragmentResourceMap.put(jar1, f1);
|
||||
@ -401,7 +400,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar2 = new TestResource("B");
|
||||
resources.add(jar2);
|
||||
TestResource r2 = new TestResource("B/web-fragment.xml");
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2, metaData);
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2);
|
||||
f2._name="B";
|
||||
metaData._webFragmentNameMap.put(f2._name, f2);
|
||||
metaData._webFragmentResourceMap.put(jar2, f2);
|
||||
@ -412,7 +411,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar3 = new TestResource("C");
|
||||
resources.add(jar3);
|
||||
TestResource r3 = new TestResource("C/web-fragment.xml");
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3, metaData);
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3);
|
||||
f3._name="C";
|
||||
metaData._webFragmentNameMap.put(f3._name, f3);
|
||||
metaData._webFragmentResourceMap.put(jar3,f3);
|
||||
@ -423,7 +422,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar4 = new TestResource("D");
|
||||
resources.add(jar4);
|
||||
TestResource r4 = new TestResource("D/web-fragment.xml");
|
||||
FragmentDescriptor f4 = new FragmentDescriptor(r4, metaData);
|
||||
FragmentDescriptor f4 = new FragmentDescriptor(r4);
|
||||
f4._name="D";
|
||||
metaData._webFragmentNameMap.put(f4._name, f4);
|
||||
metaData._webFragmentResourceMap.put(jar4, f4);
|
||||
@ -462,7 +461,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar1 = new TestResource("A");
|
||||
resources.add(jar1);
|
||||
TestResource r1 = new TestResource("A/web-fragment.xml");
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1, metaData);
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1);
|
||||
f1._name = "A";
|
||||
metaData._webFragmentNameMap.put(f1._name, f1);
|
||||
metaData._webFragmentResourceMap.put(jar1, f1);
|
||||
@ -474,7 +473,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar2 = new TestResource("B");
|
||||
resources.add(jar2);
|
||||
TestResource r2 = new TestResource("B/web-fragment.xml");
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2, metaData);
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2);
|
||||
f2._name="B";
|
||||
metaData._webFragmentNameMap.put(f2._name, f2);
|
||||
metaData._webFragmentResourceMap.put(jar2,f2);
|
||||
@ -486,7 +485,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar3 = new TestResource("C");
|
||||
resources.add(jar3);
|
||||
TestResource r3 = new TestResource("C/web-fragment.xml");
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3, metaData);
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3);
|
||||
f3._name="C";
|
||||
metaData._webFragmentNameMap.put(f3._name, f3);
|
||||
metaData._webFragmentResourceMap.put(jar3,f3);
|
||||
@ -520,7 +519,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar1 = new TestResource("A");
|
||||
resources.add(jar1);
|
||||
TestResource r1 = new TestResource("A/web-fragment.xml");
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1, metaData);
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1);
|
||||
f1._name = "A";
|
||||
metaData._webFragmentNameMap.put(f1._name, f1);
|
||||
metaData._webFragmentResourceMap.put(jar1, f1);
|
||||
@ -532,7 +531,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar2 = new TestResource("B");
|
||||
resources.add(jar2);
|
||||
TestResource r2 = new TestResource("B/web-fragment.xml");
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2, metaData);
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2);
|
||||
f2._name="B";
|
||||
metaData._webFragmentNameMap.put(f2._name, f2);
|
||||
metaData._webFragmentResourceMap.put(jar2, f2);
|
||||
@ -566,7 +565,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar1 = new TestResource("A");
|
||||
resources.add(jar1);
|
||||
TestResource r1 = new TestResource("A/web-fragment.xml");
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1, metaData);
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1);
|
||||
f1._name = "A";
|
||||
metaData._webFragmentNameMap.put(f1._name, f1);
|
||||
metaData._webFragmentResourceMap.put(jar1,f1);
|
||||
@ -578,7 +577,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar2 = new TestResource("B");
|
||||
resources.add(jar2);
|
||||
TestResource r2 = new TestResource("B/web-fragment.xml");
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2, metaData);
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2);
|
||||
f2._name="B";
|
||||
metaData._webFragmentNameMap.put(f2._name, f2);
|
||||
metaData._webFragmentResourceMap.put(jar2,f2);
|
||||
@ -590,7 +589,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar3 = new TestResource("C");
|
||||
resources.add(jar3);
|
||||
TestResource r3 = new TestResource("C/web-fragment.xml");
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3, metaData);
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3);
|
||||
f3._name="C";
|
||||
metaData._webFragmentNameMap.put(f3._name, f3);
|
||||
metaData._webFragmentResourceMap.put(jar3,f3);
|
||||
@ -631,7 +630,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar1 = new TestResource("A");
|
||||
resources.add(jar1);
|
||||
TestResource r1 = new TestResource("A/web-fragment.xml");
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1, metaData);
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1);
|
||||
f1._name = "A";
|
||||
metaData._webFragmentNameMap.put(f1._name, f1);
|
||||
metaData._webFragmentResourceMap.put(jar1,f1);
|
||||
@ -639,7 +638,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar2 = new TestResource("B");
|
||||
resources.add(jar2);
|
||||
TestResource r2 = new TestResource("B/web-fragment.xml");
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2, metaData);
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2);
|
||||
f2._name="B";
|
||||
metaData._webFragmentNameMap.put(f2._name, f2);
|
||||
metaData._webFragmentResourceMap.put(jar2, f2);
|
||||
@ -647,7 +646,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar3 = new TestResource("C");
|
||||
resources.add(jar3);
|
||||
TestResource r3 = new TestResource("C/web-fragment.xml");
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3, metaData);
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3);
|
||||
f3._name="C";
|
||||
metaData._webFragmentNameMap.put(f3._name, f3);
|
||||
metaData._webFragmentResourceMap.put(jar3, f3);
|
||||
@ -655,7 +654,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar4 = new TestResource("D");
|
||||
resources.add(jar4);
|
||||
TestResource r4 = new TestResource("D/web-fragment.xml");
|
||||
FragmentDescriptor f4 = new FragmentDescriptor((Resource)null, metaData);
|
||||
FragmentDescriptor f4 = new FragmentDescriptor((Resource)null);
|
||||
f4._name="D";
|
||||
metaData._webFragmentNameMap.put(f4._name, f4);
|
||||
metaData._webFragmentResourceMap.put(jar4, f4);
|
||||
@ -663,7 +662,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar5 = new TestResource("E");
|
||||
resources.add(jar5);
|
||||
TestResource r5 = new TestResource("E/web-fragment.xml");
|
||||
FragmentDescriptor f5 = new FragmentDescriptor((Resource)null, metaData);
|
||||
FragmentDescriptor f5 = new FragmentDescriptor((Resource)null);
|
||||
f5._name="E";
|
||||
metaData._webFragmentNameMap.put(f5._name, f5);
|
||||
metaData._webFragmentResourceMap.put(jar5, f5);
|
||||
@ -671,7 +670,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar6 = new TestResource("plain");
|
||||
resources.add(jar6);
|
||||
TestResource r6 = new TestResource ("plain/web-fragment.xml");
|
||||
FragmentDescriptor f6 = new FragmentDescriptor((Resource)null, metaData);
|
||||
FragmentDescriptor f6 = new FragmentDescriptor((Resource)null);
|
||||
f6._name=FragmentDescriptor.NAMELESS+"1";
|
||||
metaData._webFragmentNameMap.put(f6._name, f6);
|
||||
metaData._webFragmentResourceMap.put(jar6, f6);
|
||||
@ -704,7 +703,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar1 = new TestResource("A");
|
||||
resources.add(jar1);
|
||||
TestResource r1 = new TestResource("A/web-fragment.xml");
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1, metaData);
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1);
|
||||
f1._name = "A";
|
||||
metaData._webFragmentNameMap.put(f1._name, f1);
|
||||
metaData._webFragmentResourceMap.put(jar1,f1);
|
||||
@ -712,7 +711,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar2 = new TestResource("B");
|
||||
resources.add(jar2);
|
||||
TestResource r2 = new TestResource("B/web-fragment.xml");
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2, metaData);
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2);
|
||||
f2._name="B";
|
||||
metaData._webFragmentNameMap.put(f2._name, f2);
|
||||
metaData._webFragmentResourceMap.put(jar2,f2);
|
||||
@ -720,7 +719,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar3 = new TestResource("C");
|
||||
resources.add(jar3);
|
||||
TestResource r3 = new TestResource("C/web-fragment.xml");
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3, metaData);
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3);
|
||||
f3._name="C";
|
||||
metaData._webFragmentNameMap.put(f3._name, f3);
|
||||
metaData._webFragmentResourceMap.put(jar3,f3);
|
||||
@ -728,7 +727,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar4 = new TestResource("D");
|
||||
resources.add(jar4);
|
||||
TestResource r4 = new TestResource("D/web-fragment.xml");
|
||||
FragmentDescriptor f4 = new FragmentDescriptor(r4, metaData);
|
||||
FragmentDescriptor f4 = new FragmentDescriptor(r4);
|
||||
f4._name="D";
|
||||
metaData._webFragmentNameMap.put(f4._name, f4);
|
||||
metaData._webFragmentResourceMap.put(jar4,f4);
|
||||
@ -736,7 +735,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar5 = new TestResource("E");
|
||||
resources.add(jar5);
|
||||
TestResource r5 = new TestResource("E/web-fragment.xml");
|
||||
FragmentDescriptor f5 = new FragmentDescriptor(r5, metaData);
|
||||
FragmentDescriptor f5 = new FragmentDescriptor(r5);
|
||||
f5._name="E";
|
||||
metaData._webFragmentNameMap.put(f5._name, f5);
|
||||
metaData._webFragmentResourceMap.put(jar5,f5);
|
||||
@ -744,7 +743,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar6 = new TestResource("plain");
|
||||
resources.add(jar6);
|
||||
TestResource r6 = new TestResource("plain/web-fragment.xml");
|
||||
FragmentDescriptor f6 = new FragmentDescriptor(r6, metaData);
|
||||
FragmentDescriptor f6 = new FragmentDescriptor(r6);
|
||||
f6._name=FragmentDescriptor.NAMELESS+"1";
|
||||
metaData._webFragmentNameMap.put(f6._name, f6);
|
||||
metaData._webFragmentResourceMap.put(jar6,f6);
|
||||
@ -791,7 +790,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar1 = new TestResource("A");
|
||||
resources.add(jar1);
|
||||
TestResource r1 = new TestResource("A/web-fragment.xml");
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1, metaData);
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1);
|
||||
f1._name = "A";
|
||||
metaData._webFragmentNameMap.put(f1._name, f1);
|
||||
metaData._webFragmentResourceMap.put(jar1, f1);
|
||||
@ -803,7 +802,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar2 = new TestResource("B");
|
||||
resources.add(jar2);
|
||||
TestResource r2 = new TestResource("B/web-fragment.xml");
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2, metaData);
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2);
|
||||
f2._name="B";
|
||||
metaData._webFragmentNameMap.put(f2._name, f2);
|
||||
metaData._webFragmentResourceMap.put(jar2,f2);
|
||||
@ -815,7 +814,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar3 = new TestResource("C");
|
||||
resources.add(jar3);
|
||||
TestResource r3 = new TestResource("C/web-fragment.xml");
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3, metaData);
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3);
|
||||
f3._name="C";
|
||||
metaData._webFragmentNameMap.put(f3._name, f3);
|
||||
metaData._webFragmentResourceMap.put(jar3,f3);
|
||||
@ -861,7 +860,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar1 = new TestResource("A");
|
||||
resources.add(jar1);
|
||||
TestResource r1 = new TestResource("A/web-fragment.xml");
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1, metaData);
|
||||
FragmentDescriptor f1 = new FragmentDescriptor(r1);
|
||||
f1._name = "A";
|
||||
metaData._webFragmentNameMap.put(f1._name, f1);
|
||||
metaData._webFragmentResourceMap.put(jar1,f1);
|
||||
@ -869,7 +868,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar2 = new TestResource("B");
|
||||
resources.add(jar2);
|
||||
TestResource r2 = new TestResource("B/web-fragment.xml");
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2, metaData);
|
||||
FragmentDescriptor f2 = new FragmentDescriptor(r2);
|
||||
f2._name="B";
|
||||
metaData._webFragmentNameMap.put(f2._name, f2);
|
||||
metaData._webFragmentResourceMap.put(jar2, f2);
|
||||
@ -877,7 +876,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar3 = new TestResource("C");
|
||||
resources.add(jar3);
|
||||
TestResource r3 = new TestResource("C/web-fragment.xml");
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3, metaData);
|
||||
FragmentDescriptor f3 = new FragmentDescriptor(r3);
|
||||
f3._name="C";
|
||||
metaData._webFragmentNameMap.put(f3._name, f3);
|
||||
metaData._webFragmentResourceMap.put(jar3, f3);
|
||||
@ -885,7 +884,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar4 = new TestResource("D");
|
||||
resources.add(jar4);
|
||||
TestResource r4 = new TestResource("D/web-fragment.xml");
|
||||
FragmentDescriptor f4 = new FragmentDescriptor((Resource)null, metaData);
|
||||
FragmentDescriptor f4 = new FragmentDescriptor((Resource)null);
|
||||
f4._name="D";
|
||||
metaData._webFragmentNameMap.put(f4._name, f4);
|
||||
metaData._webFragmentResourceMap.put(jar4, f4);
|
||||
@ -893,7 +892,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar5 = new TestResource("E");
|
||||
resources.add(jar5);
|
||||
TestResource r5 = new TestResource("E/web-fragment.xml");
|
||||
FragmentDescriptor f5 = new FragmentDescriptor((Resource)null, metaData);
|
||||
FragmentDescriptor f5 = new FragmentDescriptor((Resource)null);
|
||||
f5._name="E";
|
||||
metaData._webFragmentNameMap.put(f5._name, f5);
|
||||
metaData._webFragmentResourceMap.put(jar5, f5);
|
||||
@ -901,7 +900,7 @@ public class OrderingTest extends TestCase
|
||||
TestResource jar6 = new TestResource("plain");
|
||||
resources.add(jar6);
|
||||
TestResource r6 = new TestResource("plain/web-fragment.xml");
|
||||
FragmentDescriptor f6 = new FragmentDescriptor((Resource)null, metaData);
|
||||
FragmentDescriptor f6 = new FragmentDescriptor((Resource)null);
|
||||
f6._name=FragmentDescriptor.NAMELESS+"1";
|
||||
metaData._webFragmentNameMap.put(f6._name, f6);
|
||||
metaData._webFragmentResourceMap.put(jar6, f6);
|
||||
|
@ -741,14 +741,15 @@ public class XmlParser
|
||||
* @param tag The tag of the nodes.
|
||||
* @return Iterator over all child nodes with the specified tag.
|
||||
*/
|
||||
public Iterator iterator(final String tag)
|
||||
public Iterator<Node> iterator(final String tag)
|
||||
{
|
||||
return new Iterator()
|
||||
return new Iterator<Node>()
|
||||
{
|
||||
int c = 0;
|
||||
Node _node;
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
@Override
|
||||
public boolean hasNext()
|
||||
{
|
||||
if (_node != null)
|
||||
@ -771,7 +772,8 @@ public class XmlParser
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
public Object next()
|
||||
@Override
|
||||
public Node next()
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -787,6 +789,7 @@ public class XmlParser
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
@Override
|
||||
public void remove()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported");
|
||||
|
@ -18,7 +18,6 @@ import java.lang.management.ManagementFactory;
|
||||
|
||||
import org.eclipse.jetty.jmx.MBeanContainer;
|
||||
import org.eclipse.jetty.security.HashLoginService;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.NCSARequestLog;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
|
Loading…
x
Reference in New Issue
Block a user