geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1296271 - in /geronimo/server/trunk: ./ plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/ plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/ plugins/jetty8/ge...
Date Fri, 02 Mar 2012 16:07:48 GMT
Author: xuhaihong
Date: Fri Mar  2 16:07:47 2012
New Revision: 1296271

URL: http://svn.apache.org/viewvc?rev=1296271&view=rev
Log:
GERONIMO-6292 Share the japser servlet between jasper plugin and web-container plugin.

Added:
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/JspServletInfoProvider.java
Modified:
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/StandardWebAppInfoFactory.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java
    geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
    geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
    geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilderTest.java
    geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/PlanParsingTest.java
    geronimo/server/trunk/plugins/jetty8/jetty8-deployer/src/main/plan/plan.xml
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java
    geronimo/server/trunk/plugins/tomcat/tomcat7-deployer/src/main/plan/plan.xml
    geronimo/server/trunk/pom.xml

Added: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/JspServletInfoProvider.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/JspServletInfoProvider.java?rev=1296271&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/JspServletInfoProvider.java
(added)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/JspServletInfoProvider.java
Fri Mar  2 16:07:47 2012
@@ -0,0 +1,27 @@
+/*
+ * 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.geronimo.web25.deployment;
+
+import org.apache.geronimo.web.info.ServletInfo;
+
+public interface JspServletInfoProvider {
+
+    public ServletInfo getJspServletInfo();
+}

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/StandardWebAppInfoFactory.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/StandardWebAppInfoFactory.java?rev=1296271&r1=1296270&r2=1296271&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/StandardWebAppInfoFactory.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/StandardWebAppInfoFactory.java
Fri Mar  2 16:07:47 2012
@@ -20,8 +20,6 @@
 
 package org.apache.geronimo.web25.deployment;
 
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -35,7 +33,7 @@ import org.apache.geronimo.web.info.WebA
  */
 public class StandardWebAppInfoFactory extends DefaultWebAppInfoFactory {
 
-    private final ServletInfo jspServletInfo;
+    private ServletInfo jspServletInfo;
 
     private final WebAppInfo defaultWebAppInfo;
 
@@ -103,4 +101,7 @@ public class StandardWebAppInfoFactory e
         return servletInfo;
     }
 
+    public void setJspServletInfo(ServletInfo jspServletInfo) {
+        this.jspServletInfo = jspServletInfo;
+    }
 }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.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/WebAppInfoBuilder.java?rev=1296271&r1=1296270&r2=1296271&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java
Fri Mar  2 16:07:47 2012
@@ -205,6 +205,10 @@ public class WebAppInfoBuilder {
                 servletInfo.servletClass = servlet.getServletClass();
             } else if (servlet.getJspFile() != null) {
                 servletInfo = webAppInfoFactory.newJspInfo(servlet.getJspFile());
+                if(servletInfo == null) {
+                    problems.add("\nNo JSP servlet available, " + servlet.getServletName()
+ " will not work");
+                    continue;
+                }
             } else {
                 problems.add("\nNo servlet class or jsp file for servlet " + servlet.getServletName());
                 continue;

Modified: geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java?rev=1296271&r1=1296270&r2=1296271&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
(original)
+++ geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
Fri Mar  2 16:07:47 2012
@@ -65,6 +65,7 @@ import org.apache.geronimo.kernel.util.I
 import org.apache.geronimo.web.info.ServletInfo;
 import org.apache.geronimo.web.info.WebAppInfo;
 import org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder;
+import org.apache.geronimo.web25.deployment.JspServletInfoProvider;
 import org.apache.geronimo.web25.deployment.WebAppInfoBuilder;
 import org.apache.openejb.jee.JaxbJavaee;
 import org.apache.openejb.jee.JspConfig;
@@ -92,7 +93,7 @@ import org.slf4j.LoggerFactory;
  * @version $Rev $Date
  */
 @GBean(j2eeType = NameFactory.MODULE_BUILDER)
-public class JspModuleBuilderExtension implements ModuleBuilderExtension {
+public class JspModuleBuilderExtension implements ModuleBuilderExtension, JspServletInfoProvider
{
 
     private static final Logger log = LoggerFactory.getLogger(JspModuleBuilderExtension.class);
 
@@ -219,6 +220,10 @@ public class JspModuleBuilderExtension i
         }
     }
 
+    @Override
+    public ServletInfo getJspServletInfo() {
+        return defaultJspServletInfo;
+    }
 
     /**
      * getTldFiles(): Find all the TLD files in the web module being deployed

Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java?rev=1296271&r1=1296270&r2=1296271&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
Fri Mar  2 16:07:47 2012
@@ -29,6 +29,7 @@ import java.util.Map;
 import java.util.jar.JarFile;
 
 import javax.xml.bind.JAXBException;
+
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.Deployable;
 import org.apache.geronimo.deployment.DeployableBundle;
@@ -66,6 +67,7 @@ import org.apache.geronimo.kernel.GBeanA
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.lifecycle.LifecycleAdapter;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.util.FileUtils;
 import org.apache.geronimo.kernel.util.JarUtils;
@@ -84,9 +86,9 @@ import org.apache.geronimo.web.info.Logi
 import org.apache.geronimo.web.info.ServletInfo;
 import org.apache.geronimo.web.info.WebAppInfo;
 import org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder;
+import org.apache.geronimo.web25.deployment.JspServletInfoProvider;
 import org.apache.geronimo.web25.deployment.StandardWebAppInfoFactory;
 import org.apache.geronimo.web25.deployment.WebAppInfoBuilder;
-import org.apache.geronimo.web25.deployment.WebAppInfoFactory;
 import org.apache.geronimo.web25.deployment.security.AuthenticationWrapper;
 import org.apache.geronimo.xbeans.geronimo.jaspi.JaspiAuthModuleType;
 import org.apache.geronimo.xbeans.geronimo.jaspi.JaspiConfigProviderType;
@@ -138,19 +140,19 @@ public class JettyModuleBuilder extends 
 
     private final Environment defaultEnvironment;
     private final AbstractNameQuery jettyContainerObjectName;
-    private final WebAppInfoFactory webAppInfoFactory;
+    private final StandardWebAppInfoFactory webAppInfoFactory;
 
     protected final NamespaceDrivenBuilderCollection clusteringBuilders;
 
     private final Integer defaultSessionTimeoutMinutes;
 
     private static final String JETTY_NAMESPACE = JettyWebAppDocument.type.getDocumentElementName().getNamespaceURI();
+    private final JspServletInfoProviderListener jspServletInfoProviderListener = new JspServletInfoProviderListener();
 
     public JettyModuleBuilder(@ParamAttribute(name = "defaultEnvironment") Environment defaultEnvironment,
                               @ParamAttribute(name = "defaultSessionTimeoutSeconds") Integer
defaultSessionTimeoutSeconds,
                               @ParamAttribute(name = "jettyContainerObjectName") AbstractNameQuery
jettyContainerName,
                               @ParamAttribute(name = "defaultWebApp") WebAppInfo defaultWebApp,
-                              @ParamAttribute(name = "jspServlet") WebAppInfo jspServlet,
                               @ParamReference(name = "PojoWebServiceTemplate", namingType
= NameFactory.SERVLET_WEB_SERVICE_TEMPLATE) Object pojoWebServiceTemplate,
                               @ParamReference(name = "WebServiceBuilder", namingType = NameFactory.MODULE_BUILDER)
Collection<WebServiceBuilder> webServiceBuilder,
                               @ParamReference(name = "ClusteringBuilders", namingType = NameFactory.MODULE_BUILDER)
Collection<NamespaceDrivenBuilder> clusteringBuilders,
@@ -163,14 +165,8 @@ public class JettyModuleBuilder extends 
         super(kernel, serviceBuilders, namingBuilders, resourceEnvironmentSetter, webServiceBuilder,
moduleBuilderExtensions, bundleContext);
         this.defaultEnvironment = defaultEnvironment;
         this.defaultSessionTimeoutMinutes = (defaultSessionTimeoutSeconds == null) ? 30 *
60 : defaultSessionTimeoutSeconds;
-        this.jettyContainerObjectName = jettyContainerName;
-        ServletInfo jspServletInfo;
-        if (jspServlet != null) {
-            jspServletInfo = jspServlet.servlets.get(0);
-        } else {
-            jspServletInfo = null;
-        }
-        this.webAppInfoFactory = new StandardWebAppInfoFactory(defaultWebApp, jspServletInfo);
+        this.jettyContainerObjectName = jettyContainerName;        
+        this.webAppInfoFactory = new StandardWebAppInfoFactory(defaultWebApp, null);
 
         this.clusteringBuilders = new NamespaceDrivenBuilderCollection(clusteringBuilders);//,
GerClusteringDocument.type.getDocumentElementName());
     }
@@ -178,12 +174,14 @@ public class JettyModuleBuilder extends 
     public void doStart() throws Exception {
         XmlBeansUtil.registerNamespaceUpdates(NAMESPACE_UPDATES);
         SchemaConversionUtils.registerNamespaceConversions(GERONIMO_SCHEMA_CONVERSIONS);
+        kernel.getLifecycleMonitor().addLifecycleListener(jspServletInfoProviderListener,
new AbstractNameQuery(JspServletInfoProvider.class.getName()));
     }
 
     public void doStop() {
         XmlBeansUtil.unregisterNamespaceUpdates(NAMESPACE_UPDATES);
+        kernel.getLifecycleMonitor().removeLifecycleListener(jspServletInfoProviderListener);
         //TODO not yet implemented
-//        SchemaConversionUtils.unregisterNamespaceConversions(GERONIMO_SCHEMA_CONVERSIONS);
+        // SchemaConversionUtils.unregisterNamespaceConversions(GERONIMO_SCHEMA_CONVERSIONS);
     }
 
     public void doFail() {
@@ -651,6 +649,25 @@ public class JettyModuleBuilder extends 
         }
     }
 
+    private class JspServletInfoProviderListener extends LifecycleAdapter {
+
+        @Override
+        public void running(AbstractName abstractName) {
+            try {
+                JspServletInfoProvider jspServletInfoProvider = (JspServletInfoProvider)
kernel.getGBean(abstractName);
+                ServletInfo jspServletInfo = webAppInfoFactory.copy(jspServletInfoProvider.getJspServletInfo());
+                jspServletInfo.servletMappings.clear();
+                webAppInfoFactory.setJspServletInfo(jspServletInfo);
+            } catch (Exception e) {
+            }
+        }
+
+        @Override
+        public void stopped(AbstractName abstractName) {
+            webAppInfoFactory.setJspServletInfo(null);
+        }
+    }
+
     private static class JettyAuthenticationWrapper implements AuthenticationWrapper {
         private final JettyAuthenticationType authType;
 

Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilderTest.java?rev=1296271&r1=1296270&r2=1296271&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilderTest.java
(original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilderTest.java
Fri Mar  2 16:07:47 2012
@@ -368,7 +368,6 @@ public class JettyModuleBuilderTest exte
                 new AbstractNameQuery(containerName),
                 //new AbstractNameQuery(containerName),
                 new WebAppInfo(),
-                null,
                 pojoWebServiceTemplate,
                 Collections.singleton(webServiceBuilder),
                 null,

Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/PlanParsingTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/PlanParsingTest.java?rev=1296271&r1=1296270&r2=1296271&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/PlanParsingTest.java
(original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/PlanParsingTest.java
Fri Mar  2 16:07:47 2012
@@ -28,6 +28,7 @@ import java.util.jar.JarFile;
 
 import javax.xml.bind.JAXBException;
 import javax.xml.parsers.ParserConfigurationException;
+
 import org.apache.geronimo.deployment.DeployableJarFile;
 import org.apache.geronimo.deployment.service.GBeanBuilder;
 import org.apache.geronimo.deployment.xbeans.ArtifactType;
@@ -40,6 +41,8 @@ import org.apache.geronimo.j2ee.deployme
 import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Jsr77Naming;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.osgi.MockBundleContext;
 import org.apache.geronimo.kernel.repository.Artifact;
@@ -81,6 +84,7 @@ public class PlanParsingTest extends Xml
     private Environment defaultEnvironment = new Environment();
     private JettyModuleBuilder builder;
     private AtomicBoolean isDefault = new AtomicBoolean(false);
+    private Kernel kernel;
 
     protected void setUp() throws Exception {
         super.setUp();
@@ -143,11 +147,12 @@ public class PlanParsingTest extends Xml
                 }
             };
         bundleContext.registerService(PackageAdmin.class.getName(), packageAdmin, null);
+        kernel = KernelFactory.newInstance(bundleContext).createKernel("test");
+        kernel.boot(bundleContext);
         builder = new JettyModuleBuilder(defaultEnvironment,
                 new Integer(1800),
                 jettyContainerObjectName,
                 new WebAppInfo(),
-                null,
                 pojoWebServiceTemplate,
                 Collections.singleton(webServiceBuilder),
                 null,
@@ -155,7 +160,7 @@ public class PlanParsingTest extends Xml
                 new NamingBuilderCollection(null),
                 null,
                 new MockResourceEnvironmentSetter(),
-                null,
+                kernel,
                 bundleContext);
         builder.doStart();
         securityBuilder.doStart();
@@ -164,6 +169,7 @@ public class PlanParsingTest extends Xml
     protected void tearDown() throws Exception {
         super.tearDown();
         builder.doStop();
+        kernel.shutdown();
     }
 
     public void testContents() throws Exception {

Modified: geronimo/server/trunk/plugins/jetty8/jetty8-deployer/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/jetty8-deployer/src/main/plan/plan.xml?rev=1296271&r1=1296270&r2=1296271&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/jetty8-deployer/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/plugins/jetty8/jetty8-deployer/src/main/plan/plan.xml Fri Mar  2
16:07:47 2012
@@ -826,35 +826,6 @@
 
             </web-app>
         </xml-attribute>
-        <xml-attribute name="jspServlet">
-            <web-app xmlns="http://java.sun.com/xml/ns/javaee">
-                <servlet>
-                    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
-                    <init-param>
-                        <param-name>development</param-name>
-                        <param-value>false</param-value>
-                    </init-param>
-                    <init-param>
-                        <param-name>fork</param-name>
-                        <param-value>false</param-value>
-                    </init-param>
-                    <init-param>
-                        <param-name>logVerbosityLevel</param-name>
-                        <param-value>DEBUG</param-value>
-                    </init-param>
-                    <init-param>
-                        <param-name>xpoweredBy</param-name>
-                        <param-value>false</param-value>
-                    </init-param>
-                    <init-param>
-                        <param-name>engineOptionsClass</param-name>
-                        <param-value>org.apache.geronimo.jasper.JspServletOptions</param-value>
-                    </init-param>
-                </servlet>
-            </web-app>
-
-
-        </xml-attribute>
         <references name="ServiceBuilders">
             <pattern>
                 <name>GBeanBuilder</name>

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=1296271&r1=1296270&r2=1296271&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Fri Mar  2 16:07:47 2012
@@ -63,6 +63,7 @@ import org.apache.geronimo.j2ee.deployme
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.lifecycle.LifecycleAdapter;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.util.FileUtils;
 import org.apache.geronimo.kernel.util.IOUtils;
@@ -84,9 +85,9 @@ import org.apache.geronimo.web.deploymen
 import org.apache.geronimo.web.info.ServletInfo;
 import org.apache.geronimo.web.info.WebAppInfo;
 import org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder;
+import org.apache.geronimo.web25.deployment.JspServletInfoProvider;
 import org.apache.geronimo.web25.deployment.StandardWebAppInfoFactory;
 import org.apache.geronimo.web25.deployment.WebAppInfoBuilder;
-import org.apache.geronimo.web25.deployment.WebAppInfoFactory;
 import org.apache.geronimo.web25.deployment.security.AuthenticationWrapper;
 import org.apache.geronimo.xbeans.geronimo.jaspi.JaspiAuthModuleType;
 import org.apache.geronimo.xbeans.geronimo.jaspi.JaspiConfigProviderType;
@@ -162,12 +163,12 @@ public class TomcatModuleBuilder extends
     protected final NamespaceDrivenBuilderCollection clusteringBuilders;
 
     public static final String GBEAN_REF_CLUSTERING_BUILDERS = "ClusteringBuilders";
-    private final WebAppInfoFactory webAppInfoFactory;
+    private final StandardWebAppInfoFactory webAppInfoFactory;
+    private final JspServletInfoProviderListener jspServletInfoProviderListener = new JspServletInfoProviderListener();
 
     public TomcatModuleBuilder(@ParamAttribute(name = "defaultEnvironment") Environment defaultEnvironment,
             @ParamAttribute(name = "tomcatContainerName") AbstractNameQuery tomcatContainerName,
             @ParamAttribute(name = "defaultWebApp") WebAppInfo defaultWebApp,
-            @ParamAttribute(name = "jspServlet") WebAppInfo jspServlet,
             @ParamReference(name="WebServiceBuilder", namingType = NameFactory.MODULE_BUILDER)
Collection<WebServiceBuilder> webServiceBuilder,
             @ParamReference(name="ServiceBuilders", namingType = NameFactory.MODULE_BUILDER)Collection<NamespaceDrivenBuilder>
serviceBuilders,
             @ParamReference(name="NamingBuilders", namingType = NameFactory.MODULE_BUILDER)NamingBuilder
namingBuilders,
@@ -180,22 +181,18 @@ public class TomcatModuleBuilder extends
         this.defaultEnvironment = defaultEnvironment;
         this.clusteringBuilders = new NamespaceDrivenBuilderCollection(clusteringBuilders);
         this.tomcatContainerName = tomcatContainerName;
-        ServletInfo jspServletInfo;
-        if (jspServlet != null) {
-            jspServletInfo = jspServlet.servlets.get(0);
-        } else {
-            jspServletInfo = null;
-        }
-        this.webAppInfoFactory = new StandardWebAppInfoFactory(defaultWebApp, jspServletInfo);
+        this.webAppInfoFactory = new StandardWebAppInfoFactory(defaultWebApp, null);
 
     }
 
     public void doStart() throws Exception {
         XmlBeansUtil.registerNamespaceUpdates(NAMESPACE_UPDATES);
+        kernel.getLifecycleMonitor().addLifecycleListener(jspServletInfoProviderListener,
new AbstractNameQuery(JspServletInfoProvider.class.getName()));
     }
 
     public void doStop() {
         XmlBeansUtil.unregisterNamespaceUpdates(NAMESPACE_UPDATES);
+        kernel.getLifecycleMonitor().removeLifecycleListener(jspServletInfoProviderListener);
     }
 
     public void doFail() {
@@ -723,6 +720,25 @@ public class TomcatModuleBuilder extends
         return TOMCAT_NAMESPACE;
     }
 
+    private class JspServletInfoProviderListener extends LifecycleAdapter {
+
+        @Override
+        public void running(AbstractName abstractName) {
+            try {
+                JspServletInfoProvider jspServletInfoProvider = (JspServletInfoProvider)
kernel.getGBean(abstractName);
+                ServletInfo jspServletInfo = webAppInfoFactory.copy(jspServletInfoProvider.getJspServletInfo());
+                jspServletInfo.servletMappings.clear();
+                webAppInfoFactory.setJspServletInfo(jspServletInfo);
+            } catch (Exception e) {
+            }
+        }
+
+        @Override
+        public void stopped(AbstractName abstractName) {
+            webAppInfoFactory.setJspServletInfo(null);
+        }
+    }
+
     private static class TomcatAuthenticationWrapper implements AuthenticationWrapper {
         private final TomcatAuthenticationType authType;
 

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java?rev=1296271&r1=1296270&r2=1296271&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java
Fri Mar  2 16:07:47 2012
@@ -34,6 +34,8 @@ import org.apache.geronimo.j2ee.deployme
 import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Jsr77Naming;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.osgi.MockBundleContext;
 import org.apache.geronimo.kernel.repository.Artifact;
@@ -64,6 +66,7 @@ public class PlanParsingTest extends Tes
     private WebServiceBuilder webServiceBuilder = null;
     private Environment defaultEnvironment = new Environment();
     private TomcatModuleBuilder builder;
+    private Kernel kernel;
 
     protected void setUp() throws Exception {
         MockBundleContext bundleContext = new MockBundleContext(getClass().getClassLoader(),
"", null, null);
@@ -124,17 +127,18 @@ public class PlanParsingTest extends Tes
                 }
             };
         bundleContext.registerService(PackageAdmin.class.getName(), packageAdmin, null);
+        kernel = KernelFactory.newInstance(bundleContext).createKernel("test");
+        kernel.boot(bundleContext);
         builder = new TomcatModuleBuilder(defaultEnvironment,
                 tomcatContainerObjectName,
                 new WebAppInfo(),
-                null,
                 Collections.singleton(webServiceBuilder),
                 Arrays.asList(new GBeanBuilder(), new GeronimoSecurityBuilderImpl(null, null,
null)),
                 new NamingBuilderCollection(null),
                 Collections.EMPTY_LIST,
                 null,
                 new MockResourceEnvironmentSetter(),
-                null,
+                kernel,
                 bundleContext);
         builder.doStart();
         GeronimoSecurityBuilderImpl securityBuilder = new GeronimoSecurityBuilderImpl(null,
null, null);
@@ -143,6 +147,7 @@ public class PlanParsingTest extends Tes
 
     protected void tearDown() throws Exception {
         builder.doStop();
+        kernel.shutdown();
     }
 
     public void testConvertPlan() throws Exception {

Modified: geronimo/server/trunk/plugins/tomcat/tomcat7-deployer/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/tomcat7-deployer/src/main/plan/plan.xml?rev=1296271&r1=1296270&r2=1296271&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/tomcat7-deployer/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/plugins/tomcat/tomcat7-deployer/src/main/plan/plan.xml Fri Mar 
2 16:07:47 2012
@@ -862,35 +862,6 @@
                  
              </web-app>
          </xml-attribute>
-         <xml-attribute name="jspServlet">
-             <web-app xmlns="http://java.sun.com/xml/ns/javaee">
-                 <servlet>
-                     <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
-                     <init-param>
-                         <param-name>development</param-name>
-                         <param-value>false</param-value>
-                     </init-param>
-                     <init-param>
-                         <param-name>fork</param-name>
-                         <param-value>false</param-value>
-                     </init-param>
-                     <init-param>
-                         <param-name>logVerbosityLevel</param-name>
-                         <param-value>DEBUG</param-value>
-                     </init-param>
-                     <init-param>
-                         <param-name>xpoweredBy</param-name>
-                         <param-value>false</param-value>
-                     </init-param>
-                     <init-param>
-                         <param-name>engineOptionsClass</param-name>
-                         <param-value>org.apache.geronimo.jasper.JspServletOptions</param-value>
-                     </init-param>
-                 </servlet>
-             </web-app>
-
-
-         </xml-attribute>
     </gbean>
 
     <gbean name="Tomcat7WARConfigurer" class="org.apache.geronimo.web.deployment.WARConfigurer"/>

Modified: geronimo/server/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/pom.xml?rev=1296271&r1=1296270&r2=1296271&view=diff
==============================================================================
--- geronimo/server/trunk/pom.xml (original)
+++ geronimo/server/trunk/pom.xml Fri Mar  2 16:07:47 2012
@@ -1311,6 +1311,12 @@
             </dependency>
 
             <dependency>
+                <groupId>org.apache.servicemix.bundles</groupId>
+                <artifactId>org.apache.servicemix.bundles.asm</artifactId>
+                <version>3.3_2</version>
+            </dependency>
+
+            <dependency>
                 <groupId>org.apache.openwebbeans</groupId>
                 <artifactId>openwebbeans-spi</artifactId>
                 <version>${openwebbeansVersion}</version>



Mime
View raw message