geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: rev 54967 - in geronimo/trunk/modules: assembly jetty/src/java/org/apache/geronimo/jetty/deployment
Date Sun, 17 Oct 2004 17:26:26 GMT
Author: adc
Date: Sun Oct 17 10:26:25 2004
New Revision: 54967

Modified:
   geronimo/trunk/modules/assembly/project.xml
   geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Log:
Stricter checking of the web-app.

Modified: geronimo/trunk/modules/assembly/project.xml
==============================================================================
--- geronimo/trunk/modules/assembly/project.xml	(original)
+++ geronimo/trunk/modules/assembly/project.xml	Sun Oct 17 10:26:25 2004
@@ -275,6 +275,9 @@
             <artifactId>geronimo-j2ee-schema</artifactId>
             <version>${pom.currentVersion}</version>
             <properties>
+                <deploy>true</deploy><!-- TODO REMOVE WHEN XMLBEANS CL IS
FIXED -->
+                <server>true</server><!-- TODO REMOVE WHEN XMLBEANS CL IS
FIXED -->
+                <lib>true</lib><!-- TODO REMOVE WHEN XMLBEANS CL IS FIXED
-->
                 <repository>true</repository>
             </properties>
         </dependency>
@@ -588,6 +591,7 @@
             <properties>
                 <lib>true</lib>
                 <deploy>true</deploy>
+                <server>true</server><!-- TODO REMOVE WHEN XMLBEANS CL IS
FIXED -->
                 <repository>true</repository>
             </properties>
         </dependency>

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Sun Oct 17 10:26:25 2004
@@ -117,7 +117,9 @@
             specDD = DeploymentUtil.readAll(specDDUrl);
 
             // parse it
-            WebAppDocument webAppDoc = SchemaConversionUtils.convertToServletSchema(SchemaConversionUtils.parse(specDD));
+            XmlObject parsed = SchemaConversionUtils.parse(specDD);
+            SchemaConversionUtils.validateDD(parsed);
+            WebAppDocument webAppDoc = SchemaConversionUtils.convertToServletSchema(parsed);
             webApp = webAppDoc.getWebApp();
         } catch (XmlException xmle) {
             throw new DeploymentException("Error parsing web.xml", xmle);
@@ -125,7 +127,7 @@
             return null;
         }
 
-        checkURLPattern(webApp);
+        check(webApp);
 
         // parse vendor dd
         JettyWebAppType jettyWebApp = getJettyWebApp(plan, moduleFile, standAlone, targetPath,
webApp);
@@ -520,6 +522,11 @@
         return uri;
     }
 
+    private static void check(WebAppType webApp) throws DeploymentException {
+        checkURLPattern(webApp);
+        checkMultiplicities(webApp);
+    }
+
     private static void checkURLPattern(WebAppType webApp) throws DeploymentException {
 
         FilterMappingType[] filterMappings = webApp.getFilterMappingArray();
@@ -536,16 +543,22 @@
 
         SecurityConstraintType[] constraints = webApp.getSecurityConstraintArray();
         for (int i = 0; i < constraints.length; i++) {
-            WebResourceCollectionType[] collections  = constraints[i].getWebResourceCollectionArray();
+            WebResourceCollectionType[] collections = constraints[i].getWebResourceCollectionArray();
             for (int j = 0; j < collections.length; j++) {
                 checkString(collections[j].addNewUrlPattern().getStringValue());
             }
         }
     }
 
-    private static void checkString(String pattern)throws DeploymentException {
+    private static void checkString(String pattern) throws DeploymentException {
         if (pattern.indexOf(0x0D) >= 0) throw new DeploymentException("<url-pattern>
must not contain CR(#xD)");
         if (pattern.indexOf(0x0A) >= 0) throw new DeploymentException("<url-pattern>
must not contain LF(#xA)");
+    }
+
+    private static void checkMultiplicities(WebAppType webApp) throws DeploymentException
{
+        if (webApp.getSessionConfigArray().length > 1) throw new DeploymentException("Multiple
<session-config> elements found");
+        if (webApp.getJspConfigArray().length > 1) throw new DeploymentException("Multiple
<jsp-config> elements found");
+        if (webApp.getLoginConfigArray().length > 1) throw new DeploymentException("Multiple
<login-config> elements found");
     }
 
     public static final GBeanInfo GBEAN_INFO;

Mime
View raw message