geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r804562 - /geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java
Date Sun, 16 Aug 2009 04:57:15 GMT
Author: djencks
Date: Sun Aug 16 04:57:15 2009
New Revision: 804562

URL: http://svn.apache.org/viewvc?rev=804562&view=rev
Log:
GERONIMO-4788 make sure the jsp default servlet doesn't override any explicit mappings no
matter when it happens to get started

Modified:
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java?rev=804562&r1=804561&r2=804562&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java
Sun Aug 16 04:57:15 2009
@@ -455,13 +455,12 @@
 
             // configure tag libs.
             Set<String> knownServletMappings = new HashSet<String>();
+            Set<String> knownJspMappings = new HashSet<String>();
             Map<String, Set<String>> servletMappings = new HashMap<String,
Set<String>>();
             if (jspServlet != null) {
-                configureTagLibs(module, webApp, webModuleData, servletMappings, knownServletMappings,
jspServlet.getServletName());
-                GBeanData jspServletData = configureDefaultServlet(jspServlet, earContext,
moduleName, knownServletMappings, moduleContext);
-                Set<String> jspMappings = (Set<String>) jspServletData.getAttribute("servletMappings");
-                jspMappings.addAll(knownServletMappings);
-                jspServletData.setAttribute("servletMappings", jspMappings);
+                configureTagLibs(module, webApp, webModuleData, servletMappings, knownJspMappings,
jspServlet.getServletName());
+                GBeanData jspServletData = configureDefaultServlet(jspServlet, earContext,
moduleName, knownJspMappings);
+                knownServletMappings.addAll(knownJspMappings);
                 module.getSharedContext().put(DEFAULT_JSP_SERVLET_KEY, jspServletData);
             }
 
@@ -472,6 +471,15 @@
 
             buildServletMappings(module, webApp, servletMappings, knownServletMappings);
 
+            //be careful that the jsp servlet defaults don't overrride anything configured
in the app.
+            if (jspServlet != null) {
+                GBeanData jspServletData = (GBeanData) module.getSharedContext().get(DEFAULT_JSP_SERVLET_KEY);
+                Set<String> jspMappings = (Set<String>) jspServletData.getAttribute("servletMappings");
+                jspMappings.removeAll(knownServletMappings);
+                jspMappings.addAll(knownJspMappings);
+                jspServletData.setAttribute("servletMappings", jspMappings);
+            }
+
             //"previous" filter mapping for linked list to keep dd's ordering.
             AbstractName previous = null;
 
@@ -586,12 +594,12 @@
 
     private void addDefaultServletsGBeans(EARContext earContext, EARContext moduleContext,
AbstractName moduleName, Set knownServletMappings) throws GBeanNotFoundException, GBeanAlreadyExistsException
{
         for (Object defaultServlet : defaultServlets) {
-            GBeanData servletGBeanData = configureDefaultServlet(defaultServlet, earContext,
moduleName, knownServletMappings, moduleContext);
+            GBeanData servletGBeanData = configureDefaultServlet(defaultServlet, earContext,
moduleName, knownServletMappings);
             moduleContext.addGBean(servletGBeanData);
         }
     }
 
-    private GBeanData configureDefaultServlet(Object defaultServlet, EARContext earContext,
AbstractName moduleName, Set knownServletMappings, EARContext moduleContext) throws GBeanNotFoundException,
GBeanAlreadyExistsException {
+    private GBeanData configureDefaultServlet(Object defaultServlet, EARContext earContext,
AbstractName moduleName, Set knownServletMappings) throws GBeanNotFoundException, GBeanAlreadyExistsException
{
         GBeanData servletGBeanData = getGBeanData(kernel, defaultServlet);
         AbstractName defaultServletObjectName = earContext.getNaming().createChildName(moduleName,
(String) servletGBeanData.getAttribute("servletName"), NameFactory.SERVLET);
         servletGBeanData.setAbstractName(defaultServletObjectName);
@@ -715,7 +723,7 @@
         return previous;
     }
 
-    private Map buildServletMappings(Module module, WebAppType webApp, Map<String, Set<String>>
servletMappings, Set<String> knownServletMappings) throws DeploymentException {
+    private void buildServletMappings(Module module, WebAppType webApp, Map<String, Set<String>>
servletMappings, Set<String> knownServletMappings) throws DeploymentException {
         ServletType[] servletTypes = webApp.getServletArray();
         Set<String> knownServlets = new HashSet<String>();
         for (ServletType type : servletTypes) {
@@ -733,8 +741,6 @@
             UrlPatternType[] urlPatterns = servletMappingType.getUrlPatternArray();
             addMappingsForServlet(servletName, urlPatterns, knownServletMappings, servletMappings);
         }
-
-        return servletMappings;
     }
 
     private void addMappingsForServlet(String servletName, UrlPatternType[] urlPatterns,
Set<String> knownServletMappings, Map<String, Set<String>> servletMappings)
throws DeploymentException {



Mime
View raw message