You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by ws...@apache.org on 2006/01/17 13:26:29 UTC

svn commit: r369764 - in /struts/action/trunk: ./ conf/java/ src/java/org/apache/struts/action/ src/java/org/apache/struts/config/ src/java/org/apache/struts/util/ src/test/org/apache/struts/action/ xdocs/userGuide/

Author: wsmoak
Date: Tue Jan 17 04:26:20 2006
New Revision: 369764

URL: http://svn.apache.org/viewcvs?rev=369764&view=rev
Log:
Removed CGLIB enhancement.
May be re-added when Bug# 37730 ("Enhanced DynaActionForms cannot be correctly deserialized") is resolved.

Removed:
    struts/action/trunk/src/java/org/apache/struts/util/DynaBeanInterceptor.java
    struts/action/trunk/src/test/org/apache/struts/action/TestCGLibDynaActionForm.java
Modified:
    struts/action/trunk/conf/java/struts-config_1_3.dtd
    struts/action/trunk/pom.xml
    struts/action/trunk/project.xml
    struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java
    struts/action/trunk/src/java/org/apache/struts/config/FormBeanConfig.java
    struts/action/trunk/src/test/org/apache/struts/action/TestDynaActionFormClass.java
    struts/action/trunk/xdocs/userGuide/building_controller.xml
    struts/action/trunk/xdocs/userGuide/release-notes.xml

Modified: struts/action/trunk/conf/java/struts-config_1_3.dtd
URL: http://svn.apache.org/viewcvs/struts/action/trunk/conf/java/struts-config_1_3.dtd?rev=369764&r1=369763&r2=369764&view=diff
==============================================================================
--- struts/action/trunk/conf/java/struts-config_1_3.dtd (original)
+++ struts/action/trunk/conf/java/struts-config_1_3.dtd Tue Jan 17 04:26:20 2006
@@ -126,12 +126,7 @@
      type            Fully qualified Java class name of the ActionForm subclass
                      to use with this form bean.
                      
-     enhanced        Flag indicating if the form bean should be dynamically
-                     enhanced to include getters and setters for defined
-                     properties. This is only valid when 'type' is a
-                     dynamic form bean (an instance of 
-                     "org.apache.struts.action.DynaActionForm" or a sub-class,
-                     and requires CGLIB when enabled.
+     enhanced        Reserved for future use.
 -->
 <!ELEMENT form-bean (icon?, display-name?, description?, set-property*, form-property*)>
 <!ATTLIST form-bean      id             ID              #IMPLIED>

Modified: struts/action/trunk/pom.xml
URL: http://svn.apache.org/viewcvs/struts/action/trunk/pom.xml?rev=369764&r1=369763&r2=369764&view=diff
==============================================================================
--- struts/action/trunk/pom.xml (original)
+++ struts/action/trunk/pom.xml Tue Jan 17 04:26:20 2006
@@ -123,12 +123,6 @@
          <version>2.7.2</version>
       </dependency>
       <dependency>
-         <groupId>cglib</groupId>
-         <artifactId>cglib-nodep</artifactId>
-         <version>2.1_3</version>
-         <optional>true</optional>
-      </dependency>
-      <dependency>
          <groupId>commons-beanutils</groupId>
          <artifactId>commons-beanutils</artifactId>
          <version>1.7.0</version>

Modified: struts/action/trunk/project.xml
URL: http://svn.apache.org/viewcvs/struts/action/trunk/project.xml?rev=369764&r1=369763&r2=369764&view=diff
==============================================================================
--- struts/action/trunk/project.xml (original)
+++ struts/action/trunk/project.xml Tue Jan 17 04:26:20 2006
@@ -107,18 +107,6 @@
     </branch>
   </branches>
 
-  <dependencies>
-    <dependency>
-      <groupId>cglib</groupId>
-      <artifactId>cglib-nodep</artifactId>
-      <version>2.1_3</version>
-      <url>http://cglib.sourceforge.net/</url>
-      <properties>
-        <optional>true</optional>
-      </properties>
-    </dependency>
-  </dependencies>
-
   <build>
     <sourceDirectory>src/java</sourceDirectory>
     <unitTestSourceDirectory>src/test</unitTestSourceDirectory>

Modified: struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java?rev=369764&r1=369763&r2=369764&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java Tue Jan 17 04:26:20 2006
@@ -23,7 +23,6 @@
 import java.io.Serializable;
 import java.util.HashMap;
 
-import net.sf.cglib.proxy.Enhancer;
 import org.apache.commons.beanutils.DynaBean;
 import org.apache.commons.beanutils.DynaClass;
 import org.apache.commons.beanutils.DynaProperty;
@@ -32,7 +31,6 @@
 import org.apache.struts.config.FormBeanConfig;
 import org.apache.struts.config.FormPropertyConfig;
 import org.apache.struts.util.RequestUtils;
-import org.apache.struts.util.DynaBeanInterceptor;
 
 
 /**
@@ -85,12 +83,6 @@
 
 
     /**
-     * <p>The CGLIB <code>Enhancer</code> which we will use to dynamically
-     * add getters/setters if 'enhanced' is true in the form config.
-     */
-    protected transient Enhancer enhancer = null;
-
-    /**
      * <p>The form bean configuration information for this class.</p>
      */
     protected FormBeanConfig config = null;
@@ -192,12 +184,7 @@
     public DynaBean newInstance()
         throws IllegalAccessException, InstantiationException {
 
-        DynaActionForm dynaBean = null;
-        if (config.isEnhanced()) {
-            dynaBean = (DynaActionForm) getBeanEnhancer().create();
-        } else {
-            dynaBean = (DynaActionForm) getBeanClass().newInstance();
-        }
+        DynaActionForm dynaBean = (DynaActionForm) getBeanClass().newInstance();
         dynaBean.setDynaActionFormClass(this);
         FormPropertyConfig[] props = config.findFormPropertyConfigs();
         for (int i = 0; i < props.length; i++) {
@@ -277,24 +264,6 @@
 
 
     /**
-     * <p>Return the <code>Enhancer</code> we are using to construct new
-     * instances, re-introspecting our {@link FormBeanConfig} if necessary
-     * (that is, after being deserialized, since <code>enhancer</code> is
-     * marked transient).</p>
-     *
-     * @return The enhancer used to construct new instances.
-     */
-    protected Enhancer getBeanEnhancer() {
-
-        if (enhancer == null) {
-            introspect(config);
-        }
-        return (enhancer);
-
-    }
-
-
-    /**
      * <p>Introspect our form bean configuration to identify the supported
      * properties.</p>
      *
@@ -342,11 +311,6 @@
                               properties[i]);
         }
 
-        // Create CGLIB enhancer if enhancement is enabled
-        if (config.isEnhanced()) {
-             DynaBeanInterceptor interceptor = new DynaBeanInterceptor();
-             enhancer = interceptor.createEnhancer(this, getBeanClass());
-        }
     }
 
 

Modified: struts/action/trunk/src/java/org/apache/struts/config/FormBeanConfig.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/config/FormBeanConfig.java?rev=369764&r1=369763&r2=369764&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/config/FormBeanConfig.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/config/FormBeanConfig.java Tue Jan 17 04:26:20 2006
@@ -105,20 +105,6 @@
         return (this.dynamic);
     }
 
-    /**
-     * Should the form bean class be dynamically enhanced to simplify
-     * property access in JSP and tag files?
-     */
-    protected boolean enhance = false;
-    
-    public boolean isEnhanced() {
-        return (this.enhance);
-    }
-    
-    public void setEnhanced(boolean enhance) {
-        throwIfConfigured();
-        this.enhance = enhance;
-    }
 
     /**
      * The name of the FormBeanConfig that this config inherits configuration

Modified: struts/action/trunk/src/test/org/apache/struts/action/TestDynaActionFormClass.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/test/org/apache/struts/action/TestDynaActionFormClass.java?rev=369764&r1=369763&r2=369764&view=diff
==============================================================================
--- struts/action/trunk/src/test/org/apache/struts/action/TestDynaActionFormClass.java (original)
+++ struts/action/trunk/src/test/org/apache/struts/action/TestDynaActionFormClass.java Tue Jan 17 04:26:20 2006
@@ -79,10 +79,6 @@
      */
     protected DynaActionFormClass dynaClass = null;
 
-    /**
-     * Whether an "Enhanced" DynaActionForm is created.
-     */
-    protected boolean enhanced = false;
 
     /**
      * The set of <code>FormPropertyConfig</code> objects to use when
@@ -122,7 +118,6 @@
         beanConfig = new FormBeanConfig();
         beanConfig.setName("dynaForm");
         beanConfig.setType("org.apache.struts.action.DynaActionForm");
-        beanConfig.setEnhanced(enhanced);
 
         // Add relevant property definitions
         for (int i = 0; i < dynaProperties.length; i++) {

Modified: struts/action/trunk/xdocs/userGuide/building_controller.xml
URL: http://svn.apache.org/viewcvs/struts/action/trunk/xdocs/userGuide/building_controller.xml?rev=369764&r1=369763&r2=369764&view=diff
==============================================================================
--- struts/action/trunk/xdocs/userGuide/building_controller.xml (original)
+++ struts/action/trunk/xdocs/userGuide/building_controller.xml Tue Jan 17 04:26:20 2006
@@ -697,34 +697,6 @@
     </p>
 
     <p>
-    Since release 1.3.0 it is possible to use regular JSTL EL property
-    references, without the additional '.map' qualifier. This can be
-    useful if you often reference form bean properties with JSTL or if
-    you need to pass form beans to JSP 2.0 tag files or other re-usable
-    components which shouldn't need to know how to handle DynaActionForm
-    objects specially.
-    </p>
-
-    <p>
-    To make this work, you need to do two things:
-    <ul>
-        <li>install <a href="http://cglib.sourceforge.net/">CGLIB</a>
-            in your application's classpath</li>
-        <li>include the 'enhanced="true"' attribute in the form-bean
-            declaration in struts-config.xml, like this:
-
-            <source><![CDATA[
-<form-bean name="myForm" enhanced="true"
-           type="org.apache.struts.action.DynaActionFrom">
-    ...
-</form-bean>]]></source>
-        </li>
-    </ul>
-    You can then reference DynaFormBean properties just like any other
-    ActionForm.
-    </p>
-
-    <p>
     DynaActionForms are meant as an easy solution to a common problem:
     <em>Your ActionForms use simple properties and standard validations,
     and you just pass these properties over to another JavaBean</em>

Modified: struts/action/trunk/xdocs/userGuide/release-notes.xml
URL: http://svn.apache.org/viewcvs/struts/action/trunk/xdocs/userGuide/release-notes.xml?rev=369764&r1=369763&r2=369764&view=diff
==============================================================================
--- struts/action/trunk/xdocs/userGuide/release-notes.xml (original)
+++ struts/action/trunk/xdocs/userGuide/release-notes.xml Tue Jan 17 04:26:20 2006
@@ -137,9 +137,6 @@
               <li>
                   Wildcard ActionConfig properties
               </li>
-              <li>
-                  Enhanced DynaActionForms
-              </li>
           </ul>
 
           <h4>Composable Request Processor</h4>
@@ -338,30 +335,6 @@
 &lt;/action>
 </source>
 
-          <h4>Enhanced DynaActionForms</h4>
-          <p>
-              The form-bean element in struts-config.xml now accepts
-              an <code>enhanced</code> attribute which, if set to
-              <code>true</code> for a form bean based on DynaActionForm
-              (or a sub-class), causes the form bean to be enhanced with
-              CGLIB to add getters and setters for each property, allowing
-              them to be accessed with the same JSTL EL syntax as for
-              normal form beans.
-          </p>
-          
-<source>
-&lt;form-bean name="form" enhanced="true" 
-        type="org.apache.struts.action.DynaActionForm"&gt;
-    ...
-&lt;/form-bean&gt;
-</source>
-          
-          <p>
-              <strong>NOTE:</strong> this feature requires that 
-              <a href="http://cglib.sourceforge.net/">CGLIB</a> be
-              included in your application's classpath.
-          </p>
-          
           <h3>Struts EL</h3>
 
           <p>Aside from addressing deprecrations, there was one minor change to Struts EL.</p>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org