myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From we...@apache.org
Subject svn commit: r815677 - in /myfaces/extensions/scripting/trunk: core/core/src/main/java/org/apache/myfaces/scripting/core/ core/core/src/main/java/org/apache/myfaces/scripting/core/util/ core/core/src/main/java/org/apache/myfaces/scripting/loaders/java/ ...
Date Wed, 16 Sep 2009 09:06:39 GMT
Author: werpu
Date: Wed Sep 16 09:06:38 2009
New Revision: 815677

URL: http://svn.apache.org/viewvc?rev=815677&view=rev
Log:
https://issues.apache.org/jira/browse/EXTSCRIPT-1
fixed a minor npe which occurred when the filter is not set, now
instead a warning is issued and the reloading subsystem is disabled.

Added:
    myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/DummyWeaver.java
  (with props)
    myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/ajaxTest.xhtml
Modified:
    myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/util/ProxyUtils.java
    myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/loaders/java/JavaScriptingWeaver.java
    myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/web.xml
    myfaces/extensions/scripting/trunk/examples/pom.xml

Added: myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/DummyWeaver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/DummyWeaver.java?rev=815677&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/DummyWeaver.java
(added)
+++ myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/DummyWeaver.java
Wed Sep 16 09:06:38 2009
@@ -0,0 +1,57 @@
+/*
+ * 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.scripting.core;
+
+import org.apache.myfaces.scripting.api.ScriptingWeaver;
+import org.apache.myfaces.scripting.api.ScriptingConst;
+import org.apache.myfaces.scripting.core.util.ClassUtils;
+
+import java.io.Serializable;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ *
+ * a dummy weaver in case the filter has not been set
+ */
+
+public class DummyWeaver implements Serializable, ScriptingWeaver {
+    public void appendCustomScriptPath(String scriptPaths) {
+    }
+
+    public Object reloadScriptingInstance(Object o) {
+        return o;  
+    }
+
+    public Class reloadScriptingClass(Class aclass) {
+        return aclass;  
+    }
+
+    public Class loadScriptingClassFromName(String className) {
+        return ClassUtils.forName(className);  
+    }
+
+    public int getScriptingEngine() {
+        return ScriptingConst.ENGINE_TYPE_ALL;  
+    }
+
+    public boolean isDynamic(Class clazz) {
+        return false;  
+    }
+}

Propchange: myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/DummyWeaver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/DummyWeaver.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/util/ProxyUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/util/ProxyUtils.java?rev=815677&r1=815676&r2=815677&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/util/ProxyUtils.java
(original)
+++ myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/util/ProxyUtils.java
Wed Sep 16 09:06:38 2009
@@ -21,7 +21,11 @@
 import org.apache.myfaces.scripting.api.Decorated;
 import org.apache.myfaces.scripting.api.ScriptingWeaver;
 import org.apache.myfaces.scripting.api.DynamicClassIdentifier;
+import org.apache.myfaces.scripting.api.BaseWeaver;
 import org.apache.myfaces.scripting.core.MethodLevelReloadingHandler;
+import org.apache.myfaces.scripting.core.DummyWeaver;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
 
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Proxy;
@@ -65,6 +69,12 @@
     }
 
     public static ScriptingWeaver getWeaver() {
+        ScriptingWeaver weaver = (ScriptingWeaver) _weaverHolder.get();
+        if(weaver == null) {
+            Log log = LogFactory.getLog(ProxyUtils.class);
+            log.warn("Scripting Weaver is not set. Disabling script reloading subsystem.
Make sure you have the scripting servlet filter enabled in your web.xml");
+            _weaverHolder.set(new DummyWeaver());    
+        }
         return (ScriptingWeaver) _weaverHolder.get();
     }
 

Modified: myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/loaders/java/JavaScriptingWeaver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/loaders/java/JavaScriptingWeaver.java?rev=815677&r1=815676&r2=815677&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/loaders/java/JavaScriptingWeaver.java
(original)
+++ myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/loaders/java/JavaScriptingWeaver.java
Wed Sep 16 09:06:38 2009
@@ -73,6 +73,7 @@
      */
     protected void mapProperties(Object target, Object src) {
         try {
+            //TODO add dynamic property reloading hook here
             BeanUtils.copyProperties(target, src);
         } catch (IllegalAccessException e) {
             log.debug(e);

Modified: myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/faces-config.xml?rev=815677&r1=815676&r2=815677&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/faces-config.xml
(original)
+++ myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/faces-config.xml
Wed Sep 16 09:06:38 2009
@@ -27,6 +27,8 @@
         <managed-bean-class>org.apache.myfaces.blank.HelloWorldController</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
     </managed-bean>
+
+
     <managed-bean>
         <managed-bean-name>testbean</managed-bean-name>
         <managed-bean-class>org.apache.myfaces.groovyloader.test.TestBean</managed-bean-class>
@@ -64,22 +66,19 @@
         <managed-bean-scope>application</managed-bean-scope>
     </managed-bean>
 
-    <!--
     <application>
-        <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
         <navigation-handler>
             org.apache.myfaces.groovyloader.test.TestNavigationHandler
         </navigation-handler>
 
     </application>
-    -->
 
     <lifecycle>
-
-        <phase-listener>
+       <phase-listener>
             org.apache.myfaces.groovyloader.test.TestPhaseListener
         </phase-listener>
     </lifecycle>
+    
 
     <!-- navigation rules for helloWorld.jsp -->
     <navigation-rule>
@@ -99,6 +98,7 @@
         </navigation-case>
     </navigation-rule>
 
+
     <validator>
         <validator-id>org.apache.myfaces.groovyloader.test.TestValidator</validator-id>
         <validator-class>org.apache.myfaces.groovyloader.test.TestValidator</validator-class>
@@ -119,4 +119,5 @@
             <renderer-class>org.apache.myfaces.groovyloader.test.TestRenderer</renderer-class>
         </renderer>
     </render-kit>
+
 </faces-config>
\ No newline at end of file

Modified: myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/web.xml?rev=815677&r1=815676&r2=815677&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/web.xml
(original)
+++ myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/web.xml
Wed Sep 16 09:06:38 2009
@@ -24,6 +24,7 @@
     <description>MyProject web.xml</description>
 
 
+  
     <context-param>
         <description>
             Initializes the plugins for our groovy handlers
@@ -31,7 +32,6 @@
         <param-name>org.apache.myfaces.FACES_INIT_PLUGINS</param-name>
         <param-value>org.apache.myfaces.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
     </context-param>
-   
 
 
     <context-param>
@@ -39,7 +39,7 @@
             of the deployment dir
         </description>
         <param-name>org.apache.myfaces.scripting.groovy.LOADER_PATHS</param-name>
-        <param-value>/Users/werpu2/development/workspace/extensions-scripting/examples/src/main/webapp/WEB-INF/groovy
+        <param-value>/Users/werpu2/development/workspace/extensions-scripting3/examples/myfaces20-example/src/main/webapp/WEB-INF/groovy
         </param-value>
     </context-param>
 
@@ -49,10 +49,10 @@
             of the deployment dir
         </description>
         <param-name>org.apache.myfaces.scripting.java.LOADER_PATHS</param-name>
-        <param-value>/Users/werpu2/development/workspace/extensions-scripting/examples/src/main/webapp/WEB-INF/java
+        <param-value>/Users/werpu2/development/workspace/extensions-scripting3/examples/myfaces20-example/src/main/webapp/WEB-INF/java
         </param-value>
     </context-param>
-    
+
 
     <context-param>
         <description>State saving method: "client" or "server" (= default)
@@ -61,7 +61,6 @@
         <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
         <param-value>server</param-value>
     </context-param>
-
     <context-param>
         <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
         <param-value>/WEB-INF/groovy-taglib.xml</param-value>
@@ -69,7 +68,6 @@
 
 
 
-
     <filter>
         <filter-name>scritpingFilter</filter-name>
         <filter-class>org.apache.myfaces.scripting.servlet.ScriptingServletFilter</filter-class>
@@ -82,8 +80,7 @@
         <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>

Added: myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/ajaxTest.xhtml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/ajaxTest.xhtml?rev=815677&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/ajaxTest.xhtml
(added)
+++ myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/ajaxTest.xhtml
Wed Sep 16 09:06:38 2009
@@ -0,0 +1,22 @@
+<!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"
+     >
+<head>
+<title>Hello World</title>
+</head>
+<body>
+<ui:composition template = "/template.xhtml">
+
+
+	<ui:define name = "body">
+
+
+		<h:form id = "form">
+            <h:outputScript name = "jsf.js" library = "javax.faces" target = "head" />
+       	</h:form>
+	</ui:define>
+</ui:composition>
+</body>
+</html>

Modified: myfaces/extensions/scripting/trunk/examples/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/pom.xml?rev=815677&r1=815676&r2=815677&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/pom.xml (original)
+++ myfaces/extensions/scripting/trunk/examples/pom.xml Wed Sep 16 09:06:38 2009
@@ -5,8 +5,8 @@
     <artifactId>examples</artifactId>
     <packaging>pom</packaging>
     <name>examples submodule</name>
-	<version>1.0-SNAPSHOT</version>
-	
+    <version>1.0-SNAPSHOT</version>
+
     <description>
         groovy myfaces core engine meta project
     </description>
@@ -17,10 +17,10 @@
         <version>1.0-SNAPSHOT</version>
     </parent>
 
-   <modules>
-     <module>myfaces12-example</module>
-	<module>myfaces20-example</module>
-	 <module>spring-example</module>
-   </modules>
+    <modules>
+        <module>myfaces12-example</module>
+        <module>myfaces20-example</module>
+        <module>spring-example</module>
+    </modules>
 
 </project>



Mime
View raw message