From 0ab5727f7fba399c630ba22113609802f5dd8d88 Mon Sep 17 00:00:00 2001 From: markt Date: Fri, 15 Jan 2010 18:04:22 +0000 Subject: [PATCH] Re-factoring. WebXml is a better fit in o.a.c.deploy git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@899737 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/deploy/Constants.java | 26 ++++++++++++++ .../apache/catalina/deploy/LocalStrings.properties | 41 ++++++++++++++++++++++ .../catalina/{startup => deploy}/WebXml.java | 26 ++------------ .../org/apache/catalina/startup/ContextConfig.java | 1 + .../catalina/startup/LocalStrings.properties | 27 +------------- java/org/apache/catalina/startup/WebRuleSet.java | 1 + test/org/apache/TestAll.java | 2 +- .../catalina/{startup => deploy}/TestWebXml.java | 5 ++- 8 files changed, 77 insertions(+), 52 deletions(-) create mode 100644 java/org/apache/catalina/deploy/Constants.java create mode 100644 java/org/apache/catalina/deploy/LocalStrings.properties rename java/org/apache/catalina/{startup => deploy}/WebXml.java (98%) rename test/org/apache/catalina/{startup => deploy}/TestWebXml.java (98%) diff --git a/java/org/apache/catalina/deploy/Constants.java b/java/org/apache/catalina/deploy/Constants.java new file mode 100644 index 000000000..9ac67ae0b --- /dev/null +++ b/java/org/apache/catalina/deploy/Constants.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.apache.catalina.deploy; + + +public class Constants { + + public static final String Package = "org.apache.catalina.deploy"; + +} diff --git a/java/org/apache/catalina/deploy/LocalStrings.properties b/java/org/apache/catalina/deploy/LocalStrings.properties new file mode 100644 index 000000000..382417fd7 --- /dev/null +++ b/java/org/apache/catalina/deploy/LocalStrings.properties @@ -0,0 +1,41 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +webXml.duplicateEnvEntry=Duplicate env-entry name [{0}] +webXml.duplicateFilter=Duplicate filter name [{0}] +webXml.duplicateMessageDestination=Duplicate message-destination name [{0}] +webXml.duplicateMessageDestinationRef=Duplicate message-destination-ref name [{0}] +webXml.duplicateResourceEnvRef=Duplicate resource-env-ref name [{0}] +webXml.duplicateResourceRef=Duplicate resource-ref name [{0}] +webXml.duplicateTaglibUri=Duplicate tag library URI [{0}] +webXml.reservedName=A web.xml file was detected using a reserved name [{0}]. The name element will be ignored for this fragment. +webXml.mergeConflictDisplayName=The display name was defined in multiple fragments with different values including fragment with name [{0}] located at [{1}] +webXml.mergeConflictErrorPage=The Error Page for [{0}] was defined inconsistently in multiple fragments including fragment with name [{1}] located at [{2}] +webXml.mergeConflictFilter=The Filter [{0}] was defined inconsistently in multiple fragments including fragment with name [{1}] located at [{2}] +webXml.mergeConflictLoginConfig=A LoginConfig was defined inconsistently in multiple fragments including fragment with name [{1}] located at [{2}] +webXml.mergeConflictOrder=Fragment relative ordering contains circular references. Thsi can be resolved by using absolute ordering in web.xml. +webXml.mergeConflictResource=The Resource [{0}] was defined inconsistently in multiple fragments including fragment with name [{1}] located at [{2}] +webXml.mergeConflictServlet=The Servlet [{0}] was defined inconsistently in multiple fragments including fragment with name [{1}] located at [{2}] +webXml.mergeConflictSessionCookieName=The session cookie name was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}] +webXml.mergeConflictSessionCookieDomain=The session cookie domain was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}] +webXml.mergeConflictSessionCookiePath=The session cookie path was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}] +webXml.mergeConflictSessionCookieComment=The session cookie comment was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}] +webXml.mergeConflictSessionCookieHttpOnly=The session cookie http-only flag was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}] +webXml.mergeConflictSessionCookieSecure=The session cookie secure flag was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}] +webXml.mergeConflictSessionCookieMaxAge=The session cookie max-age was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}] +webXml.mergeConflictSessionTimeout=The session timeout was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}] +webXml.mergeConflictSessionTrackingMode=The session tracking modes were defined inconsistently in multiple fragments including fragment with name [{0}] located at [{1}] +webXml.mergeConflictString=The [{0}] with name [{1}] was defined inconsistently in multiple fragments including fragment with name [{2}] located at [{3}] +webXml.multipleOther=Multiple others entries in ordering \ No newline at end of file diff --git a/java/org/apache/catalina/startup/WebXml.java b/java/org/apache/catalina/deploy/WebXml.java similarity index 98% rename from java/org/apache/catalina/startup/WebXml.java rename to java/org/apache/catalina/deploy/WebXml.java index 2ce6f2a6d..121b134b0 100644 --- a/java/org/apache/catalina/startup/WebXml.java +++ b/java/org/apache/catalina/deploy/WebXml.java @@ -16,7 +16,7 @@ */ -package org.apache.catalina.startup; +package org.apache.catalina.deploy; import java.net.URL; import java.util.EnumSet; @@ -36,28 +36,6 @@ import javax.servlet.SessionTrackingMode; import org.apache.catalina.Context; import org.apache.catalina.Wrapper; -import org.apache.catalina.deploy.ContextEjb; -import org.apache.catalina.deploy.ContextEnvironment; -import org.apache.catalina.deploy.ContextHandler; -import org.apache.catalina.deploy.ContextLocalEjb; -import org.apache.catalina.deploy.ContextResource; -import org.apache.catalina.deploy.ContextResourceEnvRef; -import org.apache.catalina.deploy.ContextService; -import org.apache.catalina.deploy.ErrorPage; -import org.apache.catalina.deploy.FilterDef; -import org.apache.catalina.deploy.FilterMap; -import org.apache.catalina.deploy.InjectionTarget; -import org.apache.catalina.deploy.JspPropertyGroup; -import org.apache.catalina.deploy.LoginConfig; -import org.apache.catalina.deploy.MessageDestination; -import org.apache.catalina.deploy.MessageDestinationRef; -import org.apache.catalina.deploy.MultipartDef; -import org.apache.catalina.deploy.ResourceBase; -import org.apache.catalina.deploy.SecurityCollection; -import org.apache.catalina.deploy.SecurityConstraint; -import org.apache.catalina.deploy.SecurityRoleRef; -import org.apache.catalina.deploy.ServletDef; -import org.apache.catalina.deploy.SessionConfig; import org.apache.tomcat.util.res.StringManager; /** @@ -1949,7 +1927,7 @@ public class WebXml { * @param fragments The map of fragment names to web fragments * @return Ordered list of web-fragment.xml files to process */ - protected static Set orderWebFragments(WebXml application, + public static Set orderWebFragments(WebXml application, Map fragments) { Set orderedFragments = new LinkedHashSet(); diff --git a/java/org/apache/catalina/startup/ContextConfig.java b/java/org/apache/catalina/startup/ContextConfig.java index bd3a5d91f..f2d68903b 100644 --- a/java/org/apache/catalina/startup/ContextConfig.java +++ b/java/org/apache/catalina/startup/ContextConfig.java @@ -70,6 +70,7 @@ import org.apache.catalina.deploy.FilterMap; import org.apache.catalina.deploy.LoginConfig; import org.apache.catalina.deploy.SecurityConstraint; import org.apache.catalina.deploy.ServletDef; +import org.apache.catalina.deploy.WebXml; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.naming.resources.DirContextURLConnection; diff --git a/java/org/apache/catalina/startup/LocalStrings.properties b/java/org/apache/catalina/startup/LocalStrings.properties index 07011b175..c5db47595 100644 --- a/java/org/apache/catalina/startup/LocalStrings.properties +++ b/java/org/apache/catalina/startup/LocalStrings.properties @@ -116,29 +116,4 @@ userConfig.start=UserConfig: Processing START userConfig.stop=UserConfig: Processing STOP webRuleSet.absoluteOrdering= element not valid in web-fragment.xml and will be ignored webRuleSet.relativeOrdering= element not valid in web.xml and will be ignored -webXml.duplicateEnvEntry=Duplicate env-entry name [{0}] -webXml.duplicateFilter=Duplicate filter name [{0}] -webXml.duplicateMessageDestination=Duplicate message-destination name [{0}] -webXml.duplicateMessageDestinationRef=Duplicate message-destination-ref name [{0}] -webXml.duplicateResourceEnvRef=Duplicate resource-env-ref name [{0}] -webXml.duplicateResourceRef=Duplicate resource-ref name [{0}] -webXml.duplicateTaglibUri=Duplicate tag library URI [{0}] -webXml.reservedName=A web.xml file was detected using a reserved name [{0}]. The name element will be ignored for this fragment. -webXml.mergeConflictDisplayName=The display name was defined in multiple fragments with different values including fragment with name [{0}] located at [{1}] -webXml.mergeConflictErrorPage=The Error Page for [{0}] was defined inconsistently in multiple fragments including fragment with name [{1}] located at [{2}] -webXml.mergeConflictFilter=The Filter [{0}] was defined inconsistently in multiple fragments including fragment with name [{1}] located at [{2}] -webXml.mergeConflictLoginConfig=A LoginConfig was defined inconsistently in multiple fragments including fragment with name [{1}] located at [{2}] -webXml.mergeConflictOrder=Fragment relative ordering contains circular references. Thsi can be resolved by using absolute ordering in web.xml. -webXml.mergeConflictResource=The Resource [{0}] was defined inconsistently in multiple fragments including fragment with name [{1}] located at [{2}] -webXml.mergeConflictServlet=The Servlet [{0}] was defined inconsistently in multiple fragments including fragment with name [{1}] located at [{2}] -webXml.mergeConflictSessionCookieName=The session cookie name was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}] -webXml.mergeConflictSessionCookieDomain=The session cookie domain was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}] -webXml.mergeConflictSessionCookiePath=The session cookie path was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}] -webXml.mergeConflictSessionCookieComment=The session cookie comment was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}] -webXml.mergeConflictSessionCookieHttpOnly=The session cookie http-only flag was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}] -webXml.mergeConflictSessionCookieSecure=The session cookie secure flag was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}] -webXml.mergeConflictSessionCookieMaxAge=The session cookie max-age was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}] -webXml.mergeConflictSessionTimeout=The session timeout was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}] -webXml.mergeConflictSessionTrackingMode=The session tracking modes were defined inconsistently in multiple fragments including fragment with name [{0}] located at [{1}] -webXml.mergeConflictString=The [{0}] with name [{1}] was defined inconsistently in multiple fragments including fragment with name [{2}] located at [{3}] -webXml.multipleOther=Multiple others entries in ordering + diff --git a/java/org/apache/catalina/startup/WebRuleSet.java b/java/org/apache/catalina/startup/WebRuleSet.java index dea67e452..4e2468c8f 100644 --- a/java/org/apache/catalina/startup/WebRuleSet.java +++ b/java/org/apache/catalina/startup/WebRuleSet.java @@ -26,6 +26,7 @@ import org.apache.catalina.deploy.ContextHandler; import org.apache.catalina.deploy.ContextService; import org.apache.catalina.deploy.SecurityConstraint; import org.apache.catalina.deploy.ServletDef; +import org.apache.catalina.deploy.WebXml; import org.apache.tomcat.util.IntrospectionUtils; import org.apache.tomcat.util.digester.CallMethodRule; import org.apache.tomcat.util.digester.CallParamRule; diff --git a/test/org/apache/TestAll.java b/test/org/apache/TestAll.java index fa9b940e9..d2185817c 100644 --- a/test/org/apache/TestAll.java +++ b/test/org/apache/TestAll.java @@ -23,10 +23,10 @@ import junit.framework.TestSuite; import org.apache.catalina.connector.TestKeepAliveCount; import org.apache.catalina.connector.TestRequest; import org.apache.catalina.core.TestStandardContext; +import org.apache.catalina.deploy.TestWebXml; import org.apache.catalina.ha.session.TestSerializablePrincipal; import org.apache.catalina.startup.TestTomcat; import org.apache.catalina.startup.TestTomcatSSL; -import org.apache.catalina.startup.TestWebXml; import org.apache.el.TestELEvaluation; import org.apache.el.TestELInJsp; import org.apache.el.lang.TestELSupport; diff --git a/test/org/apache/catalina/startup/TestWebXml.java b/test/org/apache/catalina/deploy/TestWebXml.java similarity index 98% rename from test/org/apache/catalina/startup/TestWebXml.java rename to test/org/apache/catalina/deploy/TestWebXml.java index 6952acb03..3174ddaa4 100644 --- a/test/org/apache/catalina/startup/TestWebXml.java +++ b/test/org/apache/catalina/deploy/TestWebXml.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.catalina.startup; +package org.apache.catalina.deploy; import java.util.HashMap; import java.util.HashSet; @@ -23,6 +23,9 @@ import java.util.Iterator; import java.util.Map; import java.util.Set; +import org.apache.catalina.deploy.WebXml; +import org.apache.catalina.startup.ContextConfig; + import junit.framework.TestCase; /** -- 2.11.0