diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java index cf340b8ccac..c0a742d2e14 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationConfiguration.java @@ -760,11 +760,12 @@ public class AnnotationConfiguration extends AbstractConfiguration if (isFromContainerClassPath(context, sci)) return false; - List orderedJars = context.getMetaData().getOrderedWebInfJars(); - //If no ordering, nothing is excluded if (context.getMetaData().getOrdering() == null) return false; + + + List orderedJars = context.getMetaData().getOrderedWebInfJars(); //there is an ordering, but there are no jars resulting from the ordering, everything excluded if (orderedJars.isEmpty()) @@ -1007,10 +1008,12 @@ public class AnnotationConfiguration extends AbstractConfiguration //they have to participate in the ordering ArrayList webInfUris = new ArrayList(); - List jars = context.getMetaData().getOrderedWebInfJars(); - - //No ordering just use the jars in any order - if (jars == null || jars.isEmpty()) + List jars = null; + + if (context.getMetaData().getOrdering() != null) + jars = context.getMetaData().getOrderedWebInfJars(); + else + //No ordering just use the jars in any order jars = context.getMetaData().getWebInfJars(); _webInfLibStats = new CounterStatistic(); diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationConfiguration.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationConfiguration.java index 7ceca896c17..254a853892d 100644 --- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationConfiguration.java +++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationConfiguration.java @@ -69,8 +69,8 @@ public class AnnotationConfiguration extends org.eclipse.jetty.annotations.Annot public AnnotationConfiguration() { - System.err.println("Constructed osgi.AnnotationConfiguration"); } + /** * This parser scans the bundles using the OSGi APIs instead of assuming a jar. */ diff --git a/jetty-server/src/main/config/modules/debug.mod b/jetty-server/src/main/config/modules/debug.mod index f740ea2c762..5acce7aa904 100644 --- a/jetty-server/src/main/config/modules/debug.mod +++ b/jetty-server/src/main/config/modules/debug.mod @@ -5,5 +5,8 @@ [depend] server +[files] +logs/ + [xml] etc/jetty-debug.xml diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/FragmentConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/FragmentConfiguration.java index 7bd19c7e3c4..661446f4d33 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/FragmentConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/FragmentConfiguration.java @@ -45,15 +45,6 @@ public class FragmentConfiguration extends AbstractConfiguration } - @Override - public void configure(WebAppContext context) throws Exception - { - if (!context.isConfigurationDiscovered()) - return; - - //order the fragments - context.getMetaData().orderFragments(); - } @Override public void postConfigure(WebAppContext context) throws Exception diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java index 3fde5536e15..c5f073cccb7 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaData.java @@ -59,8 +59,8 @@ public class MetaData protected final Map> _annotations = new HashMap>(); protected final List _webInfClasses = new ArrayList(); protected final List _webInfJars = new ArrayList(); - protected final List _orderedWebInfJars = new ArrayList(); protected final List _orderedContainerResources = new ArrayList(); + protected final List _orderedWebInfResources = new ArrayList(); protected Ordering _ordering;//can be set to RelativeOrdering by web-default.xml, web.xml, web-override.xml protected boolean allowDuplicateFragmentNames = false; @@ -158,7 +158,7 @@ public class MetaData _webFragmentResourceMap.clear(); _annotations.clear(); _webInfJars.clear(); - _orderedWebInfJars.clear(); + _orderedWebInfResources.clear(); _orderedContainerResources.clear(); _ordering = null; allowDuplicateFragmentNames = false; @@ -171,17 +171,21 @@ public class MetaData _webDefaultsRoot.parse(); if (_webDefaultsRoot.isOrdered()) { - if (_ordering == null) - _ordering = new Ordering.AbsoluteOrdering(this); + Ordering ordering = getOrdering(); + if (ordering == null) + ordering = new Ordering.AbsoluteOrdering(this); List order = _webDefaultsRoot.getOrdering(); for (String s:order) { if (s.equalsIgnoreCase("others")) - ((Ordering.AbsoluteOrdering)_ordering).addOthers(); + ((Ordering.AbsoluteOrdering)ordering).addOthers(); else - ((Ordering.AbsoluteOrdering)_ordering).add(s); + ((Ordering.AbsoluteOrdering)ordering).add(s); } + + //(re)set the ordering to cause webinf jar order to be recalculated + setOrdering(ordering); } } @@ -194,17 +198,21 @@ public class MetaData if (_webXmlRoot.isOrdered()) { - if (_ordering == null) - _ordering = new Ordering.AbsoluteOrdering(this); + Ordering ordering = getOrdering(); + if (ordering == null) + ordering = new Ordering.AbsoluteOrdering(this); List order = _webXmlRoot.getOrdering(); for (String s:order) { if (s.equalsIgnoreCase("others")) - ((Ordering.AbsoluteOrdering)_ordering).addOthers(); + ((Ordering.AbsoluteOrdering)ordering).addOthers(); else - ((Ordering.AbsoluteOrdering)_ordering).add(s); + ((Ordering.AbsoluteOrdering)ordering).add(s); } + + //(re)set the ordering to cause webinf jar order to be recalculated + setOrdering(ordering); } } @@ -229,17 +237,22 @@ public class MetaData if (webOverrideRoot.isOrdered()) { - if (_ordering == null) - _ordering = new Ordering.AbsoluteOrdering(this); + Ordering ordering = getOrdering(); + + if (ordering == null) + ordering = new Ordering.AbsoluteOrdering(this); List order = webOverrideRoot.getOrdering(); for (String s:order) { if (s.equalsIgnoreCase("others")) - ((Ordering.AbsoluteOrdering)_ordering).addOthers(); + ((Ordering.AbsoluteOrdering)ordering).addOthers(); else - ((Ordering.AbsoluteOrdering)_ordering).add(s); + ((Ordering.AbsoluteOrdering)ordering).add(s); } + + //set or reset the ordering to cause the webinf jar ordering to be recomputed + setOrdering(ordering); } _webOverrideRoots.add(webOverrideRoot); } @@ -276,12 +289,16 @@ public class MetaData _webFragmentNameMap.put(descriptor.getName(), descriptor); } - //If web.xml has specified an absolute ordering, ignore any relative ordering in the fragment - if (_ordering != null && _ordering.isAbsolute()) - return; + //only accept an ordering from the fragment if there is no ordering already established if (_ordering == null && descriptor.isOrdered()) - _ordering = new Ordering.RelativeOrdering(this); + { + setOrdering(new Ordering.RelativeOrdering(this)); + return; + } + + //recompute the ordering with the new fragment name + orderFragments(); } /** @@ -343,14 +360,9 @@ public class MetaData public void orderFragments () { - //if we have already ordered them don't do it again - if (_orderedWebInfJars.size()==_webInfJars.size()) - return; - - if (_ordering != null) - _orderedWebInfJars.addAll(_ordering.order(_webInfJars)); - else - _orderedWebInfJars.addAll(_webInfJars); + _orderedWebInfResources.clear(); + if (getOrdering() != null) + _orderedWebInfResources.addAll(getOrdering().order(_webInfJars)); } @@ -367,10 +379,12 @@ public class MetaData _origins.clear(); // Set the ordered lib attribute - if (_ordering != null) + List orderedWebInfJars = null; + if (getOrdering() != null) { + orderedWebInfJars = getOrderedWebInfJars(); List orderedLibs = new ArrayList(); - for (Resource webInfJar:_orderedWebInfJars) + for (Resource webInfJar:orderedWebInfJars) { //get just the name of the jar file String fullname = webInfJar.getName(); @@ -413,7 +427,13 @@ public class MetaData //apply the annotations that are associated with a fragment, according to the //established ordering - List resources = getOrderedWebInfJars(); + List resources = null; + + if (getOrdering() != null) + resources = orderedWebInfJars; + else + resources = getWebInfJars(); + for (Resource r:resources) { FragmentDescriptor fd = _webFragmentResourceMap.get(r); @@ -448,12 +468,15 @@ public class MetaData for (WebDescriptor d : _webOverrideRoots) distributable&=d.isDistributable(); - List orderedResources = getOrderedWebInfJars(); - for (Resource r: orderedResources) + if (getOrdering() != null) { - FragmentDescriptor d = _webFragmentResourceMap.get(r); - if (d!=null) - distributable = distributable && d.isDistributable(); + List orderedResources = getOrderedWebInfJars(); + for (Resource r: orderedResources) + { + FragmentDescriptor d = _webFragmentResourceMap.get(r); + if (d!=null) + distributable = distributable && d.isDistributable(); + } } return distributable; } @@ -481,16 +504,16 @@ public class MetaData public List getOrderedWebInfJars() { - return _orderedWebInfJars == null? new ArrayList(): _orderedWebInfJars; + return _orderedWebInfResources; } public List getOrderedFragments () { List list = new ArrayList(); - if (_orderedWebInfJars == null) + if (getOrdering() == null) return list; - for (Resource r:_orderedWebInfJars) + for (Resource r:getOrderedWebInfJars()) { FragmentDescriptor fd = _webFragmentResourceMap.get(r); if (fd != null) @@ -505,8 +528,9 @@ public class MetaData } public void setOrdering (Ordering o) - { + { _ordering = o; + orderFragments(); } public FragmentDescriptor getFragment (Resource jar)