Author: markt
Date: Wed Oct 28 11:48:50 2009
New Revision: 830506

URL: http://svn.apache.org/viewvc?rev=830506&view=rev
Log:
Re-factoring to make testing easier

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=830506&r1=830505&r2=830506&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Wed Oct 28 
11:48:50 2009
@@ -1241,7 +1241,12 @@
             Map<String,WebXml> fragments = processJarsForWebFragments();
             
             // Merge the fragments into the main web.xml
-            mergeWebFragments(webXml, fragments);
+            Set<WebXml> orderedFragments = orderWebFragments(webXml, 
fragments);
+
+            // Merge fragment into application
+            if (ok) {
+                ok = webXml.merge(orderedFragments);
+            }
 
             // Process JARs for annotations
             processAnnotationsInJars(fragments);
@@ -1562,13 +1567,15 @@
     }
 
     /**
-     * Merges the web-fragment.xml and web.xml files as per the rules in the
+     * Generates the sub-set of the web-fragment.xml files to be processed in
+     * the order that the fragments must be processed as per the rules in the
      * Servlet spec.
      * 
      * @param application   The application web.xml file
      * @param fragments     The map of fragment names to web fragments
+     * @return Ordered list of web-fragment.xml files to process
      */
-    protected void mergeWebFragments(WebXml application,
+    protected static Set<WebXml> orderWebFragments(WebXml application,
             Map<String,WebXml> fragments) {
 
         Set<WebXml> orderedFragments = new LinkedHashSet<WebXml>();
@@ -1602,10 +1609,7 @@
             // TODO SERVLET3 Relative ordering
         }
         
-        // Merge fragment into application
-        if (ok) {
-            ok = application.merge(orderedFragments);
-        }
+        return orderedFragments;
     }
 
     



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to