geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r355736 - /geronimo/branches/1.0/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Date Sat, 10 Dec 2005 09:59:47 GMT
Author: ammulder
Date: Sat Dec 10 01:59:42 2005
New Revision: 355736

URL: http://svn.apache.org/viewcvs?rev=355736&view=rev
Log:
Merge servlet-mapping fix to branch

Modified:
    geronimo/branches/1.0/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java

Modified: geronimo/branches/1.0/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?rev=355736&r1=355735&r2=355736&view=diff
==============================================================================
--- geronimo/branches/1.0/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/branches/1.0/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Sat Dec 10 01:59:42 2005
@@ -17,40 +17,6 @@
 
 package org.apache.geronimo.jetty.deployment;
 
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.security.Permission;
-import java.security.PermissionCollection;
-import java.security.Permissions;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.security.jacc.WebResourcePermission;
-import javax.security.jacc.WebRoleRefPermission;
-import javax.security.jacc.WebUserDataPermission;
-import javax.servlet.Servlet;
-import javax.transaction.UserTransaction;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.common.DeploymentException;
@@ -88,8 +54,8 @@
 import org.apache.geronimo.security.jacc.ComponentPermissions;
 import org.apache.geronimo.security.util.URLPattern;
 import org.apache.geronimo.transaction.context.OnlineUserTransaction;
-import org.apache.geronimo.web.deployment.GenericToSpecificPlanConverter;
 import org.apache.geronimo.web.deployment.AbstractWebModuleBuilder;
+import org.apache.geronimo.web.deployment.GenericToSpecificPlanConverter;
 import org.apache.geronimo.xbeans.geronimo.naming.GerMessageDestinationType;
 import org.apache.geronimo.xbeans.geronimo.web.jetty.JettyWebAppDocument;
 import org.apache.geronimo.xbeans.geronimo.web.jetty.JettyWebAppType;
@@ -127,6 +93,40 @@
 import org.mortbay.http.DigestAuthenticator;
 import org.mortbay.jetty.servlet.FormAuthenticator;
 
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.security.jacc.WebResourcePermission;
+import javax.security.jacc.WebRoleRefPermission;
+import javax.security.jacc.WebUserDataPermission;
+import javax.servlet.Servlet;
+import javax.transaction.UserTransaction;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+
 
 /**
  * @version $Rev$ $Date$
@@ -271,7 +271,6 @@
      *
      * @param webApp
      * @param contextRoot
-     * @return
      */
     private Map buildServletNameToPathMap(WebAppType webApp, String contextRoot) {
         contextRoot = "/" + contextRoot;
@@ -513,7 +512,6 @@
                 ParamValueType contextParam = contextParamArray[i];
                 contextParams.put(contextParam.getParamName().getStringValue().trim(), contextParam.getParamValue().getStringValue().trim());
             }
-            contextParams.put("org.mortbay.jetty.servlet.Context.LogSink", "foo");
             webModuleData.setAttribute("contextParamMap", contextParams);
 
             ListenerType[] listenerArray = webApp.getListenerArray();
@@ -624,6 +622,13 @@
             }
             earContext.addGBean(webModuleData);
 
+            // Make sure that servlet mappings point to available servlets
+            ServletType[] servletTypes = webApp.getServletArray();
+            Set knownServlets = new HashSet();
+            for (int i = 0; i < servletTypes.length; i++) {
+                ServletType type = servletTypes[i];
+                knownServlets.add(type.getServletName().getStringValue().trim());
+            }
             //never add a duplicate pattern.
             Set knownServletMappings = new HashSet();
 
@@ -632,6 +637,9 @@
             for (int i = 0; i < servletMappingArray.length; i++) {
                 ServletMappingType servletMappingType = servletMappingArray[i];
                 String servletName = servletMappingType.getServletName().getStringValue().trim();
+                if(!knownServlets.contains(servletName)) {
+                    throw new DeploymentException("Servlet mapping refers to servlet '"+servletName+"'
but no such servlet was found!");
+                }
                 String urlPattern = servletMappingType.getUrlPattern().getStringValue().trim();
                 if (!knownServletMappings.contains(urlPattern)) {
                     knownServletMappings.add(urlPattern);
@@ -788,7 +796,6 @@
             }
 
             //set up servlet gbeans.
-            ServletType[] servletTypes = webApp.getServletArray();
             Map portMap = webModule.getPortMap();
 
             addServlets(webModuleName, webModule.getModuleFile(), servletTypes, servletMappings,
securityRoles, rolePermissions, portMap, webClassLoader, moduleJ2eeContext, earContext);



Mime
View raw message