EXTSCRIPT-178: fixing the base engine, since tomcat returns a null
path on "./" adding context.xmls wherever needed
added scripting paths for the testing example
fixing the startu process since spring behaves
differently in startup compared to jetty.
This should also resolve a likely issue with
big irons where paths are not getting picked up.
git-svn-id: https://svn.apache.org/repos/asf/myfaces/extensions/scripting/trunk@1402076 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/core/engine/BaseEngine.java b/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/core/engine/BaseEngine.java
index c887348..2f453a4 100644
--- a/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/core/engine/BaseEngine.java
+++ b/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/core/engine/BaseEngine.java
@@ -237,9 +237,11 @@
if (pathSeparatedList.equals(defaultValue))
{
URL resource = ClassUtils.getContextClassLoader().getResource("./");
+ //in war deployments a problem can occur if not all paths are set
+ String path = (resource == null)? "bogusPath" : resource.getPath();
try
{
- pathSeparatedList = FilenameUtils.normalize(URLDecoder.decode(resource.getPath(),
+ pathSeparatedList = FilenameUtils.normalize(URLDecoder.decode(path,
Charset.defaultCharset().toString())
+ "../.." + defaultValue);
}
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
index a5a2f2c..a0eb045 100644
--- 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
@@ -53,21 +53,7 @@
wac.refresh();
//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(INITIALIZED) == null)
- {
- //probably already started
- StartupServletContextPluginChainLoader.startup(servletContext);
- servletContext.setAttribute(INITIALIZED, Boolean.TRUE);
- }
- }
- catch (IOException e)
- {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
+
Class contextClass = determineContextClass(servletContext);
if (!ConfigurableWebApplicationContext.class.isAssignableFrom(contextClass))
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
index fc843d6..ce28b66 100644
--- 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
@@ -19,10 +19,12 @@
package org.apache.myfaces.extensions.scripting.spring.context;
+import org.apache.myfaces.extensions.scripting.jsf.startup.StartupServletContextPluginChainLoader;
import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.ContextLoaderListener;
import javax.servlet.ServletContextEvent;
+import java.io.IOException;
/**
* @author Werner Punz (latest modification by $Author$)
@@ -40,6 +42,22 @@
@Override
public void contextInitialized(ServletContextEvent event)
{
+ try
+ {
+ //the reloading listener also is the marker to avoid double initialisation
+ //after the container is kickstarted
+ if (event.getServletContext().getAttribute("StartupInitialized") == null)
+ {
+ //probably already started
+ StartupServletContextPluginChainLoader.startup(event.getServletContext());
+ event.getServletContext().setAttribute("StartupInitialized", Boolean.TRUE);
+ }
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+
super.contextInitialized(event);
}
diff --git a/extscript-examples/blog-example/src/main/webapp/META-INF/context.xml b/extscript-examples/blog-example/src/main/webapp/META-INF/context.xml
new file mode 100644
index 0000000..b23ef61
--- /dev/null
+++ b/extscript-examples/blog-example/src/main/webapp/META-INF/context.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Context>
+</Context>
\ No newline at end of file
diff --git a/extscript-examples/cdi-example/src/main/webapp/META-INF/context.xml b/extscript-examples/cdi-example/src/main/webapp/META-INF/context.xml
new file mode 100644
index 0000000..b23ef61
--- /dev/null
+++ b/extscript-examples/cdi-example/src/main/webapp/META-INF/context.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Context>
+</Context>
\ No newline at end of file
diff --git a/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/META-INF/context.xml b/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/META-INF/context.xml
new file mode 100644
index 0000000..b23ef61
--- /dev/null
+++ b/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/META-INF/context.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Context>
+</Context>
\ No newline at end of file
diff --git a/extscript-examples/pom.xml b/extscript-examples/pom.xml
index 5f395bd..443f7d2 100644
--- a/extscript-examples/pom.xml
+++ b/extscript-examples/pom.xml
@@ -28,6 +28,9 @@
Examples Meta Project, see the subprojects
for starting various parts of ext-scripting
</description>
+ <properties>
+ <tomcat7-maven-plugin.version>2.0</tomcat7-maven-plugin.version>
+ </properties>
<parent>
<groupId>org.apache.myfaces.extensions.scripting</groupId>
@@ -36,18 +39,29 @@
</parent>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/extensions/scripting/tags/extscript-root-1.0.4/extscript-examples
+ <connection>
+ scm:svn:http://svn.apache.org/repos/asf/myfaces/extensions/scripting/tags/extscript-root-1.0.4/extscript-examples
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/myfaces/extensions/scripting/tags/extscript-root-1.0.4/extscript-examples
</developerConnection>
- <url>http://svn.apache.org/viewvc/myfaces/extensions/scripting/tags/extscript-root-1.0.4/extscript-examples</url>
+ <url>http://svn.apache.org/viewvc/myfaces/extensions/scripting/tags/extscript-root-1.0.4/extscript-examples
+ </url>
</scm>
<build>
<plugins>
<plugin>
+ <groupId>org.apache.tomcat.maven</groupId>
+ <artifactId>tomcat7-maven-plugin</artifactId>
+ <version>${tomcat7-maven-plugin.version}</version>
+ <configuration>
+ <path>/</path>
+ <port>9080</port>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.2.v20120308</version>
@@ -68,8 +82,6 @@
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.0</version>
</plugin>
-
-
</plugins>
</build>
<modules>
diff --git a/extscript-examples/spring-example/pom.xml b/extscript-examples/spring-example/pom.xml
index 26d2196..ce86c39 100644
--- a/extscript-examples/spring-example/pom.xml
+++ b/extscript-examples/spring-example/pom.xml
@@ -79,14 +79,19 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
- <version>2.5.6</version>
+ <version>${spring.version}</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
- <version>2.1_3</version>
+ <version>${cglib.version}</version>
</dependency>
</dependencies>
+ <properties>
+ <spring.version>2.5.6</spring.version>
+ <cglib.version>2.1_3</cglib.version>
+ </properties>
+
</project>
\ No newline at end of file
diff --git a/extscript-examples/spring-example/src/main/webapp/META-INF/context.xml b/extscript-examples/spring-example/src/main/webapp/META-INF/context.xml
new file mode 100644
index 0000000..b23ef61
--- /dev/null
+++ b/extscript-examples/spring-example/src/main/webapp/META-INF/context.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Context>
+</Context>
\ No newline at end of file
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 ecea920..f440051 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
@@ -32,6 +32,59 @@
</context-param>
<context-param>
+ <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
+ of the deployment dir
+ </description>
+ <param-name>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</param-name>
+ <param-value>
+ /Users/werpu2/development/workspace/extscript_trunk/extscript-examples/spring-example/src/main/webapp/WEB-INF/java
+ </param-value>
+ </context-param>
+
+ <context-param>
+ <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
+ of the deployment dir
+ </description>
+ <param-name>org.apache.myfaces.extensions.scripting.ruby.LOADER_PATHS</param-name>
+ <param-value>
+ /Users/werpu2/development/workspace/extscript_trunk/extscript-examples/spring-example/src/main/webapp/WEB-INF/ruby </param-value>
+ </context-param>
+
+ <!--
+ <context-param>
+ <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
+ of the deployment dir
+ </description>
+ <param-name>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</param-name>
+ <param-value>
+ /Users/werpu2/development/workspace/extscript_trunk/extscript-examples/blog-example/src/main/webapp/WEB-INF/groovy
+ </param-value>
+ </context-param>
+
+ <context-param>
+ <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
+ of the deployment dir
+ </description>
+ <param-name>org.apache.myfaces.extensions.scripting.scala.LOADER_PATHS</param-name>
+ <param-value>
+ /Users/werpu2/development/workspace/extscript_trunk/extscript-examples/blog-example/src/main/webapp/WEB-INF/scala
+ </param-value>
+ </context-param>
+
+
+
+
+ <context-param>
+ <description>resource paths for our custom JSF2 resource resolver</description>
+ <param-name>org.apache.myfaces.extensions.scripting.resources.LOADER_PATHS</param-name>
+ <param-value>
+ /Users/werpu2/development/workspace/extscript_trunk/extscript-examples/blog-example/src/main/webapp
+ </param-value>
+ </context-param>
+ -->
+
+
+ <context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
@@ -61,10 +114,11 @@
</context-param>
<!-- Listener, to allow Jetty serving MyFaces apps -->
+ <!--
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
-
+ -->
<listener>
<!--
<listener-class>