From 5a5f885b6307e2c87fc0d91adacf46ba76d290e2 Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 28 Oct 2009 11:48:50 +0000 Subject: [PATCH] Re-factoring to make testing easier git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@830506 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/startup/ContextConfig.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/java/org/apache/catalina/startup/ContextConfig.java b/java/org/apache/catalina/startup/ContextConfig.java index 3b6ed4918..9cfe6114b 100644 --- a/java/org/apache/catalina/startup/ContextConfig.java +++ b/java/org/apache/catalina/startup/ContextConfig.java @@ -1241,7 +1241,12 @@ public class ContextConfig Map fragments = processJarsForWebFragments(); // Merge the fragments into the main web.xml - mergeWebFragments(webXml, fragments); + Set orderedFragments = orderWebFragments(webXml, fragments); + + // Merge fragment into application + if (ok) { + ok = webXml.merge(orderedFragments); + } // Process JARs for annotations processAnnotationsInJars(fragments); @@ -1562,13 +1567,15 @@ public class ContextConfig } /** - * 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 orderWebFragments(WebXml application, Map fragments) { Set orderedFragments = new LinkedHashSet(); @@ -1602,10 +1609,7 @@ public class ContextConfig // TODO SERVLET3 Relative ordering } - // Merge fragment into application - if (ok) { - ok = application.merge(orderedFragments); - } + return orderedFragments; } -- 2.11.0