save state of affairs webapp now shot boot, and also ext-scripting
git-svn-id: https://svn.apache.org/repos/asf/myfaces/extensions/scripting/trunk@1401685 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/extscript-core-root/extscript-spring/pom.xml b/extscript-core-root/extscript-spring/pom.xml
index 5c81d0c..8a67ecd 100644
--- a/extscript-core-root/extscript-spring/pom.xml
+++ b/extscript-core-root/extscript-spring/pom.xml
@@ -24,8 +24,27 @@
<packaging>jar</packaging>
<name>MyFaces Extension Scripting Core</name>
+ <parent>
+ <groupId>org.apache.myfaces.extensions.scripting</groupId>
+ <artifactId>extscript-core-root</artifactId>
+ <version>1.0.5-SNAPSHOT</version>
+ </parent>
+
<description>
Extension Scripting Spring Submodule
</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.scripting</groupId>
+ <artifactId>extscript-core</artifactId>
+ <version>1.0.5-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring</artifactId>
+ <version>2.5.6</version>
+ </dependency>
+ </dependencies>
+
</project>
\ No newline at end of file
diff --git a/extscript-core-root/extscript-spring/src/main/java/org/apache/myfaces/extensions/scripting/spring/context/CompilationAwareContextLoader.java b/extscript-core-root/extscript-spring/src/main/java/org/apache/myfaces/extensions/scripting/spring/context/CompilationAwareContextLoader.java
new file mode 100644
index 0000000..f5ef082
--- /dev/null
+++ b/extscript-core-root/extscript-spring/src/main/java/org/apache/myfaces/extensions/scripting/spring/context/CompilationAwareContextLoader.java
@@ -0,0 +1,64 @@
+/*
+ * 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.myfaces.extensions.scripting.spring.context;
+
+import org.apache.myfaces.extensions.scripting.core.api.WeavingContext;
+import org.apache.myfaces.extensions.scripting.jsf.startup.StartupServletContextPluginChainLoader;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.context.ContextLoader;
+import org.springframework.web.context.WebApplicationContext;
+
+import javax.servlet.ServletContext;
+import java.io.IOException;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class CompilationAwareContextLoader extends ContextLoader
+{
+ private static final String RELOADING_LISTENER = "ReloadingListener";
+
+ @Override
+ protected WebApplicationContext createWebApplicationContext(
+ ServletContext servletContext, ApplicationContext parent) throws BeansException
+ {
+ WebApplicationContext retVal = super.createWebApplicationContext(servletContext, parent);
+ //we now init the scripting system
+ try
+ {
+ //the reloading listener also is the marker to avoid double initialisation
+ //after the container is kickstarted
+ if (servletContext.getAttribute(RELOADING_LISTENER) == null)
+ {
+ StartupServletContextPluginChainLoader.startup(servletContext);
+ servletContext.setAttribute(RELOADING_LISTENER, new ReloadingListener());
+ WeavingContext.getInstance().addListener((ReloadingListener) servletContext.getAttribute(RELOADING_LISTENER));
+ }
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ return retVal;
+ }
+}
diff --git a/extscript-core-root/extscript-spring/src/main/java/org/apache/myfaces/extensions/scripting/spring/context/CompilationAwareContextLoaderListener.java b/extscript-core-root/extscript-spring/src/main/java/org/apache/myfaces/extensions/scripting/spring/context/CompilationAwareContextLoaderListener.java
new file mode 100644
index 0000000..89414ac
--- /dev/null
+++ b/extscript-core-root/extscript-spring/src/main/java/org/apache/myfaces/extensions/scripting/spring/context/CompilationAwareContextLoaderListener.java
@@ -0,0 +1,43 @@
+/*
+ * 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.myfaces.extensions.scripting.spring.context;
+
+import org.springframework.web.context.ContextLoader;
+import org.springframework.web.context.ContextLoaderListener;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class CompilationAwareContextLoaderListener extends ContextLoaderListener
+{
+ /**
+ * <p>Creates the context loader to use. Note that actually the context loader
+ * starts up the web application context, this listener just delgates
+ * to it.</p>
+ *
+ * @return the context loader to use to start up the web appplication context
+ */
+ @Override
+ protected ContextLoader createContextLoader() {
+ return new CompilationAwareContextLoader();
+ }
+}
diff --git a/extscript-core-root/extscript-spring/src/main/java/org/apache/myfaces/extensions/scripting/spring/context/ReloadingListener.java b/extscript-core-root/extscript-spring/src/main/java/org/apache/myfaces/extensions/scripting/spring/context/ReloadingListener.java
new file mode 100644
index 0000000..d928341
--- /dev/null
+++ b/extscript-core-root/extscript-spring/src/main/java/org/apache/myfaces/extensions/scripting/spring/context/ReloadingListener.java
@@ -0,0 +1,42 @@
+/*
+ * 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.myfaces.extensions.scripting.spring.context;
+
+import org.apache.myfaces.extensions.scripting.core.api.eventhandling.WeavingEvent;
+import org.apache.myfaces.extensions.scripting.core.api.eventhandling.WeavingEventListener;
+import org.apache.myfaces.extensions.scripting.core.api.eventhandling.events.RefreshBeginEvent;
+import org.apache.myfaces.extensions.scripting.core.api.eventhandling.events.TaintedEvent;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class ReloadingListener implements WeavingEventListener
+{
+ @Override
+ public void onEvent(WeavingEvent evt)
+ {
+ }
+}
diff --git a/extscript-core-root/pom.xml b/extscript-core-root/pom.xml
index afa2dd2..4f51785 100644
--- a/extscript-core-root/pom.xml
+++ b/extscript-core-root/pom.xml
@@ -43,6 +43,7 @@
<modules>
<module>extscript-core</module>
<module>extscript-cdi</module>
+ <module>extscript-spring</module>
<!--
<module>extscript-myfaces12-extensions</module>
<module>extscript-myfaces2-extensions</module>
diff --git a/extscript-examples/spring-example/pom.xml b/extscript-examples/spring-example/pom.xml
index dd5273f..ed06c7e 100644
--- a/extscript-examples/spring-example/pom.xml
+++ b/extscript-examples/spring-example/pom.xml
@@ -50,6 +50,12 @@
<version>${myfaces2.version}</version>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.scripting</groupId>
+ <artifactId>extscript-spring</artifactId>
+ <version>1.0.5-SNAPSHOT</version>
+ </dependency>
+
<dependency>
<groupId>org.springframework</groupId>
diff --git a/extscript-examples/spring-example/src/main/webapp/WEB-INF/web.xml b/extscript-examples/spring-example/src/main/webapp/WEB-INF/web.xml
index 5cbf9c4..41ac8a4 100644
--- a/extscript-examples/spring-example/src/main/webapp/WEB-INF/web.xml
+++ b/extscript-examples/spring-example/src/main/webapp/WEB-INF/web.xml
@@ -58,9 +58,14 @@
</listener>
<listener>
+ <!--
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
+ -->
+ <listener-class>
+ org.apache.myfaces.extensions.scripting.spring.context.CompilationAwareContextLoaderListener
+ </listener-class>
<!--
<listener-class>
at.irian.springframework.extensions.scripting.context.CompilationAwareContextLoaderListener