geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r983551 - in /geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment: ./ merge/webfragment/
Date Mon, 09 Aug 2010 08:18:04 GMT
Author: xuhaihong
Date: Mon Aug  9 08:18:04 2010
New Revision: 983551

URL: http://svn.apache.org/viewvc?rev=983551&view=rev
Log:
Ignore the mapping configurations from web-fragment.xml and annotations while they are configured
in web.xml.

Modified:
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMappingMergeHandler.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMergeHandler.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMappingMergeHandler.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMergeHandler.java

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java?rev=983551&r1=983550&r2=983551&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
Mon Aug  9 08:18:04 2010
@@ -51,7 +51,6 @@ import org.apache.geronimo.components.ja
 import org.apache.geronimo.components.jaspi.model.JaspiXmlUtil;
 import org.apache.geronimo.components.jaspi.model.ServerAuthConfigType;
 import org.apache.geronimo.components.jaspi.model.ServerAuthContextType;
-import org.apache.geronimo.deployment.ClassPathUtils;
 import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
 import org.apache.geronimo.deployment.NamespaceDrivenBuilderCollection;

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMappingMergeHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMappingMergeHandler.java?rev=983551&r1=983550&r2=983551&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMappingMergeHandler.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMappingMergeHandler.java
Mon Aug  9 08:18:04 2010
@@ -35,7 +35,7 @@ public class FilterMappingMergeHandler i
     private List<SubMergeHandler<FilterMapping, FilterMapping>> subMergeHandlers;
 
     public FilterMappingMergeHandler() {
-        subMergeHandlers = new ArrayList<SubMergeHandler<FilterMapping, FilterMapping>>();
+        subMergeHandlers = new ArrayList<SubMergeHandler<FilterMapping, FilterMapping>>(3);
         subMergeHandlers.add(new FilterMappingUrlPatternMergeHandler());
         subMergeHandlers.add(new FilterMappingServletNameMergeHandler());
         subMergeHandlers.add(new FilterMappingDispatcherMergeHandler());
@@ -53,6 +53,9 @@ public class FilterMappingMergeHandler i
                     subMergeHandler.add(srcFilterMapping, mergeContext);
                 }
             } else {
+                if (isFilterMappingFromWebXml(filterName, mergeContext)) {
+                    continue;
+                }
                 if (isFilterMappingFromAnnotation(filterName, mergeContext)) {
                     //If the current url-patterns configurations are from annotations, so
let's drop them
                     targetFilterMapping.getUrlPattern().clear();
@@ -79,6 +82,7 @@ public class FilterMappingMergeHandler i
         for (FilterMapping filterMapping : webApp.getFilterMapping()) {
             String filterName = filterMapping.getFilterName();
             context.setAttribute(createFilterMappingKey(filterName), filterMapping);
+            context.setAttribute(createFilterMappingSourceKey(filterName), ElementSource.WEB_XML);
         }
         for (SubMergeHandler<FilterMapping, FilterMapping> subMergeHandler : subMergeHandlers)
{
             subMergeHandler.preProcessWebXmlElement(webApp, context);
@@ -106,6 +110,11 @@ public class FilterMappingMergeHandler i
         return elementSource != null && elementSource.equals(ElementSource.ANNOTATION);
     }
 
+    public static boolean isFilterMappingFromWebXml(String filterName, MergeContext mergeContext)
{
+        ElementSource elementSource = (ElementSource) mergeContext.getAttribute(createFilterMappingSourceKey(filterName));
+        return elementSource != null && elementSource.equals(ElementSource.WEB_XML);
+    }
+
     public static void addFilterMapping(FilterMapping filterMapping, MergeContext mergeContext)
{
         mergeContext.setAttribute(createFilterMappingKey(filterMapping.getFilterName()),
filterMapping);
     }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMergeHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMergeHandler.java?rev=983551&r1=983550&r2=983551&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMergeHandler.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMergeHandler.java
Mon Aug  9 08:18:04 2010
@@ -34,7 +34,7 @@ public class FilterMergeHandler implemen
     private List<SubMergeHandler<Filter, Filter>> subMergeHandlers;
 
     public FilterMergeHandler() {
-        subMergeHandlers = new ArrayList<SubMergeHandler<Filter, Filter>>();
+        subMergeHandlers = new ArrayList<SubMergeHandler<Filter, Filter>>(1);
         subMergeHandlers.add(new FilterInitParamMergeHandler());
     }
 

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMappingMergeHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMappingMergeHandler.java?rev=983551&r1=983550&r2=983551&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMappingMergeHandler.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMappingMergeHandler.java
Mon Aug  9 08:18:04 2010
@@ -35,7 +35,7 @@ public class ServletMappingMergeHandler 
     private List<SubMergeHandler<ServletMapping, ServletMapping>> subMergeHandlers;
 
     public ServletMappingMergeHandler() {
-        subMergeHandlers = new ArrayList<SubMergeHandler<ServletMapping, ServletMapping>>();
+        subMergeHandlers = new ArrayList<SubMergeHandler<ServletMapping, ServletMapping>>(1);
         subMergeHandlers.add(new ServletMappingUrlPatternMergeHandler());
     }
 
@@ -51,6 +51,10 @@ public class ServletMappingMergeHandler 
                     subMergeHandler.add(srcServletMapping, mergeContext);
                 }
             } else {
+                //If the servlet-mapping is configured in the central web.xml file, all the
configurations from the fragment xml and annotations are ignored
+                if(isServletMappingFromWebXml(servletName, mergeContext)) {
+                    continue;
+                }
                 if (isServletMappingFromAnnotation(servletName, mergeContext) &&
!srcServletMapping.getUrlPattern().isEmpty()) {
                     //If the current url-patterns configurations are from annotations, so
let's drop them
                     targetServletMapping.getUrlPattern().clear();
@@ -73,8 +77,9 @@ public class ServletMappingMergeHandler 
     @Override
     public void preProcessWebXmlElement(WebApp webApp, MergeContext context) throws DeploymentException
{
         for (ServletMapping servletMapping : webApp.getServletMapping()) {
-            String filterName = servletMapping.getServletName();
-            context.setAttribute(createServletMappingKey(filterName), servletMapping);
+            String servletName = servletMapping.getServletName();
+            context.setAttribute(createServletMappingKey(servletName), servletMapping);
+            context.setAttribute(createServletMappingSourceKey(servletName), ElementSource.WEB_XML);
         }
         for (SubMergeHandler<ServletMapping, ServletMapping> subMergeHandler : subMergeHandlers)
{
             subMergeHandler.preProcessWebXmlElement(webApp, context);
@@ -101,4 +106,9 @@ public class ServletMappingMergeHandler 
         ElementSource elementSource = (ElementSource) mergeContext.getAttribute(createServletMappingSourceKey(servletName));
         return elementSource != null && elementSource.equals(ElementSource.ANNOTATION);
     }
+
+    public static boolean isServletMappingFromWebXml(String servletName, MergeContext mergeContext)
{
+        ElementSource elementSource = (ElementSource) mergeContext.getAttribute(createServletMappingSourceKey(servletName));
+        return elementSource != null && elementSource.equals(ElementSource.WEB_XML);
+    }
 }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMergeHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMergeHandler.java?rev=983551&r1=983550&r2=983551&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMergeHandler.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMergeHandler.java
Mon Aug  9 08:18:04 2010
@@ -34,7 +34,7 @@ public class ServletMergeHandler impleme
     private List<SubMergeHandler<Servlet, Servlet>> subMergeHandlers;
 
     public ServletMergeHandler() {
-        subMergeHandlers = new ArrayList<SubMergeHandler<Servlet, Servlet>>();
+        subMergeHandlers = new ArrayList<SubMergeHandler<Servlet, Servlet>>(2);
         subMergeHandlers.add(new ServletInitParamMergeHandler());
         subMergeHandlers.add(new ServletLoadOnStartupMergeHandler());
     }



Mime
View raw message