geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1295667 - in /geronimo/server/branches/3.0-beta/plugins: j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/ jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/ jetty8/geronimo-...
Date Thu, 01 Mar 2012 16:47:22 GMT
Author: xuhaihong
Date: Thu Mar  1 16:47:21 2012
New Revision: 1295667

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

Added:
    geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/JspServletInfoProvider.java
  (with props)
Modified:
    geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/StandardWebAppInfoFactory.java
    geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java
  (contents, props changed)
    geronimo/server/branches/3.0-beta/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
    geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
    geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilderTest.java
    geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/PlanParsingTest.java
    geronimo/server/branches/3.0-beta/plugins/jetty8/jetty8-deployer/src/main/plan/plan.xml
    geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
    geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java
    geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
    geronimo/server/branches/3.0-beta/plugins/tomcat/tomcat7-deployer/src/main/plan/plan.xml

Added: geronimo/server/branches/3.0-beta/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/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/JspServletInfoProvider.java?rev=1295667&view=auto
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/JspServletInfoProvider.java
(added)
+++ geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/JspServletInfoProvider.java
Thu Mar  1 16:47:21 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();
+}

Propchange: geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/JspServletInfoProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/JspServletInfoProvider.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/JspServletInfoProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/branches/3.0-beta/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/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/StandardWebAppInfoFactory.java?rev=1295667&r1=1295666&r2=1295667&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/StandardWebAppInfoFactory.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/StandardWebAppInfoFactory.java
Thu Mar  1 16:47:21 2012
@@ -35,7 +35,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 +103,7 @@ public class StandardWebAppInfoFactory e
         return servletInfo;
     }
 
+    public void setJspServletInfo(ServletInfo jspServletInfo) {
+        this.jspServletInfo = jspServletInfo;
+    }
 }

Modified: geronimo/server/branches/3.0-beta/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/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java?rev=1295667&r1=1295666&r2=1295667&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java
Thu Mar  1 16:47:21 2012
@@ -67,7 +67,7 @@ import org.apache.openejb.jee.WebResourc
 import org.apache.openejb.jee.WelcomeFileList;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public class WebAppInfoBuilder {
 
@@ -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;

Propchange: geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/branches/3.0-beta/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/branches/3.0-beta/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java?rev=1295667&r1=1295666&r2=1295667&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
Thu Mar  1 16:47:21 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,11 @@ 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/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java?rev=1295667&r1=1295666&r2=1295667&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
Thu Mar  1 16:47:21 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,
@@ -164,24 +166,19 @@ public class JettyModuleBuilder extends 
         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.webAppInfoFactory = new StandardWebAppInfoFactory(defaultWebApp, null);
         this.clusteringBuilders = new NamespaceDrivenBuilderCollection(clusteringBuilders);//,
GerClusteringDocument.type.getDocumentElementName());
     }
 
     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);
     }
@@ -651,6 +648,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/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilderTest.java?rev=1295667&r1=1295666&r2=1295667&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilderTest.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilderTest.java
Thu Mar  1 16:47:21 2012
@@ -352,7 +352,6 @@ public class JettyModuleBuilderTest exte
                 new AbstractNameQuery(containerName),
                 //new AbstractNameQuery(containerName),
                 new WebAppInfo(),
-                null,
                 pojoWebServiceTemplate,
                 Collections.singleton(webServiceBuilder),
                 null,

Modified: geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/PlanParsingTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/PlanParsingTest.java?rev=1295667&r1=1295666&r2=1295667&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/PlanParsingTest.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/jetty8/geronimo-jetty8-builder/src/test/java/org/apache/geronimo/jetty8/deployment/PlanParsingTest.java
Thu Mar  1 16:47:21 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,9 @@ 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.MockKernel;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.osgi.MockBundleContext;
 import org.apache.geronimo.kernel.repository.Artifact;
@@ -81,6 +85,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 +148,12 @@ public class PlanParsingTest extends Xml
                 }
             };
         bundleContext.registerService(PackageAdmin.class.getName(), packageAdmin, null);
+        kernel = KernelFactory.newInstance(bundleContext).createKernel("test");
+        kernel.boot();
         builder = new JettyModuleBuilder(defaultEnvironment,
                 new Integer(1800),
                 jettyContainerObjectName,
                 new WebAppInfo(),
-                null,
                 pojoWebServiceTemplate,
                 Collections.singleton(webServiceBuilder),
                 null,
@@ -155,7 +161,7 @@ public class PlanParsingTest extends Xml
                 new NamingBuilderCollection(null),
                 null,
                 new MockResourceEnvironmentSetter(),
-                null,
+                kernel,
                 bundleContext);
         builder.doStart();
         securityBuilder.doStart();
@@ -164,6 +170,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/branches/3.0-beta/plugins/jetty8/jetty8-deployer/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/jetty8/jetty8-deployer/src/main/plan/plan.xml?rev=1295667&r1=1295666&r2=1295667&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/jetty8/jetty8-deployer/src/main/plan/plan.xml
(original)
+++ geronimo/server/branches/3.0-beta/plugins/jetty8/jetty8-deployer/src/main/plan/plan.xml
Thu Mar  1 16:47:21 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/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=1295667&r1=1295666&r2=1295667&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Thu Mar  1 16:47:21 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,17 @@ 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 +719,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/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java?rev=1295667&r1=1295666&r2=1295667&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java
Thu Mar  1 16:47:21 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,9 +66,10 @@ 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);
+        MockBundleContext bundleContext = new MockBundleContext(getClass().getClassLoader(),
"", null, null);        
         PackageAdmin packageAdmin = new PackageAdmin() {
 
                 @Override
@@ -124,17 +127,18 @@ public class PlanParsingTest extends Tes
                 }
             };
         bundleContext.registerService(PackageAdmin.class.getName(), packageAdmin, null);
+        kernel = KernelFactory.newInstance(bundleContext).createKernel("test");
+        kernel.boot();
         builder = new TomcatModuleBuilder(defaultEnvironment,
                 tomcatContainerObjectName,
                 new WebAppInfo(),
-                null,
                 Collections.singleton(webServiceBuilder),
                 Arrays.asList(new GBeanBuilder(null, null), 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/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java?rev=1295667&r1=1295666&r2=1295667&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
Thu Mar  1 16:47:21 2012
@@ -16,7 +16,6 @@
  */
 package org.apache.geronimo.tomcat;
 
-import java.beans.PropertyChangeListener;
 import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -47,15 +46,12 @@ import javax.security.auth.Subject;
 import javax.security.auth.login.LoginException;
 import javax.security.jacc.PolicyContext;
 import javax.security.jacc.PolicyContextException;
-import javax.servlet.RequestDispatcher;
 import javax.servlet.Servlet;
 import javax.servlet.ServletContainerInitializer;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 import javax.servlet.ServletRegistration;
 import javax.servlet.ServletRequest;
-import javax.servlet.ServletRequestEvent;
-import javax.servlet.ServletRequestListener;
 import javax.servlet.ServletSecurityElement;
 
 import org.apache.catalina.Container;
@@ -109,7 +105,6 @@ import org.apache.geronimo.webservices.W
 import org.apache.geronimo.webservices.WebServiceContainerInvoker;
 import org.apache.naming.resources.FileDirContext;
 import org.apache.tomcat.InstanceManager;
-import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.IntrospectionUtils;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;

Modified: geronimo/server/branches/3.0-beta/plugins/tomcat/tomcat7-deployer/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/tomcat/tomcat7-deployer/src/main/plan/plan.xml?rev=1295667&r1=1295666&r2=1295667&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/tomcat/tomcat7-deployer/src/main/plan/plan.xml
(original)
+++ geronimo/server/branches/3.0-beta/plugins/tomcat/tomcat7-deployer/src/main/plan/plan.xml
Thu Mar  1 16:47:21 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"/>



Mime
View raw message