https://issues.apache.org/jira/browse/EXTSCRIPT-144

adding a simple hello world example app to ease things for kickstarting


git-svn-id: https://svn.apache.org/repos/asf/myfaces/extensions/scripting/trunk@1000431 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/web.xml b/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/web.xml
index 39b2f16..61b6208 100644
--- a/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/web.xml
+++ b/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/web.xml
@@ -18,7 +18,8 @@
  * specific language governing permissions and limitations
  * under the License.
 -->
-<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
 
 
@@ -28,7 +29,8 @@
             Initializes the plugins for our groovy handlers
         </description>
         <param-name>org.apache.myfaces.FACES_INIT_PLUGINS</param-name>
-        <param-value>org.apache.myfaces.extensions.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
+        <param-value>org.apache.myfaces.extensions.scripting.servlet.StartupServletContextPluginChainLoader
+        </param-value>
     </context-param>
 
 
diff --git a/extscript-examples/myfaces20-example/src/main/webapp/beanValidation.xhtml b/extscript-examples/myfaces20-example/src/main/webapp/beanValidation.xhtml
index af3637c..983ae10 100644
--- a/extscript-examples/myfaces20-example/src/main/webapp/beanValidation.xhtml
+++ b/extscript-examples/myfaces20-example/src/main/webapp/beanValidation.xhtml
@@ -14,6 +14,7 @@
             <h:outputText
                     value="A simple bean validation example using Apache MyFaces Ext-Val and the Bean Validation RI"/>
         </h1>
+
         <h2>
             <h:outputText
                     value="You can edit the corresponding files under /WEB-INF/java/org/apache/myfaces/javaloader/beanvalidationtesting/"/>
diff --git a/extscript-examples/myfaces20-extscript-helloworld/pom.xml b/extscript-examples/myfaces20-extscript-helloworld/pom.xml
new file mode 100644
index 0000000..e210924
--- /dev/null
+++ b/extscript-examples/myfaces20-extscript-helloworld/pom.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+
+    <parent>
+        <artifactId>extscript-examples</artifactId>
+        <groupId>org.apache.myfaces.extensions.scripting</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.myfaces.extensions.scripting</groupId>
+    <artifactId>myfaces20-extscript-helloworld</artifactId>
+    <packaging>war</packaging>
+    <name>A simple project for MyFaces 2.0 and Ext-Scripting 1.0</name>
+    <version>1.0-SNAPSHOT</version>
+    <url>http://www.apache.org</url>
+
+    <scm>
+        <connection>
+            scm:svn:http://svn.apache.org/repos/asf/myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-extscript-helloworld
+        </connection>
+        <developerConnection>
+            scm:svn:https://svn.apache.org/repos/asf/myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-extscript-helloworld
+        </developerConnection>
+        <url>http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-extscript-helloworld</url>
+    </scm>
+
+    <repositories>
+        <repository>
+            <id>maven2-repository.dev.java.net</id>
+            <url>http://download.java.net/maven/2</url>
+        </repository>
+
+    </repositories>
+
+    <build>
+        <plugins>
+
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+            </plugin>
+
+
+        </plugins>
+    </build>
+
+    <dependencies>
+        <!--
+             optional Groovy include,
+             if we leave it out, Groovy support is disabled
+             and only java support will work
+         -->
+        <dependency>
+            <groupId>org.codehaus.groovy</groupId>
+            <artifactId>groovy-all</artifactId>
+            <version>${groovy.version}</version>
+        </dependency>
+
+        <!--
+             Note this is the only dependency we need
+             for ext-scripting, the include is a so called
+             meta bundle, which includes the entire
+             ext-scripting core+java6 support + myfaces 2 support
+         -->
+        <dependency>
+            <groupId>org.apache.myfaces.extensions.scripting</groupId>
+            <artifactId>extscript-myfaces20-bundle</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-api</artifactId>
+            <version>${myfaces2.version}</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-impl</artifactId>
+            <version>${myfaces2.version}</version>
+            <scope>compile</scope>
+        </dependency>
+
+
+
+    </dependencies>
+</project>
diff --git a/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/WEB-INF/faces-config.xml b/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..5cd83af
--- /dev/null
+++ b/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!--
+ * 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.
+-->
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
+              version="2.0">
+</faces-config>
\ No newline at end of file
diff --git a/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/WEB-INF/groovy/demo/GroovyHello.groovy b/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/WEB-INF/groovy/demo/GroovyHello.groovy
new file mode 100644
index 0000000..d9a9ca6
--- /dev/null
+++ b/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/WEB-INF/groovy/demo/GroovyHello.groovy
@@ -0,0 +1,13 @@
+package demo
+
+import javax.faces.bean.ManagedBean
+
+/**
+ *
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+@ManagedBean
+public class GroovyHello {
+  def helloWorld = "hello world from a dynamic groovy bean"
+}
diff --git a/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/WEB-INF/java/demo/JavaHello.java b/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/WEB-INF/java/demo/JavaHello.java
new file mode 100644
index 0000000..cb87fe8
--- /dev/null
+++ b/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/WEB-INF/java/demo/JavaHello.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 demo;
+
+import javax.faces.bean.ManagedBean;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ *
+ * Dynamic java hello world bean
+ */
+
+@ManagedBean
+public class JavaHello {
+    String helloWorld = "Hello from a dynamic java bean";
+
+    public String getHelloWorld() {
+        return helloWorld;
+    }
+
+    public void setHelloWorld(String helloWorld) {
+        this.helloWorld = helloWorld;
+    }
+}
diff --git a/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/WEB-INF/web.xml b/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..51c1f00
--- /dev/null
+++ b/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,176 @@
+<?xml version="1.0"?>
+
+<!--
+ * 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.
+-->
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+
+    <description>Webproject.xml</description>
+
+
+    <!--
+    Note this entry is vital it plugs the ext-scripting system into
+    a myfaces extension point
+    -->
+    <context-param>
+        <description>
+            Initializes the plugins for our groovy handlers
+        </description>
+        <param-name>org.apache.myfaces.FACES_INIT_PLUGINS</param-name>
+        <param-value>org.apache.myfaces.extensions.scripting.servlet.StartupServletContextPluginChainLoader
+        </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>
+            /whatever/development/workspace/extensions-scripting3/extscript-examples/myfaces20-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.java.LOADER_PATHS</param-name>
+        <param-value>
+            /whatever/development/workspace/extensions-scripting3/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/java
+        </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>
+            /whatever/development/workspace/extensions-scripting3/extscript-examples/myfaces20-example/src/main/webapp
+        </param-value>
+    </context-param>
+
+    <context-param>
+        <description>a redirecting Facelet resource resolver which allows to pick up templates and resources from our
+            source dir
+        </description>
+        <param-name>facelets.RESOURCE_RESOLVER</param-name>
+        <param-value>org.apache.myfaces.extensions.scripting.facelet.ReroutingResourceResolver</param-value>
+    </context-param>
+    -->
+    <!--
+    <context-param>
+        <description>a comma separated whitelist of root packages which are compiled those and nothing else
+            will be compiled during all compile stages, all other files stay permanently as they are
+        </description>
+        <param-name>org.apache.myfaces.extensions.scripting.PGK_WHITELIST</param-name>
+        <param-value>org.apache.myfaces.groovyloader.blog</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>D:/whatever/threads/extscript/examples/myfaces20-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.java.LOADER_PATHS</param-name>
+        <param-value>D:/whatever/threads/extscript/examples/myfaces20-example/src/main/webapp/WEB-INF/java</param-value>
+    </context-param>
+
+
+    -->
+
+
+    <context-param>
+        <param-name>javax.faces.PROJECT_STAGE</param-name>
+        <param-value>Development</param-value>
+    </context-param>
+
+
+    <context-param>
+        <description>State saving method: "client" or "server" (= default)
+            See JSF Specification 2.5.3
+        </description>
+        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+        <param-value>server</param-value>
+    </context-param>
+
+
+    <!--
+    Note, this servlet filter is vital without it Ext-Scripting will not work,
+    if you do not set it you will get an appropriate warning in the command line
+    -->
+    <filter>
+        <filter-name>scriptingFilter</filter-name>
+        <filter-class>org.apache.myfaces.extensions.scripting.servlet.ScriptingServletFilter</filter-class>
+    </filter>
+    <filter-mapping>
+        <filter-name>scriptingFilter</filter-name>
+        <url-pattern>/*</url-pattern>
+        <dispatcher>REQUEST</dispatcher>
+        <dispatcher>FORWARD</dispatcher>
+        <dispatcher>INCLUDE</dispatcher>
+        <dispatcher>ERROR</dispatcher>
+    </filter-mapping>
+
+    <!-- Listener, to allow Jetty serving MyFaces apps -->
+    <listener>
+        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+    </listener>
+
+    <!-- Faces Servlet -->
+    <servlet>
+        <servlet-name>Faces Servlet</servlet-name>
+        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <!-- Faces Servlet Mapping -->
+    <servlet-mapping>
+        <servlet-name>Faces Servlet</servlet-name>
+        <url-pattern>*.jsf</url-pattern>
+    </servlet-mapping>
+
+    <servlet-mapping>
+        <servlet-name>Faces Servlet</servlet-name>
+        <url-pattern>/faces/*</url-pattern>
+    </servlet-mapping>
+
+
+    <!-- Welcome files -->
+    <welcome-file-list>
+        <welcome-file>index.jsp</welcome-file>
+        <welcome-file>index.html</welcome-file>
+    </welcome-file-list>
+
+</web-app>
diff --git a/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/helloWorld.xhtml b/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/helloWorld.xhtml
new file mode 100644
index 0000000..87656b4
--- /dev/null
+++ b/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/helloWorld.xhtml
@@ -0,0 +1,14 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
+      xmlns:f="http://java.sun.com/jsf/core"
+      xmlns:h="http://java.sun.com/jsf/html"
+        >
+<h:head>
+    <title>Hello World</title>
+</h:head>
+<h:body>
+    <h:outputText value="#{javaHello.helloWorld}" />
+    <h:outputText value="#{groovyHello.helloWorld}" />
+</h:body>
+</html>
diff --git a/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/index.jsp b/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/index.jsp
new file mode 100644
index 0000000..330de79
--- /dev/null
+++ b/extscript-examples/myfaces20-extscript-helloworld/src/main/webapp/index.jsp
@@ -0,0 +1,4 @@
+<%@ page session="false" %>
+<%
+    response.sendRedirect("helloWorld.jsf");
+%>
\ No newline at end of file
diff --git a/extscript-examples/pom.xml b/extscript-examples/pom.xml
index 220afae..1d413c7 100644
--- a/extscript-examples/pom.xml
+++ b/extscript-examples/pom.xml
@@ -56,6 +56,9 @@
     </build>
     <modules>
         <module>myfaces12-example</module>
+        <module>myfaces20-example</module>
+        <module>myfaces20-extscript-helloworld</module>
+
         <module>spring-example</module>
     </modules>